/// <summary> /// Creates an alert dialog that can be modified or stored before showing. /// <para></para> /// For a simpler solution with less customizability, use <see cref="ShowAlert(string,Action,string,string,ImageData,Action,string)"/>. /// </summary> /// <returns>The instance of the created dialog.</returns> public static DialogAlert CreateAlert() { DialogAlert dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogAlert, instance.transform).GetComponent <DialogAlert>(); dialog.Initialize(); return(dialog); }
/// <summary> /// Creates an alert dialog that can be modified or stored before showing. /// <para></para> /// For a simpler solution with less customizability, use <see cref="ShowAlert(string,Action,string,string,ImageData,Action,string)"/>. /// </summary> /// <returns>The instance of the created dialog.</returns> public DialogAlert CreateAlert() { DialogAlert dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogAlert, GetContentTransform()).GetComponent <DialogAlert>(); DialogManager.CreateActivity(dialog, dialog.transform.parent); //dialog.Initialize(); return(dialog); }
/// <summary> /// Shows an alert dialog with an optional title, optional icon, optional body text and 2 optional buttons. /// <para></para> /// For more customizability, use <see cref="CreateAlert"/>. /// </summary> /// <param name="bodyText">The body text. Make null for no body.</param> /// <param name="onAffirmativeButtonClicked">Called when the affirmative button is clicked.</param> /// <param name="affirmativeButtonText">The affirmative button text.</param> /// <param name="titleText">The title text. Make null for no title.</param> /// <param name="icon">The icon next to the title. Make null for no icon.</param> /// <param name="onDismissiveButtonClicked">Called when the dismissive button is clicked.</param> /// <param name="dismissiveButtonText">The dismissive button text. Make null for no dismissive button.</param> /// <returns>The instance of the initialized, shown dialog.</returns> public static DialogAlert ShowAlert(string bodyText, Action onAffirmativeButtonClicked, string affirmativeButtonText, string titleText, ImageData icon, Action onDismissiveButtonClicked, string dismissiveButtonText) { DialogAlert dialog = CreateAlert(); dialog.Initialize(bodyText, onAffirmativeButtonClicked, affirmativeButtonText, titleText, icon, onDismissiveButtonClicked, dismissiveButtonText); dialog.Show(); return(dialog); }
public override void Show() { var prefabAddress = cachedPrefabAddress == null || cachedPrefabAddress.IsEmpty() || !cachedPrefabAddress.IsResources() ? PrefabManager.ResourcePrefabs.dialogTooltip : cachedPrefabAddress; if (prefabAddress == null || (string.IsNullOrEmpty(m_TipText) && (m_TipImageData == null || !m_TipImageData.ContainsData()))) { if (IsExpanded()) { Hide(); } return; } ShowFrameActivity(_CacheDialogFrame, prefabAddress, (dialog, isDialog) => { _CacheDialogFrame = dialog; if (dialog != null) { dialog.Initialize("", null, null, m_TipText, new ImageData(m_TipImageData), null, null); } }); }