예제 #1
0
        public void RedoTurn()
        {
            var lastTurn = _undoneTurns.Last();

            MineField.RestoreFromSnapshot(lastTurn.MineFieldSnapshot);
            AddTurn(lastTurn.MineFieldSnapshot, lastTurn.PlayerTurnSnapshot, lastTurn.Description, lastTurn.Time);
            _undoneTurns.RemoveAt(_undoneTurns.Count - 1);
        }
예제 #2
0
        public void UndoTurn(int turnId)
        {
            var turn = _playerTurns[turnId];

            MineField.RestoreFromSnapshot(turn.MineFieldSnapshot);
            if (turn.GameState != GameStateManager.CurrentState)
            {
                GameStateManager.CurrentState = turn.GameState;
            }
            _undoneTurns.Add(turn);
            _playerTurns.RemoveAt(turnId);
        }
예제 #3
0
        public static MineField CreateFromSnapshot(MineFieldSnapshot snapshot)
        {
            var mineField = new MineField(
                snapshot.Width,
                snapshot.Height,
                snapshot.TotalMines,
                snapshot.IsResolvable,
                snapshot.MinePutterDifficulty
                );

            mineField.RestoreFromSnapshot(snapshot);

            return(mineField);
        }