コード例 #1
0
ファイル: TurnActions.cs プロジェクト: ischyrus/coloretto_old
        /// <summary>
        /// Create a turns action by supplying a previous one and appending a new action
        /// </summary>
        /// <param name="original"></param>
        /// <param name="appendAction"></param>
        public TurnActions(TurnActions original, BaseAction appendAction, ActionResult appendResult)
        {
            _player = original.Player;
            _round = original.Round;
            _turn = original.Turn;
            _cycle = original.Cycle;

            _actions = Helpers.CloneAndAppend(original.Actions, appendAction);
            _results = Helpers.CloneAndAppend(original.Results, appendResult);
        }
コード例 #2
0
 protected override ActionResult Execute(ColorettoGame game)
 {
     try
     {
         ColorettoGame newGame = game.PlaceCardOnPile(_targetPile);
         ActionResult result = new ActionResult(this.Name, newGame, game.CurrentPlayer, newGame.Piles[_targetPile], true);
         return result;
     }
     catch (ArgumentException ex)
     {
         return new ActionResult(this.Name, game, game.CurrentPlayer, ex, false);
     }
     catch (InvalidOperationException ex)
     {
         return new ActionResult(this.Name, game, game.CurrentPlayer, ex, false);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
ファイル: TurnActions.cs プロジェクト: ischyrus/coloretto_old
 public TurnActions(ColorettoGame game, BaseAction action, ActionResult result)
     : this(game)
 {
     _actions = (new List<BaseAction> { action }).AsReadOnly();
     _results = (new List<ActionResult> { result }).AsReadOnly();
 }
コード例 #4
0
 protected override ActionResult Execute(ColorettoGame game)
 {
     ColorettoGame cloneGame = game.DrawCard();
     ActionResult result = new ActionResult(this.Name, cloneGame, game.CurrentPlayer, cloneGame.VisibleCard, cloneGame.VisibleCard != null);
     return result;
 }