public int HandlePacket(ClientBase client, GamePacket packet) { int clientID = packet.ReadInt(); string account = packet.ReadUTF(); string nickName = packet.ReadUTF(); int playerID = 0; using (PlayerBussiness pb = new PlayerBussiness()) { playerID = pb.Registe(account, nickName); } if (playerID != 0) { ValidateLoginHandler.SendLoginPacket(client, clientID, account, playerID); } else { //TODO: 发送创建角色失败给客户端 RegisteResultPacket pkg = new RegisteResultPacket(); pkg.ClientID = clientID; client.SendTcp(pkg); } return 0; }
public void SendToAllServer(GamePacket pkg) { foreach (ServerConnector connector in m_servers) { connector.SendTCP(pkg); } }
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; }
/// <summary> /// 复制一个数据包,使用同一个字节流. /// </summary> /// <returns></returns> public GamePacket Clone() { GamePacket packet = new GamePacket(Buffer, Endian); packet.ReadHeader(); return packet; }
public int HandlePacket(ClientBase client, GamePacket packet) { bool logined = packet.ReadBoolean(); uint clientID = packet.ReadUnsignedInt(); return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { if (packet.Code > 1000) { client.HandlePacket(packet.Code, packet); } return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { int gatewayID = packet.ReadInt(); int clientID = packet.ReadInt(); ConnectOtherGatewayServer(client, gatewayID, clientID); return 0; }
//public override void HandlePacket(GamePacket packet) //{ // if (packet != null && packet.Code2 != 0 && packet.Code <= 1000) // { // return; // } // base.HandlePacket(packet); //} public override void HandlePacket(int code, GamePacket packet) { if (packet != null && packet.Code2 != 0 && packet.Code <= 1000) { return; } base.HandlePacket(code, packet); }
public virtual void HandlePacket(GamePacket packet) { if (packet == null) { log.Error("Packet is null!"); return; } HandlePacketImp(packet.Code, packet); }
/// <summary> /// 复制一个数据包,使用同一个字节流. /// </summary> /// <returns></returns> public GamePacket Clone() { GamePacket packet = new GamePacket(); packet.CopyFrom(Buffer, 0, 0, Length); packet.ReadHeader(); return packet; }
public int HandlePacket(ClientBase client, GamePacket packet) { uint gatewayID = packet.ReadUnsignedInt(); GatewayInfo info = GameGlobal.GatewayMgr.FindTemplate(gatewayID); info.Fulled = false; return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { uint clientID = packet.ReadUnsignedInt(); string account = packet.ReadUTF(); //TODO: 从数据库验证帐号,成功时记录到CacheGlobal中的LoginPlayerMgr和CachePlayerMgr中. return 0; }
public int HandlePacket(ServerConnector connector, GamePacket packet) { GatewayPlayer player = GatewayGlobal.Players[packet.PlayerID]; if (player != null) { player.SendTcp(packet); } return 0; }
public void SendTcp(GamePacket pkg) { if (pkg == null) return; if (pkg.PlayerID == 0) { pkg.PlayerID = PlayerID; } Client.SendTcp(pkg); }
public int HandlePacket(ClientBase client, GamePacket packet) { Player player = CacheGlobal.CachePlayerMgr.Remove(packet.PlayerID); if (player != null) { CacheGlobal.LoginPlayerMgr.RemovePlayer(player); } 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) { if (GatewayGlobal.CacheServer != null && GatewayGlobal.CacheServer.Socket.Connected) { GatewayGlobal.CacheServer.SendTCP(packet); } else { //TODO: 通知客户端没有可用缓存服务器 } 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) { int clientID = packet.ReadInt(); GatewayClient client = GatewayGlobal.Clients[clientID]; if (client != null) { client.SendTcp(packet); } return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { int clientID = packet.ReadInt(); CenterPlayer player = CenterGlobal.PlayerMgr[packet.PlayerID]; if (player != null && player.Client == client && player.ClientID == clientID) { CenterGlobal.PlayerMgr.Remove(player.PlayerID); } return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { string account = packet.ReadUTF(); ValidateLoginPacket pkg = new ValidateLoginPacket(); pkg.ClientID = ((GatewayClient)client).ClientID; pkg.Account = account; GatewayGlobal.Send2CacheServer(pkg); 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(ClientBase client, GamePacket packet) { uint gatewayID = packet.ReadUnsignedInt(); uint clientID = packet.ReadUnsignedInt(); GatewayInfo info = GameGlobal.GatewayMgr.FindTemplate(gatewayID); info.Fulled = true; ConnectOtherGatewayHandler.ConnectOtherGatewayServer(client, gatewayID, clientID); return 0; }
protected override void ReceivePacket(GamePacket packet) { if (packet.Code2 == 0) { if (GatewayGlobal.PlayerLoginMgr[packet.PlayerID] != null) { GatewayGlobal.PlayerLoginMgr[packet.PlayerID].SendTcp(packet); } } else { base.ReceivePacket(packet); } }
public int HandlePacket(ClientBase client, GamePacket packet) { CenterPlayer player = CenterGlobal.PlayerMgr[packet.PlayerID]; if (player != null) { ValidateLoginPacket pkg = new ValidateLoginPacket(); pkg.PlayerID = player.PlayerID; pkg.ClientID = player.ClientID; player.SendTcp(pkg); } return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { int clientID = packet.ReadInt(); GamePlayer player = GameGlobal.PlayerMgr[packet.PlayerID]; if (player != null && player.Client == client && player.ClientID == clientID) { player.SaveToDatabase(); GameGlobal.PlayerMgr.Remove(packet.PlayerID); } return 0; }
public int HandlePacket(ClientBase client, GamePacket packet) { if (packet == null || packet.Code <= 1000) { return 0; } GatewayPlayer c = GatewayGlobal.PlayerLoginMgr[packet.PlayerID]; if (c != null && c.LogicServer != null) { c.LogicServer.SendTCP(packet); } 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 virtual void HandlePacket(GamePacket packet) { if (packet == null) { log.Error("Packet is null!"); return; } if (packet.Code2 == 0) { HandlePacket(packet.Code, packet); } else { HandlePacket(packet.Code2, packet); } }