Exemplo n.º 1
0
 // Token: 0x060006D8 RID: 1752 RVA: 0x0001FA3C File Offset: 0x0001DC3C
 public void FreeLayer(SceneLayerBase layer)
 {
     if (layer == null)
     {
         return;
     }
     if (layer.State == SceneLayerBase.LayerState.Loading)
     {
         layer.State = SceneLayerBase.LayerState.WaitForFree;
         return;
     }
     if (layer.State == SceneLayerBase.LayerState.InStack)
     {
         this.PopLayer(layer);
         if (layer.IsReserve())
         {
             return;
         }
     }
     this.m_layerDict.Remove(layer.LayerName);
     this.m_unusedLayerList.Remove(layer);
     this.m_loadingLayerList.Remove(layer);
     if (layer.GetType() != typeof(UnitySceneLayer))
     {
         UnityEngine.Object.Destroy(layer.gameObject);
     }
     else
     {
         UnitySceneLayer unitySceneLayer = layer as UnitySceneLayer;
         SceneManager.UnloadSceneAsync(unitySceneLayer.Scene);
     }
 }
Exemplo n.º 2
0
        // Token: 0x060006D4 RID: 1748 RVA: 0x0001F780 File Offset: 0x0001D980
        public void CreateLayer(Type layerType, string name, string resPath, Action <SceneLayerBase> onComplete, bool enableReserve = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new Exception("CreateLayer need a name");
            }
            if (!this.m_enableLayerReserve)
            {
                enableReserve = false;
            }
            SceneLayerBase sceneLayerBase = this.FindLayerByName(name);

            if (sceneLayerBase != null)
            {
                if (sceneLayerBase.IsReserve() && sceneLayerBase.State == SceneLayerBase.LayerState.Unused)
                {
                    onComplete(sceneLayerBase);
                }
                else
                {
                    onComplete(null);
                }
                return;
            }
            if (this.m_layerDict.ContainsKey(name))
            {
                throw new Exception(string.Format("CreateLayer name conflict {0}", name));
            }
            if (layerType == typeof(UISceneLayer))
            {
                this.CreateUILayer(name, resPath, onComplete, enableReserve);
            }
            else if (layerType == typeof(ThreeDSceneLayer))
            {
                this.Create3DLayer(name, resPath, onComplete, enableReserve);
            }
            else if (layerType == typeof(UnitySceneLayer))
            {
                this.CreateUnitySceneLayer(name, resPath, onComplete);
            }
        }