コード例 #1
0
        /// <summary>
        /// Implementing loading of the game.
        /// </summary>
        public void LoadGame()
        {
            SaveLoadManager game = this.gameStateInfoManager.Read();

            if (game == null)
            {
                throw new ArgumentNullException("Saved state cannot be null");
            }

            this.GameState = game.GameState;

            this.printer.PrintLine("Game successfully loaded!");
        }
コード例 #2
0
        /// <summary>
        /// Loads the game from the saved state.
        /// </summary>
        /// <param name="gameState">Represents the saved state.</param>
        public void Load(Memento gameState)
        {
            if (gameState == null)
            {
                throw new ArgumentNullException("Error: Loaded memento cannot be null!");
            }

            this.Word = gameState.Word;
            this.CurrentMistakes = gameState.CurrentMistakes;
            this.HasCheated = gameState.HasCheated;
            this.IsGameRunning = gameState.IsGameRunning;
        }