本文整理汇总了C#中IStorageProvider.LoadGameState方法的典型用法代码示例。如果您正苦于以下问题:C# IStorageProvider.LoadGameState方法的具体用法?C# IStorageProvider.LoadGameState怎么用?C# IStorageProvider.LoadGameState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStorageProvider
的用法示例。
在下文中一共展示了IStorageProvider.LoadGameState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameViewModel
public GameViewModel(int totalQuestions, IImageProvider imageProvider, IStorageProvider storageProvider)
{
_imageProvider = imageProvider;
_storageProvider = storageProvider;
// register all the events
CommandEvents.ContinueButtonPressed += new EventHandler(ContinueButtonPressed);
CommandEvents.AnswerButtonPressed += new EventHandler(AnswerButtonPressed);
CommandEvents.HighScoreContinueButtonPressed += new EventHandler(HighScoreContinueButtonPressed);
DisplayHighScore += new EventHandler(DisplayScore);
// check to see whether any game state is already loaded
if (_storageProvider.GameStateExists())
{
_game = _storageProvider.LoadGameState();
// check if the player was in the middle of a question
if (_game.CurrentQuestion.Answered)
{
DisplayQuestion();
ContinueButtonPressed(this, new EventArgs());
}
else
{
DisplayQuestion();
}
}
else
{
_game = new Game(totalQuestions);
ContinueButtonPressed(this, new EventArgs());
}
}