Esempio n. 1
0
        ///<summary> Init the level manager and close the loading screen to be sure everything work fine </summary>
        private void InitSceneManager()
        {
            InitCanvas();

            if (m_DefaultLoadingScreenData == null)
            {
                Debug.LogError(Debug_InitFailed("Can't init the SceneManager, there's no default Loading Screen Data in the m_DefaultLoadingScreen component slot! Drop one"));
                return;
            }
            m_DefaultLoadingScreen      = Instantiate(m_DefaultLoadingScreenData.GetLoadingScreen(), m_CanvasObj);
            m_DefaultLoadingScreen.name = "Default_LoadingScreen";
            if (m_DefaultLoadingScreen == null)
            {
                Debug.LogError(Debug_InitFailed("Can't init the SceneManager, there's no default Loading Screen Object set in ther actual Data! Drop one"));
                return;
            }
            try
            {
                DesactivateDefaultLoadingScreen();
                UnityEngine.SceneManagement.SceneManager.sceneLoaded += LoadingIsDone;
            }
            catch
            {
                Debug.LogError(Debug_InitFailed("Can't init the SceneManager, there's a problem with UnityEngine.SceneManagement.SceneManager"));
                return;
            }

            m_IsInit = true;
            Debug.Log(Debug_InitSucces("Scene Manager as been init"));
        }
Esempio n. 2
0
 ///<summary> Destroy the overwrite loading screen </summary>
 private void DestroyOverwriteLoadingScreen()
 {
     if (m_OverwriteLS != null)
     {
         Destroy(m_OverwriteLS.gameObject);
         m_OverwriteLS         = null;
         m_FadeScreenColor.a   = 0.0f;
         m_FadeScreenImg.color = m_FadeScreenColor;
     }
 }
Esempio n. 3
0
 ///<summary> Overwrite the loading screen with the one ask for within the SceneData </summary>
 private void OverwriteLoadingScreen(ref LoadingScreenObj aLoadingScreen)
 {
     if (m_CurrentSceneData.GetLoadingObj() != null)
     {
         m_OverwriteLS  = Instantiate(m_CurrentSceneData.GetLoadingObj(), m_CanvasObj);
         aLoadingScreen = m_OverwriteLS;
     }
     else
     {
         Debug.LogWarning("There's no Loading Screen available to overwrite the default one.");
         m_DefaultLoadingScreen.gameObject.SetActive(true);
     }
 }
Esempio n. 4
0
 ///<summary> Show the tip box on the loading screen </summary>
 private void ShowTip(ref LoadingScreenObj aLoadingScreen)
 {
     SetTip();
     if (m_TipText != "")
     {
         aLoadingScreen.ShowTipPox(m_TipText);
     }
     else
     {
         Debug.LogWarning("There's no tip available to show.");
         aLoadingScreen.HideTipBox();
     }
 }
Esempio n. 5
0
    IEnumerator LoadingScreen(int lvl)
    {
        LoadingScreenObj.SetActive(true);               // se permite la vizualizacion del slider
        async = SceneManager.LoadSceneAsync(lvl);       //el administrador de scenas busca cargar una scena de forma asincorna dentro de una operacion
        async.allowsSceneActivation = false;            //de momento au  si la carga de la scena es exitosa debido al bajo peso de la misma se
        //mantiene es background

        while (async.isDone == false)               //si async.isDone == true se intercambia a la scena posterior mientras no
        {
            slider.value = async.progress;          //el valor de slider= al valor del progreso asincrono
            if (async.progress == 0.9f)             //si el vlor del progreso se encuentre en .9 que es el indicativo de listo en ejecucion para la sigueinte escena
            {
                slider.value = 1f;                  //se avanza el slider a uno indicando que la carga de la scena esta lista
                async.allowsSceneActivation = true; //el modo asyncrono de carga de la scena libera la scena siguiente
            }
            yield return(null);
        }
    }
Esempio n. 6
0
        ///<summary> Show the loading screen (effect depend on the LoadingType Option) </summary>
        private void ShowLoadingScreen()
        {
            if (m_CurrentSceneData == null)
            {
                ActivateDefaultLoadingScreen();
                Debug.Log(Debug_Message("[SHOW] Loading Screen skip when you select 'Test Current Scene'"));
                return;
            }
            LoadingScreenObj obj = m_DefaultLoadingScreen;

            try
            {
                //Loading Scene Visual Choice
                switch (m_CurrentSceneData.GetLoadingScreenChoice())
                {
                case eSceneM_LoadingScreen.Default:
                {
                    ActivateDefaultLoadingScreen();
                    break;
                }

                case eSceneM_LoadingScreen.Overwrite:
                {
                    if (!AdvancedLoading_IsInit(true))
                    {
                        ActivateDefaultLoadingScreen();
                    }
                    else
                    {
                        OverwriteLoadingScreen(ref obj);
                    }

                    break;
                }

                case eSceneM_LoadingScreen.Fade:
                {
                    if (!Fade_IsInit(true))
                    {
                        ActivateDefaultLoadingScreen();
                    }
                    else
                    {
                        AskToFade(eSceneM_FadeDir.FadeIn);
                        return;
                    }

                    break;
                }
                }

                //Loading Scene Options [Skip if Fade]
                switch (m_CurrentSceneData.GetLoadingType())
                {
                case eSceneM_LoadingType.WithTip:
                {
                    if (!Tip_IsInit(true))
                    {
                        HideTip(ref obj);
                    }
                    else
                    {
                        ShowTip(ref obj);
                    }
                    break;
                }

                case eSceneM_LoadingType.WithoutTip:
                {
                    HideTip(ref obj);
                    break;
                }
                }
            }
            catch
            {
                ActivateDefaultLoadingScreen();
                Debug.LogWarning(Debug_Warning("Problem with the ShowLoadingScreen() function"));
            }
        }
Esempio n. 7
0
 ///<summary> Hide the tip box from the loading screen </summary>
 private void HideTip(ref LoadingScreenObj aLoadingScreen)
 {
     aLoadingScreen.HideTipBox();
     m_TipText = "";
 }