示例#1
0
        internal void IndoorSceneLoaded(IndoorSceneRoot root)
        {
            Int32 num = m_indoorScenes.FindIndex((IndoorCache a) => a.Key == root.SceneName);

            if (num == -1)
            {
                String text = "IndoorScene name is invalid '" + root.SceneName + "'";
                foreach (IndoorCache indoorCache in m_indoorScenes)
                {
                    if (indoorCache.IsLoading)
                    {
                        text = text + "\n expected '" + indoorCache.Key + "' ?";
                    }
                }
                Debug.LogError(text);
                Destroy(root.gameObject);
                return;
            }
            root.transform.position = new Vector3(0f, -2000f, 0f);
            root.gameObject.SetActive(false);
            m_indoorScenes[num] = new IndoorCache(root.SceneName, root, false);
            if (m_lastRequest == root.SceneName)
            {
                LoadingScene = null;
                m_loads      = null;
                if (FinishLoadIndoorScene != null)
                {
                    FinishLoadIndoorScene(this, new FinishLoadIndoorSceneEventArgs(root));
                }
            }
            else
            {
                RequestIndoorScene(m_lastRequest);
            }
        }
示例#2
0
        public void RequestIndoorScene(String sceneName)
        {
            m_lastRequest = sceneName;
            if (LoadingScene != null)
            {
                return;
            }
            Int32       num         = m_indoorScenes.FindIndex((IndoorCache a) => a.Key == sceneName);
            IndoorCache indoorCache = default(IndoorCache);

            if (num >= 0)
            {
                indoorCache = m_indoorScenes[num];
            }
            else if (m_indoorScenes.Count >= 1)
            {
                IndoorSceneRoot rootScene = m_indoorScenes[0].RootScene;
                Helper.DestroyGO <IndoorSceneRoot>(ref rootScene);
                Resources.UnloadUnusedAssets();
                m_indoorScenes.RemoveAt(0);
            }
            if (!indoorCache.IsLoading && indoorCache.RootScene == null)
            {
                if (num >= 0)
                {
                    m_indoorScenes[num] = new IndoorCache(sceneName, null, true);
                }
                else
                {
                    m_indoorScenes.Add(new IndoorCache(sceneName, null, true));
                }
                SceneRequest sceneRequest = null;
                if (LegacyLogic.Instance.ModController.InModMode)
                {
                    sceneRequest = AssetBundleManagers.Instance.Mod.RequestScene(sceneName, 10, new SceneRequestCallback(OnSceneBundleLoaded), null);
                }
                if (sceneRequest == null)
                {
                    sceneRequest = AssetBundleManagers.Instance.Main.RequestScene(sceneName, 10, new SceneRequestCallback(OnSceneBundleLoaded), null);
                }
                if (sceneRequest == null)
                {
                    Debug.LogError("Fail load indoor scene '" + sceneName + "'");
                }
                LoadingScene = sceneName;
            }
            else if (FinishLoadIndoorScene != null && indoorCache.RootScene != null)
            {
                FinishLoadIndoorScene(this, new FinishLoadIndoorSceneEventArgs(indoorCache.RootScene));
            }
        }