public void OnPressed() { SoundMgr.G.EffectPlay(System.EffectSound.btn_ok); if (popup == null) { oldDepth = uiSettingPanel.depth; uiSettingPanel.depth = 5; ActiveBlack(true); popup = PopupInGameSetting.Open("In Game Setting"); popup.onQuit += () => { PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/ExitGamePopup", "Exit Popup", null, null, "QUIT"); temp.onConfirm += () => { temp.Close(); GameMgr.G.Failed(); }; uiSettingPanel.depth = oldDepth; ActiveBlack(false); }; } else { popup.OnExit(); uiSettingPanel.depth = oldDepth; ActiveBlack(false); } }
public void ShowItemPopup(string id, string title, string message, string btn, BoosterType type, int itemCount, int cost, Action actConfirm = null) { PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/ItemPopup", id, title, message, btn, false); PopupItem popupItem = temp.GetComponent <PopupItem>(); if (popupItem != null) { popupItem.ItemSetting(type, itemCount, cost); } temp.onConfirm += () => { if (actConfirm != null) { actConfirm(); actConfirm = null; } temp.SetMessage("Purchase completed!"); if (popupItem != null) { popupItem.UpdateData(false); } temp.onConfirm += () => { temp.Close(); }; }; }
public void ShowAdsPopup(string title, string message, string btn, Action actConfirm = null, Action actEixt = null) { PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/ADPopup", "AD", title, message + "\n" + "(After 10 ads, 200 coins will be paid.)", btn); temp.GetComponent <PopupAD>().SetInfo(); temp.onConfirm += () => { if (actConfirm != null) { actConfirm(); actConfirm = null; } temp.Close(); AdsMgr.G.ShowRewardedAd(); }; temp.onExit += () => { if (actEixt != null) { actEixt(); actEixt = null; } temp.Close(); }; }
public void OnPressed() { SoundMgr.G.EffectPlay(EffectSound.btn_ok); if (UserDataMgr.G.life <= 0) { int count = 1; if (UserDataMgr.G.IsItemCoins(count)) { PopupMgr.G.ShowItemPopup("Life Item Popup", "LIFE", "You can play the game with life!", "BUY", "life_icon", count, GameDataMgr.G.itemCost, () => { UserDataMgr.G.CoinsUsed(GameDataMgr.G.itemCost * count); UserDataMgr.G.life += count; UserDataMgr.G.SetTimeToNextLife(); if (LobbyMgr.G != null && LobbyMgr.G.levelNumber != null) { LobbyMgr.G.levelNumber.UpdateLifeLabel(); LobbyMgr.G.levelNumber.UpdateCoin(); } }); } else { PopupMgr.G.ShowAdsPopup(null, "Not enough coins and life." + "\n" + "Watch ads and get rewarded.", "OK"); } return; } string level = string.Format("LEVEL {0}", GameDataMgr.G.endLevel.ToString()); PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/GamePopup", "StartPopup", level, null, "PLAY"); temp.GetComponent <GamePopup>().OnPopup(GamePopupState.start); GamePopupItemGroup item = temp.GetComponentInChildren <GamePopupItemGroup>(); if (item != null) { item.BoosterItemSetting(); item.gameObject.GetComponent <UIWidget>().bottomAnchor.absolute = 50; } temp.onConfirm += () => { SceneFadeInOut fade = gameObject.GetComponentInParent <SceneFadeInOut>(); fade.delayTime = 0.15f; fade.fadeTime = 0.3f; fade.OnPressed(); }; }
static public PopupConfirm Open(string path, string ID, string title, string message, string btn) { PopupConfirm temp = Popup.Create <PopupConfirm>(path, ID); if (title != null && temp.uiTitle != null) { temp.uiTitle.text = title /*DataMgr.G.GetIndexUIText(204)*/; } if (message != null && temp.uiMessage != null) { temp.uiMessage.text = message /*DataMgr.G.GetIndexUIText(204)*/; } if (temp.uiBtn != null) { temp.uiBtn.text = btn /*DataMgr.G.GetIndexUIText(204)*/; } return(temp); }
public void OnPressed() { if (isLock) { return; } if (itemCount > 0) { int idx = (int)(type - 1); if (!GameDataMgr.G.isUseStartItem[idx]) { GameDataMgr.G.isUseStartItem[idx] = true; --UserDataMgr.G.availableStartItemCount[idx]; uiBtnImg.normalSprite = "BlueSquareButton"; CheckImg.SetActive(true); uiItemCnt.gameObject.SetActive(false); } else { GameDataMgr.G.isUseStartItem[idx] = false; ++UserDataMgr.G.availableStartItemCount[idx]; uiBtnImg.normalSprite = "green_square_button"; CheckImg.SetActive(false); uiItemCnt.gameObject.SetActive(true); } } else { TextInfo myTI = new CultureInfo("en-US", false).TextInfo; string boosterName = myTI.ToTitleCase(type.ToString()); string msg = string.Format("Start the level with a {0}!", boosterName); PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/ItemPopup", "Booster Item Popup", boosterName, msg, "Buy"); temp.GetComponent <PopupItem>().ItemSetting(type, 150); temp.onConfirm += () => { }; } }
public void OnPressed() { string level = string.Format("Level {0}", GameDataMgr.G.endLevel.ToString()); PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/GamePopup", "StartPopup", level, null, "Play"); temp.GetComponent <GamePopup>().OnPopup(GamePopupState.start); GamePopupItemGroup item = temp.GetComponentInChildren <GamePopupItemGroup>(); if (item != null) { item.BoosterItemSetting(); item.gameObject.GetComponent <UIWidget>().bottomAnchor.absolute = 50; } temp.onConfirm += () => { SceneFadeInOut fade = gameObject.GetComponentInParent <SceneFadeInOut>(); fade.delayTime = 0.15f; fade.fadeTime = 0.3f; fade.OnPressed(); }; }
public void OnPressed() { if(popup == null) { oldDepth = uiSettingPanel.depth; uiSettingPanel.depth = 5; uiBlack.SetActive(true); popup = PopupInGameSetting.Open("In Game Setting"); popup.onQuit += () => { PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/ExitGamePopup", "Exit Popup", null, null, "Quit"); temp.onEixt += () => { temp.Close(); GameMgr.G.Failed(); }; uiSettingPanel.depth = oldDepth; uiBlack.SetActive(false); }; popup.onBGM += () => { }; popup.onEffect += () => { }; } else { popup.OnExit(); uiSettingPanel.depth = oldDepth; uiBlack.SetActive(false); } }
static public PopupConfirm Open(string path, string ID, string title, string message, string btn, bool isDelayCloseConfirm = true, bool isDelayCloseExit = true) { PopupConfirm temp = Popup.Create <PopupConfirm>(path, ID); Manager.SoundMgr.G.GameEffectPlay(System.EffectSound.popup_open); if (!string.IsNullOrEmpty(title) && temp.uiTitle != null) { temp.uiTitle.text = title /*DataMgr.G.GetIndexUIText(204)*/; } if (!string.IsNullOrEmpty(message) && temp.uiMessage != null) { temp.uiMessage.text = message /*DataMgr.G.GetIndexUIText(204)*/; } if (temp.uiBtn != null) { temp.uiBtn.text = btn /*DataMgr.G.GetIndexUIText(204)*/; } temp.IsDelayCloseConfirm = isDelayCloseConfirm; temp.IsDelayCloseExit = isDelayCloseExit; return(temp); }
private void Update() { // 임시 if (stackPopup.Count > 0) { Popup temp = stackPopup.Peek(); if (temp != null && temp.GetID() != "In Game Setting") { if (!black.activeSelf) { black.SetActive(true); } if (temp.GetID() != "StartPopup" && temp.GetID() != "Goal Popup") { blackTexture.alpha = 1; } else { blackTexture.alpha = 0.8f; } } } else { if (black.activeSelf) { black.SetActive(false); } } if (isFadeCheck && Input.GetKeyDown(KeyCode.Escape)) { bool isPopup = (stackPopup.Count == 0) ? false : true; if (isPopup) // 열린 팝업들이 있다. { Popup popup = stackPopup.Pop(); popup.Close(); if (popup.GetID() == "In Game Setting") { GameMgr.G.uiSettingBtn.OnPressed(); } else if (popup.GetID() == "SuccessPopup" || popup.GetID() == "FailedPopup") { GameMgr.G.GoLooby(); } else if (popup.GetID() == "Failed Moves Popup") { GameMgr.G.Failed(); } } else { for (int i = 0; i < GameDataMgr.G.isUseInGameItem.Length; ++i) { if (GameDataMgr.G.isUseInGameItem[i]) { GameDataMgr.G.isUseInGameItem[i] = false; GameMgr.G.itemUIElements.items[i].ResetInfo(); return; } } PopupConfirm temp = PopupConfirm.Open("Prefabs/Popup/QuitPopup", "Quit", "Are You Sure?", "Do you want to quit?", "QUIT", false); if (temp != null) { temp.onConfirm += () => { #if (UNITY_ANDROID && UNITY_EDITOR) UnityEditor.EditorApplication.isPlaying = false; #elif (UNITY_ANDROID && !UNITY_EDITOR) Application.Quit(); #endif }; } } } }