public static void back(InputHandlerComponent i, SystemType system, Stack <string> stack) { if (i.getButton("Back", true) && system != null) { stack.Pop(); } }
public void back(SystemType system) { MenuFunctions.back(input, system, menuStack); if (menuStack.Count == 0) { Exit(this, new EventArgs()); } }
public override void Update(GameTime gameTime) { //If the transition manager is running any transactions, do not update the menus. if (transitionManager.HasTransitions) { //Update any transitions. transitionManager.update(); } //Else get the current menu and update it. else { MenuType currentMenu = getMenu(Stack.Peek()); //Force the input to update. input.Update(gameTime); //If there is a registered menu, update that menu. if (currentMenu != null) { currentMenu.update(input); } //Else check to see if any systems are registered. else { SystemType system = getSystem(Stack.Peek()); //If there is a system, update it. if (system != null) { back(system); system.update(input); } } } base.Update(gameTime); }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); //If there are transitions running, do not draw any menus. if (transitionManager.HasTransitions) { //Draw any transitions. transitionManager.draw(spriteBatch); } //Else draw the current menu. else { MenuType currentMenu = getMenu(Stack.Peek()); //If there is a menu registered, draw it. if (currentMenu != null) { currentMenu.draw(spriteBatch); } //Else check to see if there are any systems registered. else { SystemType system = getSystem(Stack.Peek()); //If there is a system, draw it. if (system != null) { system.draw(spriteBatch); } } } spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// This function registers a menu system with the component, allowing it and its menus to be called upon at /// any time /// </summary> /// <param name="system">the system to be registered</param> public void addSystem(SystemType system) { systems.Add(system.state, system); }