public void ShowPopup(ePopupType type, string title, string content, System.Action <bool> callback) { GameObject popupObj = (GameObject)Instantiate(m_PopupPrefab, m_Canvas.transform); popupObj.transform.SetSiblingIndex(0); // make sure it doesn't show up over the Fade Scrim m_CurrentPopup = popupObj.GetComponent <UIPopup>(); // TODO should probably use a stack for easily managing multiple popups m_CurrentPopupType = type; m_CloseCallback = callback; List <UIPromptInfo> prompts = new List <UIPromptInfo>() { m_Prompts[0] }; switch (m_CurrentPopupType) { case ePopupType.Confirm: m_Prompts[0].m_LabelText = "Okay"; break; case ePopupType.YesNo: m_Prompts[0].m_LabelText = "Yes"; m_Prompts[1].m_LabelText = "No"; prompts.Add(m_Prompts[1]); break; } m_CurrentPopup.SetData(title, content, prompts); m_CurrentPopup.Show(); InputManager.Instance.AddInputEventDelegate(OnInputUpdate, UpdateLoopType.Update); }
/// <summary> /// 팝업 생성. /// </summary> public UIPopup AddPopup(GirlGlobeEnums.eUIPopupType _uiPopupType, object[] _param = null) { currentPopup = Resources.Load <UIPopup>(Utils.CreateStringBuilderStr(new string[] { "Prefabs/Panel/Popup/", _uiPopupType.ToString() })); parentTransform = GameObject.Find("PopupCanvas").transform; currentPopup = Instantiate(currentPopup, parentTransform).GetComponent <UIPopup>(); if (_param != null) { currentPopup.SetData(_param); } uIPopupTypes.Push(_uiPopupType); uIPopups.Push(currentPopup); return(currentPopup); }
public T ShowPopup <T>(string screenName, string data = null, Action <object> positive = null, Action <object> negative = null) where T : UIPopup { if (!mListScreen.ContainsKey(screenName)) { throw new KeyNotFoundException("ScreenManager: Show failed. Screen with name '" + screenName + "' does not exist."); } GameObject newDupeScreen = GameObject.Instantiate(mListScreen[screenName].gameObject); newDupeScreen.transform.SetParent(transform, false); UIPopup popup = newDupeScreen.GetComponent <UIPopup>(); popup.Initialize(this, true); popup.SetData(data); popup.SetCallback(positive, negative); newDupeScreen.name = screenName + " (" + (popup.ID) + ")"; return(ShowScreen(popup, true) as T); }