private bool VerifyExitGame(Command c, ExitGameResult result) { if (c.action != ActionType.ExitGame.ToString()) { return(false); } ResponseExitGame response = JsonConvert.DeserializeObject <ResponseExitGame>(c.payload); return(response.result == result); }
private void PlayerExitGame(IHanabiPlayer player, RequestExitGame request) { ExitGameResult result = ExitGameResult.Success; if (Players.ContainsKey(player.Nickname)) { player.OnExitGame(); result = ExitGameResult.Success; } ResponseExitGame response = new ResponseExitGame(result); SendCommand(player, ActionType.ExitGame, response); }
private void PlayerEnterGame(IHanabiPlayer player, RequestEnterGame request) { ExitGameResult result = ExitGameResult.Fail; NicknameType nickname = new NicknameType(request.Nickname); if (!Players.ContainsKey(nickname)) { result = ExitGameResult.Success; player.OnEnterGame(nickname); Players.Add(player.Nickname, player); } ResponseEnterGame response = new ResponseEnterGame(result); SendCommand(player, ActionType.EnterGame, response); }
public ResponseExitGame(ExitGameResult result) { this.Result = result; }