protected async override void Initialize() { tcpClient.ConnectToServer(); await tcpClient.ReceiveResponseAsync(); state = "game"; InitialInfoPacket initialInfo = new InitialInfoPacket(tcpClient.LastResponse); snakeUser = new SnakeUser(initialInfo.id, initialInfo.snakes[initialInfo.id]); HEIGHT = initialInfo.height; WIDTH = initialInfo.width; CELLSIZE = initialInfo.cellSize; map = new Map(HEIGHT, WIDTH, CELLSIZE); for (int i = 0; i < initialInfo.snakeCount; i++) { map.AddSnake(new Snake(initialInfo.snakes[i], initialInfo.initialInvincibility)); } graphics.PreferredBackBufferHeight = map._height * map._cellSize; graphics.PreferredBackBufferWidth = map._width * map._cellSize; graphics.ApplyChanges(); _ = tcpClient.RunTaskAfterResponseLoopAsync(() => ResponseWrapper()); base.Initialize(); }