Browse Source

修改bug

lzx 12 hours ago
parent
commit
f22e426b35
1 changed files with 41 additions and 32 deletions
  1. 41 32
      Assets/Scripts/Core/UI/Core/UIManager.cs

+ 41 - 32
Assets/Scripts/Core/UI/Core/UIManager.cs

@@ -175,6 +175,7 @@ namespace Fort23.Mono
                 UILayers[3] = prefab.transform.GetChild(3);
                 UICamera = prefab.transform.GetComponentInChildren<Camera>();
             }
+
             current = EventSystem.current;
             Assembly assembly = Assembly.Load("Fort23.Mono");
             BackgroundPanelType = assembly.GetType(" Fort23.Mono.BackgroundPanel");
@@ -238,7 +239,7 @@ namespace Fort23.Mono
 
         public void SetEventSystemEnable(bool value)
         {
-            if(current != null)
+            if (current != null)
                 current.enabled = value;
         }
 
@@ -335,7 +336,8 @@ namespace Fort23.Mono
             _lastShowPanel.Clear();
         }
 
-        public async CTask<UIPanel> LoadAndOpenPanel(Type uipsnelType, Action<UIPanel> callback, UILayer layer = UILayer.Middle,
+        public async CTask<UIPanel> LoadAndOpenPanel(Type uipsnelType, Action<UIPanel> callback,
+            UILayer layer = UILayer.Middle,
             bool isFocus = true, object[] uiData = null, bool isShowBG = false, bool isFullUI = false,
             bool isActiveAnima = true)
         {
@@ -360,7 +362,7 @@ namespace Fort23.Mono
                 {
                     if (current != null)
                     {
-                        // current.isClose = true;
+                        SetEventSystemEnable(false);
                     }
 
 
@@ -437,7 +439,7 @@ namespace Fort23.Mono
 
                         if (current != null)
                         {
-                            // current.isClose = false;
+                            SetEventSystemEnable(true);
                         }
 
 
@@ -448,13 +450,13 @@ namespace Fort23.Mono
                         RefreshFull();
 
 
-                        if (isShowBG)
-                        {
-                            uiPanel.IsShowCustomBGPanel = true;
-                            if (!AllShowBGUIs.Contains(uiPanel))
-                                AllShowBGUIs.Add(uiPanel);
-                            await GetBackgroundPanel(uiPanel, GetLayer(layer));
-                        }
+                        // if (isShowBG)
+                        // {
+                        //     uiPanel.IsShowCustomBGPanel = true;
+                        //     if (!AllShowBGUIs.Contains(uiPanel))
+                        //         AllShowBGUIs.Add(uiPanel);
+                        //     await GetBackgroundPanel(uiPanel, GetLayer(layer));
+                        // }
 
                         return uiPanel;
                     }
@@ -462,7 +464,7 @@ namespace Fort23.Mono
                     {
                         if (current != null)
                         {
-                            // current.isClose = false;
+                            SetEventSystemEnable(true);
                         }
 
                         // 界面数据没准备好,因此本次操作将被销毁
@@ -477,7 +479,7 @@ namespace Fort23.Mono
             {
                 if (current != null)
                 {
-                    // current.isClose = false;
+                    SetEventSystemEnable(true);
                 }
 
                 LogTool.Error(uipsnelType.ToString() + "  " + e.Message);
@@ -538,6 +540,7 @@ namespace Fort23.Mono
                 {
                     if (current != null)
                     {
+                        SetEventSystemEnable(false);
                         // current.isClose = true;
                     }
 
@@ -574,6 +577,15 @@ namespace Fort23.Mono
                     }
 
                     uiPanel.isFullUI = isFullUI;
+
+                    if (isShowBG)
+                    {
+                        uiPanel.IsShowCustomBGPanel = true;
+                        if (!AllShowBGUIs.Contains(uiPanel))
+                            AllShowBGUIs.Add(uiPanel);
+                        await GetBackgroundPanel(uiPanel, GetLayer(layer));
+                    }
+
                     // 等待数据准备好才初始化UI
                     if (await uiPanel.AsyncInit(uiData))
                     {
@@ -607,15 +619,11 @@ namespace Fort23.Mono
                             NoFocusTopUIPanels.Add(uiPanel);
                         uiPanel.isActiveAnima = isActiveAnima;
                         await uiPanel.Open();
-                        // AudioManager.Instance.PlayAudio("openui.wav");
-                        // if (currOpenPanel.add)
-                        // {
-                        //     currOpenPanel = uiPanel;
-                        // }
+
 
                         if (current != null)
                         {
-                            // current.isClose = false;
+                            SetEventSystemEnable(true);
                         }
 
 
@@ -626,14 +634,14 @@ namespace Fort23.Mono
                         RefreshFull();
 
 
-                        if (isShowBG)
-                        {
-                            // await TimerComponent.Instance.WaitFrameAsync();
-                            uiPanel.IsShowCustomBGPanel = true;
-                            if (!AllShowBGUIs.Contains(uiPanel))
-                                AllShowBGUIs.Add(uiPanel);
-                            await GetBackgroundPanel(uiPanel, GetLayer(layer));
-                        }
+                        // if (isShowBG)
+                        // {
+                        //   
+                        //     uiPanel.IsShowCustomBGPanel = true;
+                        //     if (!AllShowBGUIs.Contains(uiPanel))
+                        //         AllShowBGUIs.Add(uiPanel);
+                        //     await GetBackgroundPanel(uiPanel, GetLayer(layer));
+                        // }
 
                         return uiPanel;
                     }
@@ -641,12 +649,12 @@ namespace Fort23.Mono
                     {
                         if (current != null)
                         {
-                            // current.isClose = false;
+                            SetEventSystemEnable(true);
                         }
 
                         // 界面数据没准备好,因此本次操作将被销毁
                         LogTool.Log($"数据准备失败,请检查{type.Name}的Init方法中的逻辑");
-                        // ShowTips($"数据准备失败,请检查{buildType.Name}的Init方法中的逻辑");
+
                         uiPanel.Close();
                         return null;
                     }
@@ -656,7 +664,7 @@ namespace Fort23.Mono
             {
                 if (current != null)
                 {
-                    // current.isClose = false;
+                    SetEventSystemEnable(true);
                 }
 
                 LogTool.Error(typeof(T).ToString() + "  " + e.Message);
@@ -1334,12 +1342,13 @@ namespace Fort23.Mono
             {
                 popupPanel = Instance.GetComponent(BackgroundPanelType) as UIPanel;
             }
+
             popupPanel.transform.SetParent(parent, false);
             popupPanel.transform.SetAsFirstSibling();
             int index01 = uiPanel.GObjectPoolInterface.transform.GetSiblingIndex();
             // popupPanel.transform.SetParent(parent, false);
-          
-            popupPanel.transform.SetSiblingIndex(index01-1 );
+
+            popupPanel.transform.SetSiblingIndex(index01 - 1);
             await popupPanel.Open();
 
             return popupPanel;