public GameClient(int i, GameServerRunner s, ClientHandler h) { this.id = i; this.handler = h; this.server = s; this.handler.onPacket += this.handlePacketProxy; this.handler.onDisconnect += this.handleDisconnect; }
static void Main(string[] args) { TCPServer server = new TCPServer(9000); GameServerRunner gameClass = new GameServerRunner(server); //Starting to listen for TCL Clients... server.startServer(); Console.WriteLine("ENDED"); }
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); }