コード例 #1
0
ファイル: PlayerHandle.cs プロジェクト: psygames/XiaoGame
        public override void OnMessage(byte[] data)
        {
            base.OnMessage(data);
            object proto = ProtoTool.ToProtoObj(data);

            if (proto.GetType() == typeof(message.LoginRequest))
            {
                // 发送SessionID作为key
                EventManager.instance.Send(proto.GetType().ToString(), sessionId, proto);
            }
            else
            {
                // 发送PlayerID作为key
                long playerID = ProxyManager.instance.GetProxy <PlayerProxy>().GetPlayerID(sessionId);
                Debug.Log("receive ---> {0}   {1} :len({2})", playerID, proto.GetType(), data.Length);
                EventManager.instance.Send(proto.GetType().ToString(), playerID, proto);
            }
        }