コード例 #1
0
        private void AutoSelect(CardViewModel card)
        {
            Utils.WriteLine("Auto-selecting: {0}", card);

            if (card.Column == -1 && card.Row == -1)
            {
                Deal();
                ResetMoveAndRefresh();
                return;
            }

            Tableau.FromCard = card;
            int firstSpace = Tableau.FirstSpace;

            if (firstSpace == -1)
            {
                ResetMoveAndRefresh();
                return;
            }

            Tableau.ToCard = Tableau.Piles[firstSpace][0];
            if (Tableau.TryMove())
            {
                AddCheckPoint();
                ResetMoveAndRefresh();
                return;
            }

            ResetMoveAndRefresh();
        }
コード例 #2
0
        private void MoveSelect(CardViewModel card)
        {
            Utils.WriteLine("MoveSelecting: {0}", card);

            if (card == null)
            {
                ResetMoveAndRefresh();
                return;
            }

            if (Tableau.FromCard == null)
            {
                Tableau.FromCard = card;
                Refresh();
                return;
            }

            Tableau.ToCard = card;
            if (Tableau.FromCard.Column == Tableau.ToCard.Column)
            {
                ResetMoveAndRefresh();
                return;
            }

            if (Tableau.TryMove())
            {
                AddCheckPoint();
                ResetMoveAndRefresh();
                return;
            }

            ResetMoveAndRefresh();
        }
コード例 #3
0
        public bool TryMove()
        {
            Move move = new Move(FromCard.Column, FromCard.Row, ToCard.Column);

            return(Tableau.TryMove(move));
        }