/// <summary>
        /// 创建加载场景成功事件。
        /// </summary>
        /// <param name="sceneAssetName">场景资源名称。</param>
        /// <param name="duration">加载持续时间。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的加载场景成功事件。</returns>
        public static LoadSceneSuccessEventArgs Create(string sceneAssetName, float duration, object userData)
        {
            LoadSceneSuccessEventArgs loadSceneSuccessEventArgs = ReferencePool.Acquire <LoadSceneSuccessEventArgs>();

            loadSceneSuccessEventArgs.SceneAssetName = sceneAssetName;
            loadSceneSuccessEventArgs.Duration       = duration;
            loadSceneSuccessEventArgs.UserData       = userData;
            return(loadSceneSuccessEventArgs);
        }
Beispiel #2
0
        private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
        {
            if (!m_SceneOrder.ContainsKey(e.SceneAssetName))
            {
                m_SceneOrder.Add(e.SceneAssetName, 0);
            }

            m_EventComponent.Fire(this, LoadSceneSuccessEventArgs.Create(e));
            RefreshSceneOrder();
        }
Beispiel #3
0
 private void LoadSceneSuccessCallback(string sceneAssetName, float duration, object userData)
 {
     m_LoadingSceneAssetNames.Remove(sceneAssetName);
     m_LoadedSceneAssetNames.Add(sceneAssetName);
     if (m_LoadSceneSuccessEventHandler != null)
     {
         LoadSceneSuccessEventArgs loadSceneSuccessEventArgs = LoadSceneSuccessEventArgs.Create(sceneAssetName, duration, userData);
         m_LoadSceneSuccessEventHandler(this, loadSceneSuccessEventArgs);
         ReferencePool.Release(loadSceneSuccessEventArgs);
     }
 }
        private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
        {
            m_MainCamera = Camera.main;
            if (SceneManager.GetActiveScene() == m_GameFrameworkScene)
            {
                Scene scene = SceneManager.GetSceneByName(e.SceneName);
                SceneManager.SetActiveScene(scene);
            }

            m_EventComponent.Fire(this, new LoadSceneSuccessEventArgs(e));
        }
Beispiel #5
0
        private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
        {
            m_MainCamera = Camera.main;
            if (SceneManager.GetActiveScene() == m_GameFrameworkScene)
            {
                Scene scene = SceneManager.GetSceneByName(GetSceneName(e.SceneAssetName));
                if (!scene.IsValid())
                {
                    Log.Error("Loaded scene '{0}' is invalid.", e.SceneAssetName);
                    return;
                }

                SceneManager.SetActiveScene(scene);
            }

            m_EventComponent.Fire(this, LoadSceneSuccessEventArgs.Create(e));
        }
Beispiel #6
0
        private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
        {
            m_MainCamera = Camera.main;
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene() == m_GameFrameworkScene)
            {
                Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneByName(GetSceneName(e.SceneAssetName));
                if (!scene.IsValid())
                {
                    Log.Error("Loaded scene '{0}' is invalid.", e.SceneAssetName);
                    return;
                }

                UnityEngine.SceneManagement.SceneManager.SetActiveScene(scene);
            }

            if (m_EnableLoadSceneSuccessEvent)
            {
                m_EventComponent.Fire(this, ReferencePool.Acquire <LoadSceneSuccessEventArgs>().Fill(e));
            }
        }
        //加载场景成功的回调
        private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
        {
            m_MainCamera = Camera.main;                                                    //获取主相机
            if (SceneManager.GetActiveScene() == m_GFScene)                                //如果当前是框架所在场景
            {
                Scene scene = SceneManager.GetSceneByName(GetSceneName(e.SceneAssetName)); //获取加载成功的场景
                if (!scene.IsValid())                                                      //加载的场景不合法
                {
                    Log.Error("[SceneComponent.OnLoadSceneSuccess] Loaded scene '{0}' is invalid.", e.SceneAssetName);
                    return;
                }

                SceneManager.SetActiveScene(scene); //激活场景
            }

            if (m_EnableLoadSceneSuccessEvent)
            {
                m_EventComponent.Fire(this, ReferencePool.Acquire <LoadSceneSuccessEventArgs>().Fill(e));
            }
        }
Beispiel #8
0
 private void OnLoadSceneSuccess(object sender, GameFramework.Scene.LoadSceneSuccessEventArgs e)
 {
     RefreshAudioListener();
 }