Exemple #1
0
    //注册,模块可以注册自己关心的协议id,设置回调函数
    public void Regist(CS_CMD_ID CmdType, EventHandleMsg CallBack, EventHandleTimeOut CallBackTimeout = null)
    {
        UInt16 cmd = (UInt16)CmdType;

        if (cmd > 0 && CallBack != null)
        {
            EventHandleMsg handle = CallBack;
            AddFun(cmd, handle);
        }


        if (cmd > 0 && CallBackTimeout != null)
        {
            EventHandleTimeOut handle = CallBackTimeout;
            AddTimeoutFun(cmd, handle);
        }
    }
Exemple #2
0
    public void UnRegist(CS_CMD_ID CmdType, EventHandleMsg Handle, EventHandleTimeOut CallBackTimeout = null)
    {
        UInt16 cmd = (UInt16)CmdType;

        if (eventTable.ContainsKey(cmd))
        {
            List <EventHandleMsg> evtList = eventTable[cmd];
            evtList.Remove(Handle);
        }

        if (handleTimeOut.ContainsKey(cmd))
        {
            List <EventHandleTimeOut> timeOutList = handleTimeOut[cmd];
            if (null != CallBackTimeout)
            {
                if (timeOutList.Contains(CallBackTimeout))
                {
                    timeOutList.Remove(CallBackTimeout);
                }
            }
        }
    }
Exemple #3
0
 public void UnRegist(CS_CMD_ID CmdType, EventHandleMsg Handle, EventHandleTimeOut CallBackTimeout = null)
 {
     _gameSvrProtoUtil.UnRegist(CmdType, Handle, CallBackTimeout);
 }