Exemplo n.º 1
0
        public void ChangeScene <U>(Action onComplete = null) where U : BaseScene
        {
            if (m_Scenes == null)
            {
                return;
            }

            var nextIdx = GetSceneIdx <U>();

            if (ArrayUtility.IsOutOfArray(m_Scenes, nextIdx))
            {
                return;
            }

            BaseScene next = m_Scenes[nextIdx];

            // シーン切替前の処理
            OnChangeSceneBefore(m_CurrentScene, next, () => {
                if (m_CurrentScene)
                {
                    m_CurrentScene.OnChangeDisableBefore();
                }
                next.OnChangeEnableBefore();

                // シーン切替中の処理
                OnChangeScene(m_CurrentScene, next, () => {
                    if (m_CurrentScene)
                    {
                        m_CurrentScene.OnChangeDisableAfter();
                    }
                    next.OnChangeEnableAfter();

                    // シーン切替後の処理
                    OnChangeSceneAfter(m_CurrentScene, next, () => {
                        m_CurrentScene = next;

                        EventUtility.SafeInvokeAction(onComplete);
                    });
                });
            });
        }
Exemplo n.º 2
0
 protected virtual void OnChangeScene(BaseScene current, BaseScene next, Action onComplete)
 {
     EventUtility.SafeInvokeAction(onComplete);
 }