コード例 #1
0
ファイル: SessionWrap.cs プロジェクト: BoomProject/Boom
        public void Run(Session s, Packet p)
        {
            ushort opcode = p.Opcode();
            byte   flag   = p.Flag();

            OpcodeTypeComponent opcodeTypeComponent = Game.Scene.GetComponent <OpcodeTypeComponent>();
            Type   responseType = opcodeTypeComponent.GetType(opcode);
            object message      = ProtobufHelper.FromBytes(responseType, p.Bytes, Packet.Index, p.Length - Packet.Index);

            if ((flag & 0x01) > 0)
            {
                IResponse response = message as IResponse;
                if (response == null)
                {
                    throw new Exception($"flag is response, but hotfix message is not! {opcode}");
                }

                Action <IResponse> action;
                if (!this.requestCallback.TryGetValue(response.RpcId, out action))
                {
                    return;
                }
                this.requestCallback.Remove(response.RpcId);

                action(response);
                return;
            }

            Game.Scene.GetComponent <MessageDispatherComponent>().Handle(session, new MessageInfo(opcode, message));
        }
コード例 #2
0
ファイル: ProtobufPacker.cs プロジェクト: tuita520/ETServer
 public T DeserializeFrom <T>(byte[] bytes, int index, int count)
 {
     return(ProtobufHelper.FromBytes <T>(bytes, index, count));
 }
コード例 #3
0
ファイル: ProtobufPacker.cs プロジェクト: tuita520/ETServer
 public T DeserializeFrom <T>(byte[] bytes)
 {
     return(ProtobufHelper.FromBytes <T>(bytes));
 }
コード例 #4
0
ファイル: ProtobufPacker.cs プロジェクト: tuita520/ETServer
 public object DeserializeFrom(Type type, byte[] bytes, int index, int count)
 {
     return(ProtobufHelper.FromBytes(type, bytes, index, count));
 }
コード例 #5
0
ファイル: ProtobufPacker.cs プロジェクト: tuita520/ETServer
 public object DeserializeFrom(Type type, byte[] bytes)
 {
     return(ProtobufHelper.FromBytes(type, bytes));
 }
コード例 #6
0
ファイル: ProtobufPacker.cs プロジェクト: isoundy000/ETGame
 public object DeserializeFrom(object instance, byte[] bytes, int index, int count)
 {
     return(ProtobufHelper.FromBytes(instance, bytes, index, count));
 }