X hits on this document

222 views

0 shares

0 downloads

0 comments

96 / 102

if (PhoneApplicationService.Current.State.ContainsKey("isHumanTurn"))

   {

isHumanTurn = (bool)PhoneApplicationService.Current.State["isHumanTurn"];

       PhoneApplicationService.Current.State.Remove("isHumanTurn");

   }

   else

       res = false;

   return res;

}

/// <summary>

/// Saves the current game state (if game is running) to Isolated Storage or State object

/// </summary>

/// <param name="isTombstoning"></param>

private void SaveActiveGameState(bool isTombstoning)

{

   // Try finding the running game instance

   var res = from screen in screenManager.GetScreens()

               where screen.GetType() == typeof(GameplayScreen)

               select screen;

   GameplayScreen gameplayScreen = res.FirstOrDefault() as GameplayScreen;

   if (null != gameplayScreen)

   {

       if (isTombstoning)

       {

           SaveToStateObject(gameplayScreen);

       }

       else

       {

           SaveToIsolatedStorageFile(gameplayScreen, fileName);

       }

   }

}

/// <summary>

/// Saves the gameplay screen data to Isolated storage file

/// </summary>

/// <param name="gameplayScreen"></param>

/// <param name="fileName"></param>

private void SaveToIsolatedStorageFile(GameplayScreen gameplayScreen, string fileName)

Page | 96

Document info
Document views222
Page views222
Page last viewedSat Dec 03 18:24:11 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments