public override void Update(GameTime gameTime) { if(loading == true) //First initial call, load must not happen; Splash screen should be displayed first { switch (loadtype) { case global_vars.loadType.Campaign: Campaign c = loadCampaign(); this.Dispose(true); game.Components.Add(c); break; case global_vars.loadType.Main: Main_Menu m = new Main_Menu(variables, game); this.Dispose(true); game.Components.Add(m);break; case global_vars.loadType.Upgrade: Upgrade u = loadUpgrade(); this.Dispose(true); game.Components.Add(u); break; case global_vars.loadType.Credits: Credits cr = loadCredits(); this.Dispose(true); game.Components.Add(cr);break; default : Campaign ca = loadCampaign(); this.Dispose(true); game.Components.Add(ca);break; } } loading = true; //Allow for next cycle to load base.Update(gameTime); }
public Main_Menu(global_vars vars, Game1 game) : base(game) { this.game = game; thisMain = this; selection_delay = vars.MENU_DELAY; current_delay = selection_delay; variables = vars; optionselected = option.campaign; deviceSelected = false; }
public static void handleMenuCommands(Main_Menu main) { keypressed = Keyboard.GetState(); if (keypressed.IsKeyDown(Keys.Down)) main.NextOption(); else if (keypressed.IsKeyDown(Keys.Up)) main.PreviousOption(); else if (keypressed.IsKeyDown(Keys.Enter)) main.SelectOption(); }