public Response processSetRoomState(ClientMessage message) { Response response = new Response(); int gameID; Models.Game game; gameID = Int32.Parse(message.stringArguments[0]); game = onGoingGamesData.getGameByID(gameID); response.responseCommandToSockets = "SETROOMSTATE"; response.socketsToNotify = lobbyRoomData.lobbyRoomUsersToSocketList(); response.socketsToNotify.Remove(game.Player1Socket); response.socketsToNotify.Remove(game.Player2Socket); response.commandStringArgumentsToSockets.Add(gameID.ToString()); response.commandStringArgumentsToSockets.Add(message.stringArguments[1]); return(response); }
public Models.Response processReadyToStart(Models.ClientMessage message, Socket sender) { Models.Response response = new Models.Response(sender); Models.Game game; game = onGoingGamesData.getGameByID(Int32.Parse(message.stringArguments[0])); if (game.isPlayer1(sender)) { game.isP1Ready = true; } else { game.isP2Ready = true; } if (game.isP1Ready && game.isP2Ready) { response.responseCommandToSockets = "READYTOGO"; response.socketsToNotify.Add(game.Player1Socket); response.socketsToNotify.Add(game.Player2Socket); } return(response); }