public void OpenMenu(string name) { if (name == "QUIT") { Application.Quit(); return; } else if (name == "CLOSE") { activeMenu = null; return; } foreach (AbstractMenu menu in menus) { if (menu.GetType().Name == name) { activeMenu = menu; activeMenu.OnOpen(); return; } } Debug.LogError("Could not find menu with name '" + name + "'! Called from menu: " + activeMenu.name); }
public void Init(AbstractMenu controller, OptionComboTexture optionCombo) { base.Init(true, true); gameManager = GameManager.GetInstance(); this.controller = controller; this.optionCombo = optionCombo; }
private static IEnumerator FadeOnLevelLoadedCoroutine(Image blackFadeQuitEnter) { AbstractMenu.Unpause(); blackFadeQuitEnter.color = new Color(0.1372549f, 0.1215686f, 0.1254902f, 1); blackFadeQuitEnter.gameObject.SetActive(true); yield return(blackFadeQuitEnter.StartCoroutine(Fading(blackFadeQuitEnter, new Color(0, 0, 0, 0)))); blackFadeQuitEnter.gameObject.SetActive(false); }
public void Init(AbstractMenu controller, AbstractMenu parentMenu, OptionComboTexture optionCombo) { this.controller = controller; this.parentMenu = parentMenu; this.optionCombo = optionCombo; gameManager = GameManager.GetInstance(); //print("OptionsMenuType.Init -> Controler.Get"+ controller.menuIndex.Get()); base.Init(new LimitedIndex(parentMenu.menuIndex.Max())); }
public void Start() { instance = this; GameObject.DontDestroyOnLoad(gameObject); Application.runInBackground = true; if (menus != null && menus.Length > 0 && menus[0] != null) { activeMenu = menus[0]; foreach (AbstractMenu menu in menus) { menu.SetMenuManager(this); } } }
public override void Draw() { base.DrawContext(); if (currentAbility == Ability.AbilityId.NONE) { return; } if (!abilityMenu.abilities[currentAbility].saveInfo.obtained) { return; } GUI.DrawTexture(imageArea.GetRect(), abilityMenu.abilities[currentAbility].texture, ScaleMode.ScaleToFit); AbstractMenu.Label(textArea.GetRect(), abilityMenu.abilities[currentAbility].description.description, textArea.GetPercentSize() * 0.7f); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _backgroundP1 = new Background(spriteBatch, Player1Camera, BackgroundType.Overworld); _backgroundP2 = new Background(spriteBatch, Player2Camera, BackgroundType.Overworld); pauseMenu = new PauseMenu(this); gameOverScreen = new GameEndMenu(this); mainMenu = new MainMenu(this); GameContent.Load <Texture2D>("Sprites/ItemSpriteSheet"); GameContent.Load <Texture2D>("Sprites/FireFlower"); GameContent.Load <Texture2D>("Sprites/Coin"); GameContent.Load <Texture2D>("Sprites/SmallMario"); GameContent.Load <Texture2D>("Sprites/BigMario"); GameContent.Load <Texture2D>("Sprites/SuperMario"); GameContent.Load <Texture2D>("Sprites/AllBlocks"); GameContent.Load <Texture2D>("Sprites/Goomba"); GameContent.Load <Texture2D>("Sprites/GreenKoopa"); GameContent.Load <Texture2D>("Sprites/RedKoopa"); }
IEnumerator FadeOut(AbstractMenu _menuObject, float _speed, float delay) { yield return(new WaitForSeconds(delay)); float increment; CanvasGroup _canvasGroup = _menuObject.GetComponent <CanvasGroup>(); while (_canvasGroup.alpha > 0) { increment = _speed * m_menuDeltaTime; if (_canvasGroup.alpha - increment < 0) { _canvasGroup.alpha = 0; } else { _canvasGroup.alpha -= increment; } yield return(null); } _menuObject.Active(false); }
public void DisplayNewMenu(AbstractMenu menu, bool backAction = false) { DisplayMenu(false, backAction); menu.DisplayMenu(true, backAction); }
protected override void BeginRun() { level = new LevelCreator(@"Level\Sprint4MainLevel.bmp", gameGrid); level.Create(); AbstractGameObject.DrawHitbox = false; player1Controller.AddInputCommand((int)Keys.Y, new BecomeNormalMarioCommand(Player1)); player1Controller.AddInputCommand((int)Keys.U, new BecomeSuperMarioCommand(Player1)); player1Controller.AddInputCommand((int)Keys.I, new BecomeFireMarioCommand(Player1)); player1Controller.AddInputCommand((int)Keys.O, new BecomeDeadMarioCommand(Player1)); player1Controller.AddInputCommand((int)Keys.B, new FireBallCommand(Player1)); player1Controller.AddInputChord((int)Modifier.LeftShift, (int)Keys.B, new FireBallCommand(Player1)); //player1Controller.AddInputCommand((int)Keys.W, new JumpCommand(Player1)); player1Controller.AddHeldInputCommand((int)Keys.W, new JumpCommand(Player1)); player1Controller.AddInputChord((int)Modifier.LeftShift, (int)Keys.W, new JumpCommand(Player1)); //player1Controller.AddInputCommand((int)Keys.A, new MoveLeftCommand(Player1)); player1Controller.AddHeldInputCommand((int)Keys.A, new MoveLeftCommand(Player1)); player1Controller.AddInputChord((int)Modifier.LeftShift, (int)Keys.A, new MoveLeftCommand(Player1)); player1Controller.AddInputCommand((int)Keys.S, new CrouchCommand(Player1)); player1Controller.AddInputChord((int)Modifier.LeftShift, (int)Keys.S, new CrouchCommand(Player1)); //player1Controller.AddInputCommand((int)Keys.D, new MoveRightCommand(Player1)); player1Controller.AddHeldInputCommand((int)Keys.D, new MoveRightCommand(Player1)); player1Controller.AddInputChord((int)Modifier.LeftShift, (int)Keys.D, new MoveRightCommand(Player1)); player1Controller.AddInputCommand((int)Keys.Space, new DashCommand(Player1)); player1Controller.AddReleasedInputCommand((int)Keys.S, new ReleaseCrouchCommand(Player1)); player1Controller.AddReleasedInputCommand((int)Keys.A, new ReleaseMoveLeftCommand(Player1)); player1Controller.AddReleasedInputCommand((int)Keys.D, new ReleaseMoveRightCommand(Player1)); MapPlayer2Controller(); generalController.AddInputCommand((int)Keys.M, new MuteCommand(SoundPool.Instance)); generalController.AddInputChord((int)Modifier.LeftShift, (int)Keys.M, new MuteCommand(SoundPool.Instance)); generalController.AddInputCommand((int)Keys.Escape, new ExitCommand(this)); generalController.AddInputChord((int)Modifier.LeftShift, (int)Keys.Q, new ExitCommand(this)); generalController.AddInputCommand((int)Keys.C, new DisplayHitboxCommand()); generalController.AddInputChord((int)Modifier.LeftShift, (int)Keys.C, new DisplayHitboxCommand()); generalController.AddInputCommand((int)Keys.P, new PauseCommand(this)); generalController.AddInputChord((int)Modifier.LeftShift, (int)Keys.P, new PauseCommand(this)); EventManager.Instance.RaisePlayerWarpingEvent += PauseForWarp; EventManager.Instance.RaisePlayerDiedEvent += HandlePlayerDeath; EventManager.Instance.RaiseTimeRanOutEvent += HandleTimeIsOut; EventManager.Instance.RaisePlayerKilledBowserEvent += HandleBowserDefeated; EventManager.Instance.RaisePlayerHitPoleEvent += HandleFlagPoleHit; Player1Camera.Limits = level.LevelAreas[0]; if (Mode == GameMode.MultiPlayer) { Player2Camera.Limits = level.LevelAreas[0]; } if (Mode == GameMode.SinglePlayer) { Player2 = Player1; Player2Camera = Player1Camera; } player1CompletedMenu = new PlayerDoneScoreMenu(Player1); player2CompletedMenu = new PlayerDoneScoreMenu(Player2); }
public override void DrawElement(Rect rect, int elementIndex, bool isActive) { GUI.DrawTexture(buttonArea.GetRect(rect), ButtonManager.GetButtonTexture(descriptions[elementIndex].id), ScaleMode.ScaleToFit); AbstractMenu.Label(textArea.GetRect(rect), descriptions[elementIndex].text, textArea.GetPercentSize() * 0.7f); }