private void SaveGameOpen(object sender, EventArgs e) { _viewmodel.SelectedGame = null; _viewmodel.NewName = String.Empty; _model.IsPaused = true; _savewindow = new SaveGameWindow(); _savewindow.DataContext = _viewmodel; _savewindow.ShowDialog(); }
public void CloseMenu(Menus menu) { switch (menu) { case Menus.MainMenu: MainMenu.Close(); CurrentMenu = null; break; case Menus.NewGameMenu: NewGameMenu.Close(); CurrentMenu = null; break; case Menus.GameInfoMenu: GameInfoMenu.Close(); break; case Menus.AdvancedSettingsMenu: AdvancedSettingsMenu.Close(); break; case Menus.HighscoresMenu: HighscoresMenu.Close(); CurrentMenu = null; break; case Menus.LoadGameMenu: LoadGameMenu.Close(); CurrentMenu = null; break; case Menus.ConfirmStepWindow: ConfirmStepWindow.Close(); break; case Menus.PlayAgainWindow: PlayAgainWindow.Close(); break; case Menus.PauseWindow: PauseWindow.Close(); CurrentMenu = null; break; case Menus.SaveGameWindow: SaveGameWindow.Close(); CurrentMenu = null; break; case Menus.LoadGameWindow: LoadGameWindow.Close(); CurrentMenu = null; break; } }
IEnumerable <Item> GetMenuItems() { // Quit var Item = new Item(GlblRes.Quit); Item.OnClick = () => { if (GameRunning) { ExitConfirmationWindow.ShowModal(); ShowLogo(false); ExitConfirmationWindow.Focused = true; } else { Engine.Exit(); } }; yield return(Item); // Credits Item = new Item(GlblRes.Credits); Item.OnClick = () => { CreditsWindow.Show(); ShowLogo(false); CreditsWindow.Focused = true; }; yield return(Item); // Settings Item = new Item(GlblRes.Settings); Item.OnClick = () => { SettingsWindow.ShowModal(); ShowLogo(false); SettingsWindow.Focused = true; }; yield return(Item); // Load Item = new Item(GlblRes.Load); Item.IsVisible = () => { return(SaveGames.Count > 0); }; Item.OnClick = () => { LoadGameWindow.ShowModal(); ShowLogo(false); LoadGameListbox.Focused = true; }; yield return(Item); // Save Item = new Item(GlblRes.Save); Item.IsVisible = () => { return(GameRunning); }; Item.OnClick = () => { ShowLogo(false); SaveGameWindow.ShowModal(); }; yield return(Item); // Continue Item = new Item(GlblRes.Continue); Item.OnClick = () => { ContinueGame(); }; Item.IsVisible = () => { return(GameRunning); }; yield return(Item); // New Game Item = new Item(GlblRes.New_Game); Item.OnClick = () => { MainMenuBackground.Hide(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; Engine.StartGame(); }; yield return(Item); }