Пример #1
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 static DialogProgress CreateProgressCircular()
        {
            DialogProgress dialog = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dialogProgress, instance.transform).GetComponent <DialogProgress>();

            dialog.SetupIndicator(false);
            dialog.Initialize();
            return(dialog);
        }
Пример #2
0
        /// <summary>
        /// Shows a circular progress dialog with an optional title, optional icon, optional body text, and a required progress indicator.
        /// <para></para>
        /// For more customizability, use <see cref="CreateProgressCircular"/>.
        /// </summary>
        /// <param name="bodyText">The body text. Make null for no body.</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="startStationaryAtZero">Should the progress begin at zero and non-animated?</param>
        /// <returns>The instance of the initialized, shown dialog.</returns>
        public static DialogProgress ShowProgressCircular(string bodyText, string titleText, ImageData icon, bool startStationaryAtZero = false)
        {
            DialogProgress dialog = CreateProgressCircular();

            dialog.Initialize(bodyText, titleText, icon, startStationaryAtZero);
            dialog.ShowModal();
            return(dialog);
        }
Пример #3
0
        /// <summary>
        /// Creates a complex linear 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="ShowProgressLinear(string,string,ImageData,bool)"/>.
        /// </summary>
        /// <returns>The instance of the created dialog.</returns>
        public static DialogProgress CreateComplexProgressLinear()
        {
            DialogProgress dialog = PrefabManager.InstantiateGameObject("DialogComplexProgress", instance.transform).GetComponent <DialogProgress>();

            dialog.SetupIndicator(true);
            dialog.Initialize();
            return(dialog);
        }
Пример #4
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);
        }
Пример #5
0
        public static void ShowCustomScreenAsync <T>(string screenPrefabPath, ScreenView screenView, System.Action <T> initializeCallback, DialogProgress progressIndicator = null, bool p_searchForScreensWithSameName = true) where T : MaterialScreen
        {
            T screenWithSameName = null;

            if (screenView != null)
            {
                if (p_searchForScreensWithSameName)
                {
                    foreach (var screen in screenView.materialScreen)
                    {
                        if (screen != null && screen is T && screen.name == screenPrefabPath)
                        {
                            screenWithSameName = screen as T;
                            break;
                        }
                    }
                }
            }

            System.Action <T> internalShowCallback = (screen) =>
            {
                if (screen != null)
                {
                    if (screenView != null)
                    {
                        if (!screenView.materialScreen.Contains(screen))
                        {
                            screenView.materialScreen.Add(screen);
                        }
                    }
                    //Init
                    if (initializeCallback != null)
                    {
                        initializeCallback.Invoke(screen);
                    }

                    if (screenView != null)
                    {
                        screen.Show();
                    }
                    else
                    {
                        Debug.Log("Invalid ScreenView");
                    }
                }
            };
            //Show Pre-Loaded Screen
            if (screenWithSameName != null)
            {
                internalShowCallback(screenWithSameName);
            }

            //Load and show Screen
            else
            {
                DialogProgress currentProgress = progressIndicator;

                System.Action <string, T> internalLoadCallback = (path, dialog) =>
                {
                    //_dialogGenericDialog = dialog;
                    if (dialog != null)
                    {
                        dialog.gameObject.SetActive(false);
                    }
                    System.Action callbackDelayed = () =>
                    {
                        //Show
                        if (internalShowCallback != null)
                        {
                            internalShowCallback.Invoke(dialog);
                        }

                        //Hide Progress Indicator
                        currentProgress.Hide();
                    };
                    Kyub.DelayedFunctionUtils.CallFunction(callbackDelayed, 0.5f);
                };

                if (currentProgress == null)
                {
                    currentProgress = DialogManager.ShowProgressModalCircular();
                }
                else
                {
                    currentProgress.Show();
                }
                CreateCustomScreenAsync <T>(screenPrefabPath, screenView, internalLoadCallback);
            }
        }
Пример #6
0
        public static void ShowCustomScreenAsync <T>(string screenPrefabPath, Transform parent, System.Action <T> initializeCallback, DialogProgress progressIndicator = null, bool p_searchForScreensWithSameName = true) where T : MaterialScreen
        {
            var screenView = parent != null?parent.GetComponentInParent <ScreenView>() : null;

            ShowCustomScreenAsync(screenPrefabPath, screenView, initializeCallback, progressIndicator, p_searchForScreensWithSameName);
        }