Browse Source

修改跳转bug

lzx 1 day ago
parent
commit
6bbb843634

+ 1 - 1
Assets/Scripts/Core/UI/Core/UIManager.cs

@@ -1071,7 +1071,7 @@ namespace Fort23.Mono
             }
 
             if (!NoFocusTopUIPanels.Contains(uiPanel)) NoFocusTopUIPanels.Remove(uiPanel);
-            uiPanel.Close();
+            await uiPanel.Close();
             RemoveTopStack(uiPanel); //如果要删除界面判断是否在跳转堆栈 如果是则移除堆栈
             switch (uiDestroyType)
             {

+ 14 - 13
Assets/Scripts/GameUI/UI/BattleSettlementPanel/BattleSettlementPanel.cs

@@ -14,8 +14,8 @@ namespace Fort23.Mono
         private System.Action callBack;
 
         List<SkipToWidget> skipToWidgets = new List<SkipToWidget>();
-        
-        LevelBattleCombatType levelBattleCombatType ;
+
+        LevelBattleCombatType levelBattleCombatType;
 
         private void Init()
         {
@@ -38,17 +38,14 @@ namespace Fort23.Mono
                 callBack?.Invoke();
                 callBack = null;
             });
-            Btn_Close2.onClick.AddListener(async() =>
+            Btn_Close2.onClick.AddListener(async () =>
             {
                 await UIManager.Instance.HideUIUIPanel(this);
                 callBack?.Invoke();
                 callBack = null;
             });
-            
-            Btn_cxtz.onClick.AddListener(() =>
-            {
-                
-            });
+
+            Btn_cxtz.onClick.AddListener(() => { });
         }
 
         public async void CustomInit(bool isWin, System.Action callBack)
@@ -73,22 +70,26 @@ namespace Fort23.Mono
                 FailRoot.SetActive(true);
                 Text_Desc1.gameObject.SetActive(false);
 
-                if (levelBattleCombatType.levelbattleConfig.ID == 1003 || levelBattleCombatType.levelbattleConfig.ID == 100004)
+                if (levelBattleCombatType.levelbattleConfig.ID == 1003 ||
+                    levelBattleCombatType.levelbattleConfig.ID == 100004)
                 {
                     if (levelBattleCombatType.levelbattleConfig.ID == 1003)
                     {
-                        SkipToWidget skipToWidget1 = await UIManager.Instance.CreateGComponentForObject<SkipToWidget>(SkipToWidgetGam, null, SkipToContent);
+                        SkipToWidget skipToWidget1 =
+                            await UIManager.Instance.CreateGComponentForObject<SkipToWidget>(SkipToWidgetGam, null,
+                                SkipToContent);
                         skipToWidget1.CustonInit(3);
                         skipToWidgets.Add(skipToWidget1);
                         skipToWidget1.OnClick = OnClick;
                     }
 
-                    SkipToWidget skipToWidget = await UIManager.Instance.CreateGComponentForObject<SkipToWidget>(SkipToWidgetGam, null, SkipToContent);
+                    SkipToWidget skipToWidget =
+                        await UIManager.Instance.CreateGComponentForObject<SkipToWidget>(SkipToWidgetGam, null,
+                            SkipToContent);
                     skipToWidget.CustonInit(1);
                     skipToWidgets.Add(skipToWidget);
                     skipToWidget.OnClick = OnClick;
                 }
-      
             }
         }
 
@@ -98,7 +99,7 @@ namespace Fort23.Mono
             await UIManager.Instance.HideUIUIPanel(this);
             callBack?.Invoke();
             callBack = null;
-            SkiptoHelper.Skipto(skipToWidget.SkiptoConfig.ID);
+            SkiptoHelper.Skipto(skipToWidget.SkiptoConfig.ID, true);
         }
 
         public static async CTask<BattleSettlementPanel> OpenPanel(bool isWin, System.Action callBack)

+ 0 - 3
Assets/Scripts/GameUI/UI/HeroInformationPanel/CaveMainPanel.cs

@@ -61,9 +61,6 @@ namespace Fort23.Mono
 
         public async override CTask Close()
         {
-            await UIManager.Instance.HideUIUIPanel<HeroInformationPanel>(isBreadcrumbBarPanel: false);
-            await UIManager.Instance.HideUIUIPanel<HeroBreakthroughPanel>(isBreadcrumbBarPanel: false);
-            await UIManager.Instance.HideUIUIPanel<SelectBreakthroughItemPanel>(isBreadcrumbBarPanel: false);
             await base.Close();
         }
     }

+ 2 - 2
Assets/Scripts/GameUI/UI/HeroInformationPanel/SelectBreakthroughItemPanel.cs

@@ -46,7 +46,7 @@ namespace Fort23.Mono
             {
                 if (!PlayerManager.Instance.BagController.IsEnough(breakthrough.itemId, 1))
                 {
-                    ItemSourcePanel.OpenPanel(itemConfig.ID);
+                    ItemSourcePanel.OpenPanel(itemConfig.ID, true);
                     return;
                 }
 
@@ -56,7 +56,7 @@ namespace Fort23.Mono
             });
             Btn_Cancel.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
 
-            Btn_Source.onClick.AddListener(() => { ItemSourcePanel.OpenPanel(itemConfig.ID); });
+            Btn_Source.onClick.AddListener(() => { ItemSourcePanel.OpenPanel(itemConfig.ID, true); });
         }
 
         public override CTask<bool> AsyncInit(object[] uiData)

+ 19 - 10
Assets/Scripts/GameUI/UI/ItemDetailsPanel/ItemSourcePanel.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using Core.Language;
 using Excel2Json;
 using Fort23.Core;
@@ -14,6 +15,7 @@ namespace Fort23.Mono
         List<SkipToWidget> skipToWidgets = new List<SkipToWidget>();
         private CTask<bool> callBack;
         private bool isSkipto = false;
+        private bool isMainPanel;
 
         private void Init()
         {
@@ -35,23 +37,23 @@ namespace Fort23.Mono
 
         public async override CTask<bool> AsyncInit(object[] uiData)
         {
-            
             foreach (var skipToWidget in skipToWidgets)
             {
                 UIManager.Instance.DormancyGComponent(skipToWidget);
             }
 
             skipToWidgets.Clear();
-            
+
             int itemId = (int)uiData[0];
             callBack = uiData[1] as CTask<bool>;
+            isMainPanel = (bool)uiData[2];
             ItemConfig itemConfig = ConfigComponent.Instance.Get<ItemConfig>(itemId);
             Text_ItemName.text = LanguageManager.Instance.Text(itemConfig.itemName);
-            
+
             WidgetItem widgetItem =
                 await UIManager.Instance.CreateGComponentForObject<WidgetItem>(WidgetItemGam, null);
-            widgetItem.InitWidget(new ItemInfo(itemId),false);
-            
+            widgetItem.InitWidget(new ItemInfo(itemId), false);
+
             Text_ItemCount.text = PlayerManager.Instance.BagController.GetItemCount(itemId).ToString();
             if (itemConfig.SkiptoID != null)
             {
@@ -76,17 +78,22 @@ namespace Fort23.Mono
                 TipMessagePanel.OpenTipMessagePanel(SkiptoHelper.SkiptoTips(skipToWidget.SkiptoConfig.ID));
                 return;
             }
+
             isSkipto = true;
-            await UIManager.Instance.HideUIUIPanel(this);
-            
-            SkiptoHelper.Skipto(skipToWidget.SkiptoConfig.ID);
+             await UIManager.Instance.HideUIUIPanel(this);
+
+        
+
+
+            await SkiptoHelper.Skipto(skipToWidget.SkiptoConfig.ID,isMainPanel);
+            callBack?.SetResult(isSkipto);
         }
 
-        public static async CTask<bool> OpenPanel(int itemId)
+        public static async CTask<bool> OpenPanel(int itemId, bool isMainPanel = false)
         {
             CTask<bool> callBack = CTask<bool>.Create();
             await UIManager.Instance.LoadAndOpenPanel<ItemSourcePanel>(null, UILayer.Top,
-                uiData: new object[] { itemId, callBack }, isShowBG: true);
+                uiData: new object[] { itemId, callBack, isMainPanel }, isShowBG: true);
             return await callBack;
         }
 
@@ -98,9 +105,11 @@ namespace Fort23.Mono
             }
 
             skipToWidgets.Clear();
+
             callBack?.SetResult(isSkipto);
             isSkipto = false;
 
+
             await base.Close();
         }
     }

+ 19 - 1
Assets/Scripts/GameUI/Utility/SkiptoHelper.cs

@@ -9,7 +9,7 @@ namespace Mono.Utility
 {
     public static class SkiptoHelper
     {
-        public async static CTask Skipto(int skiptoId)
+        public async static CTask Skipto(int skiptoId,bool isMainOpen = false)
         {
             SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
 
@@ -21,6 +21,24 @@ namespace Mono.Utility
                 }
             }
 
+            if (isMainOpen)
+            {
+                List<UIPanel> TopUIPanels = UIManager.Instance.TopUIPanels.ToList();
+                for (var i = TopUIPanels.Count - 1; i >= 0; i--)
+                {
+                    if (!(TopUIPanels[i] is MainPanel))
+                    {
+                        await UIManager.Instance.HideUIUIPanel(TopUIPanels[i], isBreadcrumbBarPanel: false);
+                    }
+                }
+                await MainPanel.OpenPanel();
+            }
+        
+
+
+        
+            
+
             switch (skiptoConfig.SkipID)
             {
                 //不跳转