예제 #1
0
    void OnReceiveMessage(MsgType type, byte[] data)
    {
        this.Log($"receive response : {type}");
        Type     t       = MsgTypeMap.GeType(type);
        IMessage message = Activator.CreateInstance(t) as IMessage;

        message.MergeFrom(data);
        mMessages.Enqueue(new KeyValuePair <MsgType, IMessage>(type, message));
    }
예제 #2
0
        public void HandleRequest(MsgType type, byte[] data, Client client)
        {
            Type     t       = MsgTypeMap.GeType(type);
            IMessage message = Activator.CreateInstance(t) as IMessage;

            message.MergeFrom(data);
            Console.WriteLine("接收到客户端请求 " + type);
            GetMsgCallBack(type).Invoke(message, client);
        }