public void Client2Connect(GameClient c2) { this.client2 = c2; this.client1.onPacket += this.PacketListener; this.client2.onPacket += this.PacketListener; c2.Send(new ConnectAckPacket(1, c2.Id, this.roomId)); this.emitGameBegin(); Console.WriteLine("Game Room " + this.roomId + " begins Game!"); c2.setIngame(this.roomId); }
public GameRoom(GameServerRunner server, int roomId, GameClient c1) { this.server = server; for (int x = 0; x < 7; x++) { for (int y = 0; y < 6; y++) { fieldState[x, y] = 0; } } this.client1 = c1; this.roomId = roomId; c1.RoomId = roomId; Console.WriteLine("New Gameroom Created! Player 1: " + c1.Name); //Room Sends Connect Ack c1.Send(new ConnectAckPacket(0, c1.Id, roomId)); this.client2 = null; this.state = RoomStates.WAITING; c1.setIngame(this.roomId); }