예제 #1
0
파일: Session.cs 프로젝트: taigacon/ET
        public void Run(BK.Session s, Packet packet)
        {
            ushort opcode = packet.Opcode;
            byte   flag   = packet.Flag;

            OpcodeTypeComponent opcodeTypeComponent = Game.OpcodeTypeComponent;
            Type   responseType = opcodeTypeComponent.GetType(opcode);
            object message      = this.session.Network.MessagePacker.DeserializeFrom(responseType, packet.Stream);

            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.MessageDispatherComponent.Handle(session, new MessageInfo(opcode, message));
        }
예제 #2
0
파일: AMHandler.cs 프로젝트: taigacon/ET
        public void Handle(BK.Session session, object msg)
        {
            Message message = msg as Message;

            if (message == null)
            {
                Log.Error($"消息类型转换错误: {msg.GetType().Name} to {typeof(Message).Name}");
            }
            this.Run(session, message);
        }
예제 #3
0
        public void Handle(BK.Session session, MessageInfo messageInfo)
        {
            List <IMHandler> actions;

            if (!this.handlers.TryGetValue(messageInfo.Opcode, out actions))
            {
                Log.Error($"消息 {messageInfo.Message.GetType().FullName} 没有处理");
                return;
            }

            foreach (IMHandler ev in actions)
            {
                try
                {
                    ev.Handle(session, messageInfo.Message);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            }
        }
예제 #4
0
 protected override void Run(BK.Session session, G2C_TestHotfixMessage message)
 {
     Log.Debug(message.Info);
 }
예제 #5
0
파일: AMHandler.cs 프로젝트: taigacon/ET
 protected abstract void Run(BK.Session session, Message message);
예제 #6
0
 protected override void Run(BK.Session session, Actor_Test message)
 {
     Log.Debug(message.Info);
 }