public PauseMenuUI() { uiPos = new PauseMenuUIPosition(); gameState = GameApp.GetInstance().GetGameState(); buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons"); gameuiMaterial = UIResourceMgr.GetInstance().GetMaterial("GameUI"); background = new UIImage(); background.SetTexture(gameuiMaterial, GameUITexturePosition.Dialog, AutoRect.AutoSize(GameUITexturePosition.DialogSize)); background.Rect = AutoRect.AutoPos(uiPos.Background); pauseLabel = new UITextImage(); pauseLabel.SetTexture(buttonsMaterial, ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label)); pauseLabel.Rect = AutoRect.AutoPos(uiPos.PauseLabel); pauseLabel.SetText(ConstData.FONT_NAME1, " PAUSE", ColorName.fontColor_orange); soundLabel = new UITextImage(); soundLabel.SetTexture(buttonsMaterial, ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label)); soundLabel.Rect = AutoRect.AutoPos(uiPos.SoundLabel); soundLabel.SetText(ConstData.FONT_NAME1, " SOUND", ColorName.fontColor_orange); resumeButton = new UITextButton(); resumeButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); resumeButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); resumeButton.Rect = AutoRect.AutoPos(uiPos.ResumeButton); resumeButton.SetText(ConstData.FONT_NAME1, " RESUME", ColorName.fontColor_orange); musicButtonOff = new UITextSelectButton(); musicButtonOff.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal)); musicButtonOff.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed)); musicButtonOff.Rect = AutoRect.AutoPos(uiPos.MusicButtonOff); musicButtonOff.SetText(ConstData.FONT_NAME1, " OFF", ColorName.fontColor_orange); musicButtonOn = new UITextSelectButton(); musicButtonOn.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal)); musicButtonOn.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed)); musicButtonOn.Rect = AutoRect.AutoPos(uiPos.MusicButtonOn); musicButtonOn.SetText(ConstData.FONT_NAME1, " ON", ColorName.fontColor_orange); if (gameState.MusicOn) { musicButtonOn.Set(true); musicButtonOff.Set(false); } else { musicButtonOn.Set(false); musicButtonOff.Set(true); } returnButton = new UITextButton(); returnButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); returnButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton); returnButton.SetText(ConstData.FONT_NAME1, " QUIT", ColorName.fontColor_orange); mask = new UIImage(); mask.SetTexture(gameuiMaterial, GameUITexturePosition.Mask, AutoRect.AutoSize(uiPos.Mask)); mask.Rect = AutoRect.AutoValuePos(uiPos.Mask); this.Add(mask); this.Add(background); //this.Add(pauseLabel); this.Add(soundLabel); this.Add(musicButtonOff); this.Add(musicButtonOn); this.Add(resumeButton); this.Add(returnButton); this.SetUIHandler(this); Hide(); }
// Use this for initialization public OptionsMenuUI() { uiPos = new OptionsMenuUIPosition(); texPos = new OptionsMenuTexturePosition(); gameState = GameApp.GetInstance().GetGameState(); buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons"); arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu"); background = new UIImage(); background.SetTexture(arenaMenuMaterial, ArenaMenuTexturePosition.Background, AutoRect.AutoSize(ArenaMenuTexturePosition.Background)); background.Rect = AutoRect.AutoPos(uiPos.Background); daysPanel = new UITextImage(); daysPanel.SetTexture(arenaMenuMaterial, ArenaMenuTexturePosition.Panel, AutoRect.AutoSize(ArenaMenuTexturePosition.Panel)); daysPanel.Rect = AutoRect.AutoPos(uiPos.DaysPanel); daysPanel.SetText(ConstData.FONT_NAME1, "DAY " + GameApp.GetInstance().GetGameState().LevelNum, ColorName.fontColor_darkorange); cashPanel = new CashPanel(); soundPanel = new UITextImage(); soundPanel.SetTexture(buttonsMaterial, ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label)); soundPanel.Rect = AutoRect.AutoPos(uiPos.SoundPanel); soundPanel.SetText(ConstData.FONT_NAME1, " SOUND", ColorName.fontColor_darkorange); musicButtonOff = new UITextSelectButton(); musicButtonOff.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal)); musicButtonOff.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed)); musicButtonOff.Rect = AutoRect.AutoPos(uiPos.MusicButtonOff); musicButtonOff.SetText(ConstData.FONT_NAME1, " OFF", ColorName.fontColor_orange); musicButtonOn = new UITextSelectButton(); musicButtonOn.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal)); musicButtonOn.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed)); musicButtonOn.Rect = AutoRect.AutoPos(uiPos.MusicButtonOn); musicButtonOn.SetText(ConstData.FONT_NAME1, " ON", ColorName.fontColor_orange); if (gameState.MusicOn) { musicButtonOn.Set(true); musicButtonOff.Set(false); } else { musicButtonOn.Set(false); musicButtonOff.Set(true); } creditsButton = new UITextButton(); creditsButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton)); creditsButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton)); creditsButton.Rect = AutoRect.AutoPos(uiPos.CreditsButton); creditsButton.SetText(ConstData.FONT_NAME1, " CREDITS", ColorName.fontColor_orange); shareButton = new UITextButton(); shareButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); shareButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); shareButton.Rect = AutoRect.AutoPos(uiPos.ShareButton); shareButton.SetText(ConstData.FONT_NAME1, " SHARE", ColorName.fontColor_darkorange); reviewButton = new UITextButton(); reviewButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); reviewButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); reviewButton.Rect = AutoRect.AutoPos(uiPos.ReviewButton); reviewButton.SetText(ConstData.FONT_NAME1, " REVIEW", ColorName.fontColor_darkorange); supportButton = new UITextButton(); supportButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); supportButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton)); supportButton.Rect = AutoRect.AutoPos(uiPos.SupportButton); supportButton.SetText(ConstData.FONT_NAME1, " SUPPORT", ColorName.fontColor_darkorange); returnButton = new UIClickButton(); returnButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial, ArenaMenuTexturePosition.ReturnButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonNormal)); returnButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial, ArenaMenuTexturePosition.ReturnButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonPressed)); returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton); creditsPanel = new CreditsMenuUI(); this.Add(background); this.Add(daysPanel); this.Add(cashPanel); this.Add(soundPanel); this.Add(musicButtonOff); this.Add(musicButtonOn); this.Add(creditsButton); this.Add(shareButton); this.Add(reviewButton); this.Add(supportButton); this.Add(returnButton); this.Add(creditsPanel); ui = MapUI.GetInstance(); this.SetUIHandler(this); }