示例#1
0
        /// <summary>
        /// Creates a custom dialog that can be modified or stored before showing.
        /// </summary>
        /// <typeparam name="T">The type of dialog to show, must inherit from <see cref="MaterialDialogCompat"/>.</typeparam>
        /// <param name="dialogPrefabPath">The path to the dialog prefab.</param>
        /// <returns>The instance of the created dialog.</returns>
        public T CreateCustomDialog <T>(string dialogPrefabPath) where T : MaterialDialogCompat
        {
            T dialog = PrefabManager.InstantiateGameObject(dialogPrefabPath, GetContentTransform()).GetComponent <T>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            return(dialog);
        }
示例#2
0
        /// <summary>
        /// Creates a prompt dialog that can be modified or stored before showing.
        /// <para></para>
        /// Before calling <see cref="DialogPrompt.Show"/>, call <see cref="DialogPrompt.Initialize(string,string,Action{string, string},string,string,ImageData,Action,string)"/>.
        /// <para></para>
        /// For a simpler solution with less customizability, use <see cref="ShowPrompt(string,string,Action{string, string},string,string,ImageData,Action,string)"/>.
        /// </summary>
        /// <returns>The instance of the created dialog.</returns>
        public DialogPrompt CreatePrompt()
        {
            DialogPrompt dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogPrompt, GetContentTransform()).GetComponent <DialogPrompt>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            //dialog.Initialize();
            return(dialog);
        }
示例#3
0
        /// <summary>
        /// Shows a date picker dialog with a required date picker, and a required button.
        /// </summary>
        /// <param name="year">The year selected when the dialog is shown.</param>
        /// <param name="month">The month selected when the dialog is shown.</param>
        /// <param name="day">The day selected when the dialog is shown.</param>
        /// <param name="onAffirmativeClicked">Called when the affirmative button is clicked.</param>
        /// <param name="onDismissiveClicked">Called when the negative button is clicked.</param>
        /// <param name="accentColor">Color of the accent of the picker.</param>
        public DialogDatePicker ShowDatePicker(int year, int month, int day, Action <DateTime> onAffirmativeClicked, Action onDismissiveClicked, Color accentColor)
        {
            DialogDatePicker dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogDatePicker, GetContentTransform()).GetComponent <DialogDatePicker>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            dialog.Initialize(year, month, day, onAffirmativeClicked, onDismissiveClicked, accentColor);
            dialog.Show();
            return(dialog);
        }
示例#4
0
        /// <summary>
        /// Shows a time picker dialog with a required time picker, and a required button.
        /// </summary>
        /// <param name="time">The time selected when the dialog is shown.</param>
        /// <param name="onAffirmativeClicked">Called when the affirmative button is clicked.</param>
        /// <param name="accentColor">Color of the accent of the picker.</param>
        public DialogTimePicker ShowTimePicker(DateTime time, Action <DateTime> onAffirmativeClicked, Color accentColor)
        {
            DialogTimePicker dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogTimePicker, GetContentTransform()).GetComponent <DialogTimePicker>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            dialog.Initialize(time, onAffirmativeClicked, accentColor);
            dialog.Show();
            return(dialog);
        }
示例#5
0
        /// <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 DialogRadioList ShowRadioList(string[] options, Action <int> onAffirmativeButtonClicked, string affirmativeButtonText, string titleText, ImageData icon, Action onDismissiveButtonClicked, string dismissiveButtonText, int selectedIndexStart = 0)
        {
            DialogRadioList dialog = CreateRadioList();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            dialog.Initialize(options, onAffirmativeButtonClicked, affirmativeButtonText, titleText, icon, onDismissiveButtonClicked, dismissiveButtonText, selectedIndexStart);
            dialog.Show();
            return(dialog);
        }
示例#6
0
        /// <summary>
        /// Creates a circular progress dialog that can be modified or stored before showing.
        /// <para></para>
        /// Before calling <see cref="DialogProgress.Show"/>, call <see cref="DialogProgress.Initialize(string,string,ImageData,bool)"/>.
        /// <para></para>
        /// For a simpler solution with less customizability, use <see cref="ShowProgressCircular(string,string,ImageData,bool)"/>.
        /// </summary>
        /// <returns>The instance of the created dialog.</returns>
        public DialogProgress CreateProgressCircular()
        {
            DialogProgress dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogProgress, GetContentTransform()).GetComponent <DialogProgress>();

            DialogManager.CreateActivity(dialog, dialog.transform.parent);
            dialog.SetupIndicator(false);
            //dialog.Initialize();
            return(dialog);
        }
示例#7
0
 /// <summary>
 /// Creates a custom dialog that can be modified or stored before showing.
 /// </summary>
 /// <typeparam name="T">The type of dialog to show, must inherit from <see cref="MaterialDialogCompat"/>.</typeparam>
 /// <param name="dialogPrefabPath">The path to the dialog prefab.</param>
 /// <returns>The instance of the created dialog.</returns>
 public void CreateCustomDialogAsync <T>(string dialogPrefabPath, System.Action <string, T> callback) where T : MaterialDialogCompat
 {
     System.Action <string, GameObject> internalcallback = (path, dialog) =>
     {
         T assetComponent = null;
         if (dialog != null)
         {
             assetComponent = dialog.GetComponent <T>();
             DialogManager.CreateActivity(assetComponent, dialog.transform.parent);
         }
         callback(path, assetComponent);
     };
     PrefabManager.InstantiateGameObjectAsync(dialogPrefabPath, GetContentTransform(), internalcallback);
 }
 public override void Show()
 {
     if (activity == null && m_LegacyActivityCompatibility)
     {
         //Create Activity in Main Canvas
         if (this.transform.parent == null)
         {
             activity = DialogManager.CreateActivity(this);
         }
         //Create Activity inside this parent
         else
         {
             activity = DialogManager.CreateActivity(this, this.transform.parent);
         }
     }
     base.Show();
 }