public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == returnButton || control == okButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); //gameObject.SetActiveRecursively(false); this.Hide(); //if (ui != null) { MapUI.GetInstance().GetOptionsMenuUI().Show(); } } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == musicButtonOff) { musicButtonOn.Set(false); AudioListener.volume = 0; gameState.MusicOn = false; } else if (control == musicButtonOn) { musicButtonOff.Set(false); AudioListener.volume = 100; gameState.MusicOn = true; MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); } else if (control == creditsButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); creditsPanel.Show(); } else if (control == returnButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); this.Hide(); ui.GetMapUI().Show(); } else if (control == shareButton) { string htm = GameApp.GetInstance().GetResourceConfig().shareHtm.text; Utils.ToSendMail("", "Call Of Mini: Zombies", htm); } else if (control == reviewButton) { Application.OpenURL("http://www.trinitigame.com/callofminizombies/review/"); } else if (control == supportButton) { Utils.ToSendMail("*****@*****.**", "Call Of Mini: Zombies", ""); } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (buttonPressed) { return; } if (control == mapButtons[0]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "0"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[1]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "1"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[2]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "2"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[3]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "3"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == shopButton) { FadeAnimationScript.GetInstance().FadeInBlack(0.5f); fadeTimer.Name = "shop"; fadeTimer.SetTimer(0.5f, false); buttonPressed = true; } else if (control == returnButton) { FadeAnimationScript.GetInstance().FadeInBlack(1); fadeTimer.Name = "return"; fadeTimer.SetTimer(1f, false); buttonPressed = true; } else if (control == optionsButton) { this.Hide(); MapUI.GetInstance().GetOptionsMenuUI().Show(); } }
// 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); }