Example #1
0
 // Token: 0x060006D9 RID: 1753 RVA: 0x0001FAF0 File Offset: 0x0001DCF0
 public bool PushLayer(SceneLayerBase layer)
 {
     if (layer.State != SceneLayerBase.LayerState.Unused)
     {
         global::Debug.LogError(string.Format("PushLayer in wrong state layer={0} state={1}", layer.name, layer.State));
         return(false);
     }
     this.m_unusedLayerList.Remove(layer);
     this.m_layerStack.Add(layer);
     layer.State = SceneLayerBase.LayerState.InStack;
     if (layer.GetType() == typeof(UISceneLayer))
     {
         layer.transform.SetParent(this.m_uiSceneGroup1RootCanvasGo.transform, false);
     }
     else if (layer.GetType() == typeof(ThreeDSceneLayer))
     {
         layer.transform.SetParent(this.m_3DSceneRootGo.transform, false);
     }
     else if (layer.GetType() == typeof(UnitySceneLayer))
     {
     }
     if (layer.GetType() != typeof(UnitySceneLayer))
     {
         layer.gameObject.SetActive(true);
     }
     this.m_stackDirty = true;
     return(true);
 }
Example #2
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);
     }
 }
Example #3
0
 // Token: 0x060006E3 RID: 1763 RVA: 0x000201EC File Offset: 0x0001E3EC
 private void SortLayerStack(List <SceneLayerBase> layerStack)
 {
     for (int i = 1; i < layerStack.Count; i++)
     {
         int            num            = i;
         SceneLayerBase sceneLayerBase = layerStack[i];
         while (num > 0 && !sceneLayerBase.IsStayOnTop() && layerStack[num - 1].IsStayOnTop())
         {
             layerStack[num] = layerStack[num - 1];
             num--;
         }
         layerStack[num] = sceneLayerBase;
     }
 }
Example #4
0
 // Token: 0x060006DD RID: 1757 RVA: 0x0001FCDC File Offset: 0x0001DEDC
 private void AddLayerToLoading(SceneLayerBase layer)
 {
     if (layer.GetType() == typeof(UnitySceneLayer))
     {
         return;
     }
     layer.gameObject.transform.SetParent(this.m_loadingLayerRootGo.transform, false);
     layer.gameObject.transform.localPosition = Vector3.zero;
     layer.gameObject.transform.localScale    = Vector3.one;
     layer.gameObject.transform.localRotation = Quaternion.identity;
     layer.gameObject.SetActive(false);
     this.m_loadingLayerList.Add(layer);
     layer.State = SceneLayerBase.LayerState.Loading;
 }
Example #5
0
        // Token: 0x060006E0 RID: 1760 RVA: 0x0001FE3C File Offset: 0x0001E03C
        private void OnLayerLoadAssetComplete(SceneLayerBase layer, GameObject asset)
        {
            if (layer.GetType() == typeof(UnitySceneLayer))
            {
                return;
            }
            if (asset == null)
            {
                global::Debug.LogError(string.Format("CreateUILayer LoadAsset fail name={0}", layer.LayerName));
                this.FreeLayer(layer);
                return;
            }
            GameObject go = UnityEngine.Object.Instantiate <GameObject>(asset);

            Util.RemoveCloneFromGameObjectName(go);
            layer.AttachGameObject(go);
            this.AddLayerToUnused(layer);
        }
Example #6
0
 // Token: 0x060006DA RID: 1754 RVA: 0x0001FBF0 File Offset: 0x0001DDF0
 public void PopLayer(SceneLayerBase layer)
 {
     if (layer.State != SceneLayerBase.LayerState.InStack)
     {
         global::Debug.LogError(string.Format("PopLayer in wrong state layer={0} state={1}", layer.name, layer.State));
         return;
     }
     if (layer.GetType() != typeof(UnitySceneLayer))
     {
         layer.gameObject.SetActive(false);
     }
     this.m_layerStack.Remove(layer);
     this.m_unusedLayerList.Add(layer);
     if (layer.GetType() != typeof(UnitySceneLayer))
     {
         layer.gameObject.transform.SetParent(this.m_unusedLayerRootGo.transform, false);
     }
     layer.State       = SceneLayerBase.LayerState.Unused;
     this.m_stackDirty = true;
 }
Example #7
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);
            }
        }
Example #8
0
        // Token: 0x060006E2 RID: 1762 RVA: 0x0001FEB8 File Offset: 0x0001E0B8
        private void UpdateLayerStack()
        {
            if (!this.m_stackDirty)
            {
                return;
            }
            this.m_stackDirty = false;
            this.SortLayerStack(this.m_layerStack);
            bool            flag            = false;
            int             num             = SceneManager.m_cameraDepthMax;
            Vector3         vector          = Vector3.zero;
            UnitySceneLayer unitySceneLayer = null;

            this.m_uiSceneGroup2RootCanvasGo.SetActive(false);
            for (int i = this.m_layerStack.Count - 1; i >= 0; i--)
            {
                SceneLayerBase sceneLayerBase = this.m_layerStack[i];
                if (sceneLayerBase.GetType() == typeof(UISceneLayer))
                {
                    if (!flag)
                    {
                        sceneLayerBase.gameObject.transform.SetParent(this.m_uiSceneGroup1RootCanvasGo.transform, false);
                        sceneLayerBase.gameObject.transform.localPosition = Vector3.zero;
                        sceneLayerBase.gameObject.transform.localScale    = Vector3.one;
                        sceneLayerBase.gameObject.transform.SetAsFirstSibling();
                        sceneLayerBase.LayerCamera.depth = (float)num;
                    }
                    else
                    {
                        if (!this.m_uiSceneGroup2RootCanvasGo.activeSelf)
                        {
                            this.m_uiSceneGroup2RootCanvasGo.SetActive(true);
                        }
                        sceneLayerBase.gameObject.transform.SetParent(this.m_uiSceneGroup2RootCanvasGo.transform, false);
                        sceneLayerBase.gameObject.transform.localPosition = Vector3.zero;
                        sceneLayerBase.gameObject.transform.SetAsFirstSibling();
                        sceneLayerBase.LayerCamera.depth = (float)num;
                    }
                }
                else if (sceneLayerBase.GetType() == typeof(ThreeDSceneLayer))
                {
                    sceneLayerBase.gameObject.transform.SetParent(this.m_3DSceneRootGo.transform, false);
                    sceneLayerBase.gameObject.transform.localPosition = vector;
                    vector += this.m_layerOffset;
                    sceneLayerBase.LayerCamera.depth = (float)(--num);
                    num--;
                    MonoBehaviour monoBehaviour = sceneLayerBase.LayerCamera.gameObject.GetComponent("UnityStandardAssets.ImageEffects.BlurOptimized") as MonoBehaviour;
                    if (monoBehaviour != null)
                    {
                        monoBehaviour.enabled = this.m_is3DLayerBlurActive;
                    }
                    flag = true;
                }
                else
                {
                    unitySceneLayer = ((!(unitySceneLayer == null)) ? unitySceneLayer : ((UnitySceneLayer)sceneLayerBase));
                    sceneLayerBase.LayerCamera.depth = (float)(--num);
                    num--;
                    flag = true;
                }
            }
            bool flag2 = false;
            LayerRenderSettingDesc layerRenderSettingDesc = null;

            for (int j = this.m_layerStack.Count - 1; j >= 0; j--)
            {
                SceneLayerBase sceneLayerBase2 = this.m_layerStack[j];
                layerRenderSettingDesc = ((!(layerRenderSettingDesc == null)) ? layerRenderSettingDesc : sceneLayerBase2.GetRenderSetting());
                if (!flag2)
                {
                    sceneLayerBase2.gameObject.SetActive(true);
                }
                else
                {
                    sceneLayerBase2.gameObject.SetActive(false);
                }
                if (sceneLayerBase2.IsOpaque() && sceneLayerBase2.IsFullScreen())
                {
                    flag2 = true;
                }
            }
            if (layerRenderSettingDesc == null)
            {
                layerRenderSettingDesc = this.GetDefaultRenderSetting();
            }
            if (unitySceneLayer != null)
            {
                if (SceneManager.GetActiveScene() != unitySceneLayer.Scene)
                {
                    SceneManager.SetActiveScene(unitySceneLayer.Scene);
                }
            }
            else
            {
                this.ApplyRenderSetting(layerRenderSettingDesc);
            }
        }