Пример #1
0
        internal void UpdatePlayerState(HandAction action)
        {
            ActivePlayer.IsActive     = true;
            ActivePlayer.ActionString = Converter.ActionToString(action.HandActionType);
            ActivePlayer.OldBank      = ActivePlayer.Bank;
            ActivePlayer.OldAmount    = ActivePlayer.ActiveAmount;

            if (ActivePlayer.CurrentStreet != action.Street)
            {
                ActivePlayer.ActiveAmount = 0;
            }

            ActivePlayer.CurrentStreet = action.Street;

            if (IsWinAction(action))
            {
                ActivePlayer.IsWin        = true;
                ActivePlayer.ActiveAmount = action.Amount;
                ActivePlayer.Bank        += action.Amount;
            }
            else
            {
                ActivePlayer.ActiveAmount -= action.Amount;
                ActivePlayer.Bank         += action.Amount;
            }

            if (action.HandActionType == HandActionType.FOLD)
            {
                ActivePlayer.IsFinished = true;
            }
            else if (!string.IsNullOrWhiteSpace(ActivePlayer.ActionString) && action.HandActionType != HandActionType.CHECK)
            {
                ActivePlayer.ActionString += string.Format(" {0:C2}", Math.Abs(action.Amount));
            }
        }