C# Class GameCore.NetWork.NetMessageRecieveHandle

Show file Open project: recter/Unity-Net Class Usage Examples

Public Methods

Method Description
GetInstance ( ) : NetMessageRecieveHandle
OnRecvMessage ( SocketNetPacket packet ) : void

解包处理

RegisterMessageHandler ( int command, NetOnRecvMessageDelegate del ) : void

注册消息监听

SetRecvMsgCB ( Action cb ) : void

设置收到消息时的回调函数

UnRegisterMessageHandler ( int command ) : void

注销消息监听 - 注销所有此消息号的监听 (如果消息不是模块独有,不推荐使用次方法 by Rect)

UnRegisterMessageHandler ( int command, NetOnRecvMessageDelegate del ) : void

注销消息监听 - 注销消息号指定的委托类

Private Methods

Method Description
NetMessageRecieveHandle ( ) : System

Method Details

GetInstance() public static method

public static GetInstance ( ) : NetMessageRecieveHandle
return NetMessageRecieveHandle

OnRecvMessage() public method

解包处理
public OnRecvMessage ( SocketNetPacket packet ) : void
packet SocketNetPacket
return void

RegisterMessageHandler() public method

注册消息监听
public RegisterMessageHandler ( int command, NetOnRecvMessageDelegate del ) : void
command int 消息号ID
del NetOnRecvMessageDelegate 消息接收回调委托
return void

SetRecvMsgCB() public method

设置收到消息时的回调函数
public SetRecvMsgCB ( Action cb ) : void
cb Action
return void

UnRegisterMessageHandler() public method

注销消息监听 - 注销所有此消息号的监听 (如果消息不是模块独有,不推荐使用次方法 by Rect)
public UnRegisterMessageHandler ( int command ) : void
command int 消息号ID
return void

UnRegisterMessageHandler() public method

注销消息监听 - 注销消息号指定的委托类
public UnRegisterMessageHandler ( int command, NetOnRecvMessageDelegate del ) : void
command int
del NetOnRecvMessageDelegate
return void