public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            uint id = packet.ReadUnsignedByte();

            GatewayGlobal.GatewayID = id;

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            GatewayPlayer player = GatewayGlobal.Players[packet.PlayerID];

            player.Client.LogicServer.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            LogicServerConnector conn = connector as LogicServerConnector;

            if (conn != null)
            {
                conn.Fulled = false;
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            GatewayPlayer player = GatewayGlobal.Players[packet.PlayerID];

            if (player != null)
            {
                player.SendTcp(packet);
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            if (GatewayGlobal.CacheServer != null && GatewayGlobal.CacheServer.Socket.Connected)
            {
                GatewayGlobal.CacheServer.SendTCP(packet);
            }
            else
            {
                //TODO: 通知客户端没有可用缓存服务器
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            int clientID = packet.ReadInt();

            GatewayClient client = GatewayGlobal.Clients[clientID];

            if (client != null)
            {
                client.SendTcp(packet);
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            uint clientID = packet.ReadUnsignedInt();

            ClientBase client = GatewayGlobal.PlayerClientMgr[clientID];

            if (client != null)
            {
                client.SendTcp(packet);
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            string ip = packet.ReadUTF();

            int port = packet.ReadInt();

            if (GatewayGlobal.CacheServer == null || GatewayGlobal.CacheServer.Socket.Connected == false)
            {
                GatewayGlobal.CacheServer = new CacheServerConnector(ip, port);
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            uint id = packet.ReadUnsignedInt();

            if (GatewayGlobal.ContainsBattleServer(id))
            {
                return 0;
            }

            string ip = packet.ReadUTF();

            int port = packet.ReadInt();

            new BattleServerConnector(id, ip, port);

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            bool logined = packet.ReadBoolean();

            uint clientID = packet.ReadUnsignedInt();

            if (logined)
            {
                //TODO: 记录PlayerID与ClientID的对应关系
                //TODO: 转发结果到逻辑服务器
            }
            else
            {
                LoginFailedPacket pkg = new LoginFailedPacket();

                GatewayGlobal.PlayerClientMgr[clientID].SendTcp(pkg);
            }

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            int clientID = packet.ReadInt();

            GatewayClient client = GatewayGlobal.Clients[clientID];

            LoginInfo info = new LoginInfo();

            info.PlayerID = packet.PlayerID;

            GatewayPlayer player = new GatewayPlayer(info, client);

            GatewayGlobal.Players.Add(packet.PlayerID, player);

            packet.Code2 = (int)BasePacketCode.None_Code;

            player.Client.LogicServer.SendTCP(packet);

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            int id = packet.ReadInt();

            if (GatewayGlobal.BattleServerMgr.Contains(id) ||
                GatewayGlobal.LogicConnectingMgr.Contains(id))
            {
                return 0;
            }

            string ip = packet.ReadUTF();

            int port = packet.ReadInt();

            LogicServerConnector conn = new LogicServerConnector(id);

            conn.Connect(ip, port);

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            connector.HandlePacket(packet.Code, packet);

            return 0;
        }
        public int HandlePacket(ServerConnector connector, GamePacket packet)
        {
            GatewayGlobal.Send2Center(packet, null);

            return 0;
        }