Exemple #1
0
        private void UndoButton_Click(object sender, RoutedEventArgs e)
        {
            if (MoveHistory.Count < 1)
            {
                return;
            }

            Untrack();

            Move lastMove = MoveHistory.Last();

            Cell target = BoardGrid.GetCellAt(lastMove.Target);

            target.Filled = false;
            Cell source = BoardGrid.GetCellAt(lastMove.Source);
            Cell middle = BoardGrid.GetMiddleCell(source, target);

            middle.Selected = false;
            middle.Filled   = true;
            source.Selected = false;
            source.Filled   = true;

            UndoHistory.Add(lastMove);
            MoveHistory.RemoveAt(MoveHistory.Count - 1);
        }
Exemple #2
0
        private void MakeMove()
        {
            SaveMove(SourceCell, TargetCell);

            Play("ms-appx:///Assets/Audio/short_pop_sound.mp3");
            TargetCell.Selected = false;
            TargetCell.Filled   = true;
            BoardGrid.GetMiddleCell(SourceCell, TargetCell).Filled = false;
            Untrack();
            CheckGameOver();
        }