public override void LoadContent() { base.LoadContent(); XmlManager<Menu> menuLoader = new XmlManager<Menu>(); currentMenu = menuLoader.Load(Path); currentMenu.LoadContent(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); currentMenu.Update(gameTime); if(InputManager.Instance.KeyPressed(Keys.Enter, Keys.Space) && !ScreenManager.Instance.ScreenChanged) { // Entscheidung was bei einzelnen Link Typen passiert. switch(currentMenu.MenuItems[currentMenu.CurrentItem].LinkType) { case MenuItem.MenuItemLinkType.Screen: ScreenManager.Instance.ChangeScreen(currentMenu.MenuItems[currentMenu.CurrentItem].LinkSource); break; case MenuItem.MenuItemLinkType.Menu: // Speichere das alte Menu ab. if(currentMenu.MenuItems[currentMenu.CurrentItem].LinkSource != String.Empty) { //currentMenu.MenuItems[currentMenu.CurrentItem].Image.ScalingEffect.FinishScaling(); lastMenus.Push(currentMenu); XmlManager<Menu> menuLoad = new XmlManager<Menu>(); currentMenu = menuLoad.Load(currentMenu.MenuItems[currentMenu.CurrentItem].LinkSource); currentMenu.LoadContent(); } else returnToLast(); break; case MenuItem.MenuItemLinkType.Quit: Game1.ExitGame = true; break; } } else if(InputManager.Instance.KeyPressed(Keys.Escape) && !ScreenManager.Instance.ScreenChanged) returnToLast(); }
/// <summary> /// Nimm das alte Menu aus dem Stack oder beendet dieses Memü, wenn nichts mehr im Stack ist. /// </summary> private void returnToLast() { currentMenu.UnloadContent(); if(lastMenus.Count == 0) ScreenManager.Instance.ChangeScreen(); else currentMenu = lastMenus.Pop(); }