コード例 #1
0
        public override void OnGameData(BaseSceneGame game, GamePlayer player, GSPacketIn packet)
        {
            TankCmdType type = (TankCmdType)packet.ReadByte();

            try
            {
                if (game.GameState == eGameState.OVER && type != TankCmdType.PICK)
                {
                    return;
                }

                ICommandHandler handleCommand = _commandMgr.LoadCommandHandler((int)type);
                if (handleCommand != null)
                {
                    handleCommand.HandleCommand(this, player, packet);
                }
                else
                {
                    log.Error(string.Format("IP: {0}", player.Client.TcpEndpoint));
                }
            }
            catch (Exception e)
            {
                log.Error(string.Format("IP:{1}, OnGameData is Error: {0}", e.ToString(), player.Client.TcpEndpoint));
            }
        }
コード例 #2
0
 public void Execute(BaseGame game, long tick)
 {
     if (m_player.IsActive)
     {
         eTankCmdType type = (eTankCmdType)m_packet.ReadByte();
         try
         {
             ICommandHandler handleCommand = CommandMgr.LoadCommandHandler((int)type);
             if (handleCommand != null)
             {
                 handleCommand.HandleCommand(game, m_player, m_packet);
             }
             else
             {
                 log.Error(string.Format("Player Id: {0}", m_player.Id));
             }
         }
         catch (Exception ex)
         {
             log.Error(string.Format("Player Id: {0}  cmd:0x{1:X2}", m_player.Id, (byte)type), ex);
         }
     }
 }
コード例 #3
0
 public void Execute(BaseGame game, long tick)
 {
     if (this.m_player.IsActive)
     {
         eTankCmdType eTankCmdType = (eTankCmdType)this.m_packet.ReadByte();
         try
         {
             ICommandHandler commandHandler = CommandMgr.LoadCommandHandler((int)eTankCmdType);
             if (commandHandler != null)
             {
                 commandHandler.HandleCommand(game, this.m_player, this.m_packet);
             }
             else
             {
                 ProcessPacketAction.log.Error(string.Format("Player Id: {0}", this.m_player.Id));
             }
         }
         catch (Exception exception)
         {
             ProcessPacketAction.log.Error(string.Format("Player Id: {0}  cmd:0x{1:X2}", this.m_player.Id, (byte)eTankCmdType), exception);
         }
     }
 }
コード例 #4
0
 public void Execute(BaseGame game, long tick)
 {
     if (this.m_player.IsActive)
     {
         byte         a    = this.m_packet.ReadByte();
         eTankCmdType type = (eTankCmdType)a;
         try
         {
             ICommandHandler handleCommand = CommandMgr.LoadCommandHandler((int)type);
             if (handleCommand != null)
             {
                 handleCommand.HandleCommand(game, this.m_player, this.m_packet);
             }
             else
             {
                 ProcessPacketAction.log.Error(string.Format("Player Id: {0}", this.m_player.Id));
             }
         }
         catch (Exception ex)
         {
             ProcessPacketAction.log.Error(string.Format("Player Id: {0}  cmd:0x{1:X2}", this.m_player.Id, a), ex);
         }
     }
 }