public override void Show() { if (options.Count == 0) { if (IsExpanded()) { Hide(); } return; } var prefabAddress = cachedPrefabAddress == null || cachedPrefabAddress.IsEmpty() || !cachedPrefabAddress.IsResources() ? PrefabManager.ResourcePrefabs.dialogSimpleList : cachedPrefabAddress; ShowFrameActivity(_CacheDialogList, prefabAddress, (dialog, isDialog) => { _CacheDialogList = dialog; if (isDialog) { dialog.Initialize(options.ToArray(), Select, "OK", hintOption.text, hintOption.imageData, HandleOnHide, "Cancel", selectedIndex, allowSwitchOff); } //Dont show title in Dropdown Mode else { dialog.Initialize(options.ToArray(), Select, "OK", null, null, HandleOnHide, "Cancel", selectedIndex, allowSwitchOff); } }); }
/// <summary> /// Creates a radiobutton list dialog that can be modified or stored before showing. /// <para></para> /// Before calling <see cref="DialogRadioList.Show"/>, call <see cref="DialogRadioList.Initialize(string[],Action{int},string,string,ImageData,Action,string,int)"/>. /// <para></para> /// For a simpler solution with less customizability, use <see cref="ShowRadioList(string[],Action{int},string,string,ImageData,Action,string,int)"/>. /// </summary> /// <returns>The instance of the created dialog.</returns> public static DialogRadioList CreateRadioList() { DialogRadioList dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogRadioList, instance.transform).GetComponent <DialogRadioList>(); dialog.Initialize(); return(dialog); }
/// <summary> /// Creates a radiobutton list dialog that can be modified or stored before showing. /// <para></para> /// Before calling <see cref="DialogRadioList.Show"/>, call <see cref="DialogRadioList.Initialize(string[],Action{int},string,string,ImageData,Action,string,int)"/>. /// <para></para> /// For a simpler solution with less customizability, use <see cref="ShowRadioList(string[],Action{int},string,string,ImageData,Action,string,int)"/>. /// </summary> /// <returns>The instance of the created dialog.</returns> public DialogRadioList CreateRadioList() { DialogRadioList dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogRadioList, GetContentTransform()).GetComponent <DialogRadioList>(); DialogManager.CreateActivity(dialog, dialog.transform.parent); //dialog.Initialize(); return(dialog); }
/// <summary> /// Shows a radiobutton list dialog with an optional title, optional icon, a required scrollable radiobutton list, a required button, and an optional button. /// <para></para> /// For more customizability, use <see cref="CreateRadioList"/>. /// </summary> /// <param name="options">The strings to use for the list item labels.</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> /// <param name="selectedIndexStart">The index of the option that will be selected when the dialog is shown.</param> /// <returns>The instance of the initialized, shown dialog.</returns> public static DialogRadioList ShowRadioList(string[] options, Action <int> onAffirmativeButtonClicked, string affirmativeButtonText, string titleText, ImageData icon, Action onDismissiveButtonClicked, string dismissiveButtonText, int selectedIndexStart = 0) { DialogRadioList dialog = CreateRadioList(); dialog.Initialize(options, onAffirmativeButtonClicked, affirmativeButtonText, titleText, icon, onDismissiveButtonClicked, dismissiveButtonText, selectedIndexStart); dialog.Show(); return(dialog); }
/// <summary> /// Shows an simple list dialog with an optional title, optional icon, and a required scrollable option list. /// <para></para> /// For more customizability, use <see cref="CreateSimpleList"/>. /// </summary> /// <param name="optionDataList">The data to use for the option list.</param> /// <param name="onItemClick">Called when an option is selected.</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> /// <returns>The instance of the initialized, shown dialog.</returns> public DialogRadioList ShowSimpleList(OptionData[] options, Action <int> onItemClick, string titleText, ImageData icon) { DialogRadioList dialog = CreateSimpleList(); dialog.Initialize(options, onItemClick, null, titleText, icon, null, null, -1, true); dialog.Show(); return(dialog); }