public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == returnButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); Hide(); ArenaMenuUI ui = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>(); ui.GetPanel(MenuName.ARENA).Show(); GameApp.GetInstance().Save(); } if (control == avatarScroller && command == (int)UIImageScroller.Command.ScrollSelect) { currentSelectionIndex = (int)wparam; SetBuyButtonText(); ChangeAvatarModel(BUTTON_NUM - 1 - currentSelectionIndex); avatarInfoPanel.SetText(AvatarInfo.AVATAR_INFO[BUTTON_NUM - 1 - currentSelectionIndex]); UpdateCashPanel(); } if (control == buyButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); if (GameApp.GetInstance().GetGameState().GetAvatarData((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex)) == AvatarState.ToBuy) { GameConfig gConf = GameApp.GetInstance().GetGameConfig(); if (GameApp.GetInstance().GetGameState().BuyAvatar((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex), gConf.GetAvatarConfig(BUTTON_NUM - 1 - currentSelectionIndex).price)) { SetBuyButtonText(); } else { TopDialogUI.GetInstance().ShowDialog(); } UpdateAvatarIcon(); UpdateCashPanel(); } else if (GameApp.GetInstance().GetGameState().GetAvatarData((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex)) == AvatarState.Avaliable) { GameApp.GetInstance().GetGameState().Avatar = (AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex); } } else if (control == getMoreMoneyButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); Hide(); ShopUI shopUI = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>().GetPanel(MenuName.SHOP) as ShopUI; shopUI.SetFromPanel(this); shopUI.Show(); } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { for (int i = 0; i < BUTTON_NUM; i++) { if (control == itemButton[i] && !soldoutLogo[i].Visible) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); IAP.NowPurchaseProduct(itemList[0][i + page * 3].ID, "1"); iapProcessing = (IAPName)i + page * 3; Debug.Log("IAP ID:" + itemList[0][i + page * 3].ID); iapLockPanel.Show(); } } if (control == returnButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); Hide(); if (fromPanel != null) { fromPanel.Show(); } else { ArenaMenuUI ui = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>(); ui.GetPanel(MenuName.ARENA).Show(); } } else if (control == leftArrowButton) { if (page > 0) { page--; UpdateItemsUI(); } } else if (control == rightArrowButton) { if (page < 1) { page++; UpdateItemsUI(); } } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (BattlePressed) { return; } if (control == upgradeButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); //AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().audio); Hide(); ui.GetPanel(MenuName.UPGRADE).Show(); } else if (control == equipmentButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); Hide(); ui.GetPanel(MenuName.EQUIPMENT).Show(); } else if (control == battleButton) { BattlePressed = true; //GameObject.Find("Music").audio.Stop(); //GameObject.Destroy(GameObject.Find("Music")); //ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(0.3f); fadeTimer.Name = "Continue"; fadeTimer.SetTimer(0.3f, false); GameApp.GetInstance().Save(); } else if (control == avatarButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); Hide(); ui.GetPanel(MenuName.AVATAR).Show(); } else if (control == optionsButton) { //this.Hide(); //ui.GetPanel(MenuName.OPTIONS).Show(); //ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); } else if (control == returnButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "StartMenu"; fadeTimer.SetTimer(2f, false); } else if (control == leaderButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); GameCenterInterface.OpenLeaderboard(); /* * if (GameCenterInterface.IsLogin()) * { * GameCenterInterface.OpenLeaderboard(); * } * else * { * GameCenterInterface.Login(); * } */ } else if (control == achieveButton) { ArenaMenuUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); GameCenterInterface.OpenAchievement(); /* * if (GameCenterInterface.IsLogin()) * { * GameCenterInterface.OpenAchievement(); * } * else * { * GameCenterInterface.Login(); * } */ } }