Beispiel #1
0
        /// <summary>
        /// 切换进入游戏前的场景
        /// </summary>
        public void SwitchPreposeScene(string name, bool auto_hide_loading_ui)
        {
            var map_info = new DBMap.MapInfo();

            map_info.SceneRes = name;
            SwitchScene(map_info, auto_hide_loading_ui, true);
        }
Beispiel #2
0
        /// <summary>
        /// 切换场景
        /// </summary>
        /// <param name="map_info">地图信息</param>
        /// <param name="auto_hide_loadingUI">是否在加载完成后自动隐藏loading界面</param>
        /// <param name="willSwitchScene">是否需要切换场景</param>
        public void SwitchScene(DBMap.MapInfo map_info, bool auto_hide_loadingUI, bool willSwitchScene)
        {
            mCurSceneName    = map_info.SceneLevelName;
            mCurSceneResPath = map_info.SceneResPath;
            bool clearUI = true;

            if (willSwitchScene == false)
            {
                clearUI = false;
                // 是否需要切换UI
                if (SceneHelp.Instance.CurSceneID != SceneHelp.Instance.PreSceneID)
                {
                    UIVisibleControlComponent.UpdateVisibleState();

                    //ui.ugui.UIManager.GetInstance().ClearUI();
                    //xc.ClientEventManager<ClientEventType.ugui.UICoreEvent>.Instance.FireEvent(ClientEventType.ugui.UICoreEvent.LEVEL_CHANGE, null);
                    ui.ugui.UIManager.GetInstance().CloseWindowsWhenSwitchPlaneInstance();

                    // 这里要fire这个事件,不然主界面右上角出不来
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_MAINMAP_SWITCH_ANIMATION, new CEventBaseArgs(true));
                    ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_START_SWITCH_PLANE_INSTANCE, null);
                }
            }
            else
            {
                ui.ugui.UIManager.GetInstance().ClearUI();
                xc.ClientEventManager <ClientEventType.ugui.UICoreEvent> .Instance.FireEvent(ClientEventType.ugui.UICoreEvent.LEVEL_CHANGE, null);

                m_SwitchingScene = true;
                ui.ugui.UIManager.GetInstance().ShowLoadingBK(true);
                mAutoHideLoadingUI = auto_hide_loadingUI;

                /*ui.UIWidgetHelp.GetInstance().HideNoticeDlg()*/
                UIWidgetHelp.BlockOtherNoticeDlg = false;
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_START_SWITCHSCENE, null);

                // 展示一个资源加载界面
                // MapLoading 场景中的SceneLoader组件会按照Game中的全局数据来加载场景
                Game.GetInstance().SetLoadAsyncOp(null);
                SceneManager.LoadScene("MapLoading");

                SceneHelp.Instance.IsLoadingQuadTreeScene = SceneHelp.LoadQuadTreeSceneState.NoStartLoading;
            }
            AudioManager.GetInstance().TransferOut();
            Dungeon.CollectionObjectManager.Instance.Enable = true;//重置采集

            // 销毁场景数据
            DestroyScene(clearUI);
        }
Beispiel #3
0
        /// <summary>
        /// 通过map_id来进行场景切换
        /// </summary>
        public void SwitchScene(uint map_id, bool auto_hide_loadingUI, bool willSwitchScene)
        {
            DBMap db_map = DBManager.GetInstance().GetDB <DBMap>();

            if (db_map == null)
            {
                GameDebug.LogError("No scene with map id " + map_id);
                return;
            }

            DBMap.MapInfo map_info = db_map.GetMapInfo(map_id);
            if (map_info == null)
            {
                GameDebug.LogError("No scene with map id " + map_id);
                return;
            }

            mCurMapInfo = map_info;

            SwitchScene(map_info, auto_hide_loadingUI, willSwitchScene);
        }