示例#1
0
    protected static void baseRegister(int shMsgID, System.Type type, NetworkMsgCallFunc backFuc)
    {
        DkRecProto dkrp = new DkRecProto();

        dkrp.m_head         = new proto_header();
        dkrp.m_head.shMsgID = shMsgID;
        dkrp.type           = type;
        OnlyMsg.instance.addCallBack(shMsgID, backFuc);
        dkrp.regist();
    }
示例#2
0
    // Update is called once per frame
    void LateUpdate()
    {
        DkRspMsg drm = DkProtoQueue.Instance.pop();

        //收到服务器消息..
        if (drm != null && msgBacks.ContainsKey(drm.head.shMsgID))
        {
            //not considering retransmitting and heart beat...
            //simplize processing
            NetworkMsgCallFunc ed = msgBacks[drm.head.shMsgID];
            if (ed != null)
            {
                ed(drm);
            }
        }
        else if (drm != null)
        {
            Debug.LogError("接收到消息号为:" + (protoSources.GameProto.GameCmdCode)drm.head.shMsgID + "   ,但是您的协议未注册");
        }
    }
示例#3
0
 public void addCallBack(int msgID, NetworkMsgCallFunc backFuck)
 {
     msgBacks.Add(msgID, backFuck);
 }