Пример #1
0
 /// <summary>
 /// See Monobehaviour.OnDestroy.
 /// </summary>
 void OnDestroy()
 {
     m_Instance = null;
 }
Пример #2
0
 /// <summary>
 /// See Monobehaviour.OnApplicationQuit.
 /// </summary>
 void OnApplicationQuit()
 {
     m_Instance = null;
 }
Пример #3
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);
            }
        }