Esempio n. 1
0
        /// <summary>
        /// 叠加场景
        /// </summary>
        /// <param name="sceneID"></param>
        /// <param name="param"></param>
        public void LoadAdditiveScene(int sceneID, SceneParam param)
        {
            SceneBase newScene = this.CreateScene(sceneID);

            if (newScene == null)
            {
                return;
            }

            newScene.Load(param);

            this.bgScene = newScene;
        }
Esempio n. 2
0
        /// <summary>
        /// 根据场景ID加载新的场景
        /// </summary>
        /// <param name="sceneID"></param>
        /// <param name="param"></param>
        /// <param name="onloaded"></param>
        /// <param name="isback"></param>
        /// <param name="sceneBackStackPush"></param>
        private void LoadScene(int sceneID, SceneParam param, Action onloaded, bool sceneUIPush, bool isback, bool sceneBackStackPush)
        {
            //新建下一个场景
            SceneBase newScene = this.CreateScene(sceneID);

            if (newScene == null)
            {
                return;
            }

            int lastSceneId = this.GetSceneID();

            if (sceneBackStackPush)
            {
                this.sceneBackStack.Add(lastSceneId);
            }

            //缷载旧的场景

            this.lastSceenID = lastSceneId;

            SceneBase lastScene = this.currScene;

            if (lastScene != null)
            {
                string lastSceneName = lastScene.GetSceneName();

                int lastSceneType = lastScene.GetSceneType();

                //退出当前场景并通知UI关闭当前场景UI
                this.ExitCurrent(sceneUIPush);

                //清理当前场景缓存的对象,终止正在加载的队列
                if (lastSceneType != newScene.GetSceneType())
                {
                    SceneUIHelper.UnloadSceneAB(lastSceneName, false);
                }

                SceneUIHelper.MainScene = null;

                SceneUIHelper.MainCamera = null;

                SceneUIHelper.SceneUIRoot = null;

                //除了登陆场景,其他场景切换均有场景过渡

                if (lastSceneType != (int)SceneDefine.SceneType.LOGIN)
                {
                    //如果参数里标记了使用CUTSCENE过渡,那么不要打开这个普通过渡 界面

                    bool useNormalTransition = true;

                    if (param != null)
                    {
                        if (param.UseCutSceneTransition)
                        {
                            useNormalTransition = false;
                        }
                        else if (param.useCivSceneTransition)
                        {
                            useNormalTransition = false;

                            //打开一个加载界面
                        }
                    }

                    if (useNormalTransition)
                    {
                        //打开正常的加载过渡界面
                    }
                }
            }

            this.currScene = newScene;

            //通知开始加载新场景

            SceneUIHelper.MainScene = newScene;

            newScene.Load(param, onloaded, isback);

            //发送场景切换事件
        }