public void ProcessAction(ActionBase action) { switch (action.GetActionType()) { case ActionType.BetAction: BetStage.ProcessBetAction((BetAction)action); if (BetStage.BetResult != null) { Log.Information(BetStage.BetResult.ToString()); ConfirmAction?.Invoke(); var playType = BetStage.BetResult.Bet.PlayType; PlayStage = new PlayStage(Rules, PlayerGroupInfo, ConfirmAction, PlayerHandDictionary, InitialPlayer, playType); ExpectedActionType = ActionType.PlayAction; } return; case ActionType.PlayAction: PlayStage.ProcessPlayAction((PlayAction)action); if (PlayStage.PlayResult != null) { Log.Information(PlayStage.PlayResult.ToString()); ConfirmAction?.Invoke(); RoundResult = GetRoundResult(); ExpectedActionType = ActionType.Invalid; } return; default: var msg = $"Invalid ActionType {action?.GetActionType()}!"; Log.Error(msg); throw new Exception(msg); } }
public void ProcessPlayAction(PlayAction playAction) { CurrentStickRound.ProcessPlayAction(playAction); if (CurrentStickRound.StickResult != null) { Log.Information(CurrentStickRound.StickResult.ToString()); ConfirmAction?.Invoke(); PlayResult = GetPlayResult(); if (PlayResult == null) { var currentPlayer = CurrentStickRound.StickResult.Winner; var stickRound = new StickRound(PlayerGroupInfo, PlayerHandDictionary, currentPlayer, PlayType); StickRoundList.Add(stickRound); } } return; }
public void ProcessAction(ActionBase action) { Log.Information(action.ToString()); CurrentGameRound.ProcessAction(action); if (CurrentGameRound.RoundResult != null) { Log.Information(CurrentGameRound.RoundResult.ToString()); ConfirmAction?.Invoke(); GameResult = GetGameResult(); if (GameResult == null) { CurrentPlayer = PlayerGroupInfo.GetNextPlayer(CurrentPlayer.PlayerId); var deck = CardPile.CreateDeckPile(); var gameRound = new GameRound(Rules, PlayerGroupInfo, ConfirmAction, CurrentPlayer, deck); GameRoundList.Add(gameRound); } else { Log.Information(GameResult.ToString()); } } }
private void Confirm_Click(object Sender, RoutedEventArgs E) { ConfirmAction?.Invoke(); }