//================== Music Settings Bars =====================// public PopUp(Game game, ScreenManager screenManager, Bubble player, SpectrumEnums.popUpId style = SpectrumEnums.popUpId.custom, string headline = "", string text = "") { this.position = new Vector2(game.Window.ClientBounds.Width / 2f, game.Window.ClientBounds.Height / 2f); this.game = game; this.texManager = ((Spectrum)game).texManager; this.screenManager = screenManager; this.player = player; this.headlineFont = screenManager.modelManager.getHeadlineFont(); this.textFont = screenManager.modelManager.getTextFont(); this.buttonHandler = screenManager.modelManager.buttonHandler; popUpTexture = texManager.getUITexture(style); currentStyle = style; switch (style) { case SpectrumEnums.popUpId.custom: this.headline = headline; this.text = text; break; case SpectrumEnums.popUpId.win: this.headline = "Congratulations!"; this.text = "You beat the level! \n You can go on with the next level \nor play again."; break; case SpectrumEnums.popUpId.lose: this.headline = "Game over"; this.text = "You lose, try again!"; break; } origin = new Vector2(popUpTexture.Width / 2f, popUpTexture.Height / 2f); center = new Vector2(position.X + recPosition.Width / 2f, position.Y + recPosition.Height / 2f); recPosition = new Rectangle((int)position.X - (int)origin.X, (int)position.Y - (int)origin.Y, popUpTexture.Width, popUpTexture.Height); setButtons(); }
/* * Checks if we need to Display a popUp because of winning/losing * and sets what PopUp needs to be drawn */ protected bool checkForPopUps() { // check if we need to popUp the you win screen if (player.isOnGoal) { if (levelPassed()) { currentPopUpId = SpectrumEnums.popUpId.win; return true; // maybe gamestate change } else { if (!hasBeenDisplayed) { currentPopUpId = SpectrumEnums.popUpId.custom; hasBeenDisplayed = true; return true; } // collect all the ink popUp } } // check if we need to popUp the you lose screen if (player.getLives() <= 0) { currentPopUpId = SpectrumEnums.popUpId.lose; return true; } return false; }