private void ThrowDiceMethod(ThrowDice message) { if (GameStatus.IsGameFinished) { var messageAnswer = new EnteringNewUserError(false, false, true, false, false); Context.Parent.Tell(messageAnswer); } else /// thow an error if (GameStatus.GamePlayPerPlayer.Count <= 1) { var messageAnswer = new EnteringNewUserError(false, false, false, true, false); Context.Parent.Tell(messageAnswer); } else { var result = GameStatus.ThrowDice(message.PlayerInfo.Id); if (result == GameStatusThrowResult.NotPlayerTurn) { var messageAnswer = new EnteringNewUserError(false, false, false, false, false, true); Context.Parent.Tell(messageAnswer); } else if (result == GameStatusThrowResult.ThrowExecuted || result == GameStatusThrowResult.ThrowWithVictory) { Context.Parent.Tell(new GameRegister(GameStatus)); } } }
private void FinishGameMethod(FinishGame message) { if (GameStatus.GamePlayPerPlayer.ContainsKey(message.PlayerInfo.Id)) { GameStatus.GamePlayPerPlayer.Remove(message.PlayerInfo.Id); Context.Parent.Tell(new GameRegister(GameStatus)); } else { var messageAnswer = new EnteringNewUserError(false, false, false, false, true); Context.Parent.Tell(messageAnswer); } }