Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public IList <int> GetValidActionIdList(string playerId)
        {
            switch (ExpectedActionType)
            {
            case ActionType.BetAction:
                return(BetStage.GetValidActionIdList(playerId));

            case ActionType.PlayAction:
                return(PlayStage.GetValidActionIdList(playerId));

            default:
                return(new List <int>());
            }
        }