Esempio n. 1
0
 ///@param sceneName
 ///     Name of the scene to switch to
 /// @param [optional] callback
 ///     Function to call when the transiton is done
 ///
 public void LoadSceneAdditively(string sceneName, Action callback = null)
 {
     GlobalDirector.ExecuteCoroutine(StartLoadScene(sceneName, LoadSceneMode.Additive, () =>
     {
         callback.SafeInvoke();
     }));
 }
Esempio n. 2
0
        /// Coroutine to handle transitioning to a scene with a transition screen
        ///
        /// @param sceneLoadOperation
        ///     AsyncOperation for the scene loading
        /// @param transitionView
        ///     SceneTransitionView to use as the transition screen
        /// @param [optional] callback
        ///     Function to call when the transiton is done
        ///
        private IEnumerator StartTransition(AsyncOperation sceneLoadOperation, SceneTransitionView transitionView, Action callback = null)
        {
            sceneLoadOperation.allowSceneActivation = false;

            if (transitionView != null)
            {
                yield return(GlobalDirector.ExecuteCoroutine(transitionView.Show()));
            }

            sceneLoadOperation.allowSceneActivation = true;
            yield return(new WaitUntil(() => sceneLoadOperation.isDone));

            LocalDirector[] localDirectors = GameObject.FindObjectsOfType <LocalDirector>();
            foreach (LocalDirector localDirector in localDirectors)
            {
                yield return(new WaitUntil(() => localDirector.IsReady()));
            }

            callback.SafeInvoke();
            OnSceneActive.SafeInvoke(GetActiveScene());

            if (transitionView != null)
            {
                yield return(GlobalDirector.ExecuteCoroutine(transitionView.Hide()));
            }
        }
Esempio n. 3
0
        /// @param sceneName
        ///     Name of the scene to switch to
        /// @param transitionPrefabName
        ///     Name of the prefab inside the default transition folder to use for the transition screen
        /// @param [optional] callback
        ///     Function to call when the transiton is done
        ///
        public void SwitchToScene(string sceneName, string transitionPrefabName, Action callback = null)
        {
            m_scenes.Clear();
            AsyncOperation      loadSceneOperation = SceneManager.LoadSceneAsync(sceneName);
            SceneTransitionView transitionView     = CreateTransitionView(transitionPrefabName);

            GlobalDirector.ExecuteCoroutine(StartTransition(loadSceneOperation, transitionView, callback));
        }
Esempio n. 4
0
 /// Start the presenting process
 ///
 public void RequestPresent()
 {
     m_coroutine = GlobalDirector.ExecuteCoroutine(Present(() =>
     {
         if (m_backButtonEnabled == true)
         {
             m_inputService.AddBackButtonListener(OnBackPressed);
         }
     }));
 }
Esempio n. 5
0
 ///@param sceneName
 ///     Name of the scene to unload
 /// @param [optional] callback
 ///     Function to call when the transiton is done
 ///
 public void UnloadScene(string sceneName, Action callback = null)
 {
     if (IsSceneLoaded(sceneName) == true)
     {
         GlobalDirector.ExecuteCoroutine(StartUnloadScene(SceneManager.GetSceneByName(sceneName), callback));
     }
     else
     {
         callback.SafeInvoke();
     }
 }
Esempio n. 6
0
 /// @param callback
 ///     The function to call when the data is loaded
 ///
 public void LoadCachedData(Action callback = null)
 {
     m_coroutine = GlobalDirector.ExecuteCoroutine(LoadDataAsync(callback));
 }
Esempio n. 7
0
 /// Start the dismissing process
 ///
 public void RequestDismiss()
 {
     DisableBackButton();
     m_coroutine = GlobalDirector.ExecuteCoroutine(Dismiss());
 }
Esempio n. 8
0
 /// @param sceneName
 ///     Name of the scene to switch to
 /// @param [optional] callback
 ///     Function to call when the transiton is done
 ///
 public void SwitchToScene(string sceneName, Action callback = null)
 {
     m_scenes.Clear();
     GlobalDirector.ExecuteCoroutine(StartLoadScene(sceneName, LoadSceneMode.Single, callback));
 }