Example #1
0
        private bool LoadSceneData(int sceneResId)
        {
            bool result = true;

            m_SceneResId = sceneResId;
            // 加载场景配置数据
            m_SceneConfig = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneResId);
            if (null == m_SceneConfig)
            {
                GfxSystem.GfxLog("LoadSceneData {0} failed!", sceneResId);
            }
            // 加载本场景xml数据
            m_SceneStaticData = SceneConfigProvider.Instance.GetMapDataBySceneResId(m_SceneResId);

            GfxSystem.LoadScene(m_SceneConfig.m_ClientSceneFile, OnLoadFinish);
            return(result);
        }
Example #2
0
        public bool ChangeNextScene(int sceneId)
        {
            GfxSystem.PublishGfxEvent("ge_load_ui_in_game", "ui", sceneId);

            /*==========================
             * 登录场景Loading的ID为6
             * 游戏结束时跳回该场景
             */
            if (sceneId == 6)
            {
                UserInfo user = GetPlayerSelf();
                if (null != user)
                {
                    EntityManager.Instance.DestroyUserView(user.GetId());
                    DestroyCharacterById(user.GetId());
                }
                if (null != m_CurScene)
                {
                    /*
                     * if (m_CurScene.ResId == sceneId) {
                     * return true;
                     * }
                     */
                    m_CurScene.Release();
                    m_CurScene = null;
                }
                Data_SceneConfig sceneConfig = SceneConfigProvider.Instance.GetSceneConfigById(sceneId);
                GfxSystem.LoadScene(sceneConfig.m_ClientSceneFile, OnLoadFinish);
                return(true);
            }
            //==============================

            //GfxSystem.PublishGfxEvent("ge_load_ui_in_game", "ui", sceneId);

            if (null != m_CurScene)
            {
                /*
                 * if (m_CurScene.ResId == sceneId) {
                 * return true;
                 * }
                 */
                m_CurScene.Release();
                m_CurScene = null;
            }
            m_CurScene = new SceneResource();
            if (null != m_CurScene)
            {
                m_CurScene.Init(sceneId);
                if (null != m_CurScene.SceneConfig)
                {
                    Data_SceneConfig scene_config = SceneConfigProvider.Instance.GetSceneConfigById(m_CurScene.ResId);
                    m_SpatialSystem.Init(FilePathDefine_Client.C_RootPath + scene_config.m_BlockInfoFile, scene_config.m_ReachableSet);
                    m_SpatialSystem.LoadPatch(FilePathDefine_Client.C_RootPath + scene_config.m_BlockInfoFile + ".patch");
                    m_SpatialSystem.LoadObstacle(FilePathDefine_Client.C_RootPath + scene_config.m_ObstacleFile, 1 / scene_config.m_TiledDataScale);

                    LogSystem.Debug("init SpatialSystem:{0}", FilePathDefine_Client.C_RootPath + scene_config.m_BlockInfoFile);
                    LogSystem.Debug("GameSystem.ChangeNextScene:{0}", m_CurScene.ResId);
                    if (sceneId == 6)
                    {
                        UserInfo user = GetPlayerSelf();
                        if (null != user)
                        {
                            EntityManager.Instance.DestroyUserView(user.GetId());
                            DestroyCharacterById(user.GetId());
                        }
                    }
                    return(true);
                }
            }


            return(false);
        }