private void InitializeGame(SlideCategories cat) { startMenuDataContext.SelectedCategory = (int)cat; startMenuDataContext.PlayCommand.Execute(startMenuDataContext.CanPlay); currDataContext = mainWindow.DataContext; gameDataContext = currDataContext as GameViewModel; }
private void SetupGame(SlideCategories category) { Slides = new SlideCollectionViewModel(); Timer = new TimerViewModel(new TimeSpan(0, 0, 1)); GameInfo = new GameInfoViewModel(); GameInfo.ClearInfo(); Slides.CreateSlides("Assets/" + category.ToString()); Slides.Memorize(); Timer.Start(); OnPropertyChanged("Slides"); OnPropertyChanged("Timer"); OnPropertyChanged("GameInfo"); }
//Initialize game essentials private void SetupGame(SlideCategories category) { Slides = new SlideCollectionViewModel(); Timer = new TimerViewModel(new TimeSpan(0, 0, 1)); GameInfo = new GameInfoViewModel(); //Set attempts to the maximum allowed GameInfo.ClearInfo(); //Create slides from image folder then display to be memorized Slides.CreateSlides("Assets/" + category.ToString()); Slides.Memorize(); //Game has started, begin count. Timer.Start(); //Slides have been updated OnPropertyChanged("Slides"); OnPropertyChanged("Timer"); OnPropertyChanged("GameInfo"); }
public void InitializeGame(SlideCategories cat) { startMenuDataContext.SelectedCategory = (int)cat; startMenuDataContext.PlayCommand.Execute(startMenuDataContext.CanPlay); currDataContext = mainWindow.DataContext; gameDataContext = currDataContext as GameViewModel; GameInfoViewModel info = gameDataContext.GameInfo; //Make sure the correct category is chosen Assert.AreEqual(gameDataContext.Category, (SlideCategories)startMenuDataContext.SelectedCategory, "Expected category not selected."); //Make sure the Timer is created and set to 0 sec Assert.AreEqual(gameDataContext.Timer.Time.Seconds, 0); //Make sure the GameInfo context is set up correctly Assert.IsTrue(CheckType(info, typeof(GameInfoViewModel))); //Make sure you have themax match attempts Assert.AreEqual(info.MatchAttempts, 4); //Make sure the score is set to 0 Assert.AreEqual(info.Score, 0); //Make sure win and lost message are hidden Assert.AreEqual(info.WinMessage, Visibility.Hidden); Assert.AreEqual(info.LostMessage, Visibility.Hidden); }
//Initialize game essentials private void SetupGame(SlideCategories category) { Slides = new SlideCollectionViewModel(); Timer = new TimerViewModel(new TimeSpan(0, 0, 1)); GameInfo = new GameInfoViewModel(); string assetFolder = new ResourceManager().GetAssetsFolder(category.ToString()); //Set attempts to the maximum allowed GameInfo.ResetInfo(); //Create slides from image folder then display them Slides.CreateSlides(assetFolder); Slides.InitialPeek(); //Game has started, begin count. Timer.Start(); //Slides have been updated OnPropertyChanged("Slides"); OnPropertyChanged("Timer"); OnPropertyChanged("GameInfo"); }
public GameViewModel(SlideCategories category) { Category = category; SetupGame(category); }
public void PlayGame(SlideCategories cat) { InitializeGame(cat); }