private void SelectGameRoom(Client sender, String[] packetStrings) { //AddClientToGameRoom GameRoom gameRoom = GetGameRoomByName(packetStrings[1]); if (gameRoom != null) { AddClientToGameRoom(sender, gameRoom); } }
public void DestroyGameRoom(GameRoom GgameRoom) { for (int i = 0; i < gameRooms.Count; i++) { if (gameRooms[i] == GgameRoom) { gameRooms.Remove(GgameRoom); GgameRoom = null; } } }
private void CreateGameRoom(Client sender, String[] packetStrings) { if (GetGameRoomByName(packetStrings[1]) != null || packetStrings[1].Length <= 2) { sender.Send(PacketDatas.PACKET_ERROR + PacketDatas.PACKET_SPLIT + "There is already a gameroom with the same name or need more then 2 characters"); return; } GameRoom gameRoom = new GameRoom(sender, this, packetStrings[1]); gameRooms.Add(gameRoom); sender.Send(PacketDatas.PACKET_GAME_CREATE + PacketDatas.PACKET_SPLIT + "OK!"); UpdateGameRooms(); AddClientToGameRoom(sender, gameRoom); }
public Game(GameRoom gameRoom) : base() { this.gameRoom = gameRoom; }
private void AddClientToGameRoom(Client client, GameRoom gameRoom) { client.Send(PacketDatas.PACKET_GAME_SEL + PacketDatas.PACKET_SPLIT + "OK!"); gameRoom.AddClient(client); RemoveClient(client); }