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 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(); }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == resumeButton) { Time.timeScale = 1; //AudioPlayer.PlayAudio(GameUIScript.GetGameUIScript().audio); //gameObject.SetActiveRecursively(false); Hide(); } 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; //AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().audio); } /* * else if (control == musicButton) * { * * if (gameState.MusicOn) * { * musicLogoButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, * * texPos.MusicOffLogoButtonNormal); * musicLogoButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, * * texPos.MusicOffLogoButtonPressed); * gameState.MusicOn = false; * } * else * { * musicLogoButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, * * texPos.MusicOnLogoButtonNormal); * musicLogoButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, * * texPos.MusicOnLogoButtonPressed); * gameState.MusicOn = true; * //AudioPlayer.PlayAudio(GameUIScript.GetGameUIScript().audio); * } * * } * else if (control == musicLogoButton) * { * * if (gameState.MusicOn) * { * musicLogoButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, * * texPos.MusicOffLogoButtonNormal); * musicLogoButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, * * texPos.MusicOffLogoButtonPressed); * gameState.MusicOn = false; * AudioListener.volume = 0; * * } * else * { * musicLogoButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, * * texPos.MusicOnLogoButtonNormal); * musicLogoButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, * * texPos.MusicOnLogoButtonPressed); * gameState.MusicOn = true; * //AudioPlayer.PlayAudio(GameUIScript.GetGameUIScript().audio); * AudioListener.volume = 100; * } * }*/ else if (control == returnButton) { GameApp.GetInstance().GetGameScene().PlayingState = PlayingState.GameQuit; Time.timeScale = 1; //AudioPlayer.PlayAudio(GameUIScript.GetGameUIScript().audio); UIResourceMgr.GetInstance().UnloadAllUIMaterials(); GameApp.GetInstance().Load(); Application.LoadLevel(SceneName.MAP); /* * Hide(); * ui.GetPanel(GameUIName.QUIT).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); }