Exemple #1
0
 private void SetupGame()
 {
     _gameState = new MancalaGameState
     {
         GameIsPlayable   = true,
         IsPlayer1Turn    = true,
         Player1          = CreatePlayer("Player1"),
         Player2          = CreatePlayer("Player2"),
         HasGameBeenSetup = true
     };
     _feedbackMessages.Add("Welcome to Mancala!");
 }
Exemple #2
0
 private void LoadGame()
 {
     if (File.Exists(saveFileName))
     {
         var fileText = File.ReadAllText(saveFileName);
         _gameState = JsonSerializer.Deserialize <MancalaGameState>(fileText);
         if (_gameState.HasGameBeenSetup && !_gameState.GameIsPlayable)
         {
             _gameState = null;
         }
     }
 }