Pārlūkot izejas kodu

左右切换开发

liao 4 mēneši atpakaļ
vecāks
revīzija
c98659fbb3

+ 31 - 13
Assets/Res/UI/HeroDetailPanel.prefab

@@ -7295,7 +7295,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &7655727355699048888
 RectTransform:
   m_ObjectHideFlags: 0
@@ -8865,9 +8865,9 @@ RectTransform:
   - {fileID: 3875893009412036452}
   m_Father: {fileID: 2920983210776913852}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 50, y: -96.6}
   m_SizeDelta: {x: 100, y: 100}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &4515796977380946822
@@ -9163,7 +9163,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &8494072435471062741
 RectTransform:
   m_ObjectHideFlags: 0
@@ -9459,9 +9459,9 @@ RectTransform:
   - {fileID: 2714858469072854325}
   m_Father: {fileID: 2920983210776913852}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 50, y: -143.2}
   m_SizeDelta: {x: 100, y: 100}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &4970468942560128240
@@ -10141,9 +10141,9 @@ RectTransform:
   - {fileID: 6378568511483276108}
   m_Father: {fileID: 2920983210776913852}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 50, y: -50}
   m_SizeDelta: {x: 100, y: 100}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &5188900526901306069
@@ -12959,6 +12959,24 @@ MonoBehaviour:
     - gameObject: {fileID: 386705721927191908}
     - gameObject: {fileID: 3414719560540881468}
     - gameObject: {fileID: 6905440077724744462}
+  - key: btnPrev
+    gameObject: {fileID: 401365577565536026}
+    isAssetBundle: 0
+    isList: 0
+    ListCollectorDatas:
+    - gameObject: {fileID: 2431497390631250942}
+    - gameObject: {fileID: 386705721927191908}
+    - gameObject: {fileID: 3414719560540881468}
+    - gameObject: {fileID: 6905440077724744462}
+  - key: btnNext
+    gameObject: {fileID: 1045051597510447301}
+    isAssetBundle: 0
+    isList: 0
+    ListCollectorDatas:
+    - gameObject: {fileID: 2431497390631250942}
+    - gameObject: {fileID: 386705721927191908}
+    - gameObject: {fileID: 3414719560540881468}
+    - gameObject: {fileID: 6905440077724744462}
   isAssetBundle: 1
 --- !u!225 &4187952801782332659
 CanvasGroup:
@@ -12986,7 +13004,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   maxDuration: 0.2
   isUpdate: 0
-  currTime: 0.34208518
+  currTime: 0.2
   GrpupInfos:
   - Foldout: 1
     isActive: 1
@@ -17714,7 +17732,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &6531592034564531019
 RectTransform:
   m_ObjectHideFlags: 0

+ 3 - 2
Assets/Res/UI/HeroUpTxtEft.prefab

@@ -78,8 +78,8 @@ MonoBehaviour:
   m_fontMaterials: []
   m_fontColor32:
     serializedVersion: 2
-    rgba: 4294967295
-  m_fontColor: {r: 1, g: 1, b: 1, a: 1}
+    rgba: 4281007872
+  m_fontColor: {r: 0, g: 1, b: 0.16342616, a: 1}
   m_enableVertexGradient: 0
   m_colorMode: 3
   m_fontColorGradient:
@@ -176,6 +176,7 @@ MonoBehaviour:
   - Foldout: 1
     isActive: 1
     animName: show
+    isLoop: 0
     allTargets:
     - {fileID: 5135952974914396357}
     - {fileID: 4501378206774687333}

+ 3 - 3
Assets/Res/UIAnimRes/TweenAssetInfoHeroUpTxtEft.asset

@@ -13,12 +13,12 @@ MonoBehaviour:
   m_Name: TweenAssetInfoHeroUpTxtEft
   m_EditorClassIdentifier: 
   allTweenInfo:
-  - Foldout: 1
+  - Foldout: 0
     TweenType: 0
     duration: 0.5
     delay: 0
     TweenBasic:
-      Foldout: 1
+      Foldout: 0
       duration: 0.5
       delay: 0
       currSchedule: 0
@@ -148,7 +148,7 @@ MonoBehaviour:
         m_PreInfinity: 2
         m_PostInfinity: 2
         m_RotationOrder: 4
-  - Foldout: 1
+  - Foldout: 0
     TweenType: 1
     duration: 0.5
     delay: 0

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

@@ -417,6 +417,7 @@ namespace Fort23.Mono
                             NoFocusTopUIPanels.Add(uiPanel);
                         uiPanel.isActiveAnima = isActiveAnima;
                         await uiPanel.Open();
+                        currOpenPanel = uiPanel;
                         
                         if (current != null)
                         {

+ 0 - 2
Assets/Scripts/Core/UI/UTool/Enum.cs

@@ -1,7 +1,5 @@
 namespace Fort23.UTool
 {
-
-
     /// <summary>
     /// 英雄提升结果的类型(各种情况)
     /// </summary>

+ 1 - 2
Assets/Scripts/GameUI/UI/Hero/HeroBagPanel.cs

@@ -56,7 +56,7 @@ namespace Fort23.Mono
             UpdateMainLv();
 
         }
-        private List<WidgetHero> widgetHeroes = new List<WidgetHero>();
+        public List<WidgetHero> widgetHeroes = new List<WidgetHero>();
         private async void InitMainHeroWidget()
         {
             widgetHeroes.Clear();
@@ -72,6 +72,5 @@ namespace Fort23.Mono
                 i++;
             }
         }
-
     }
 }

+ 50 - 12
Assets/Scripts/GameUI/UI/Hero/HeroDetailPanel.cs

@@ -39,6 +39,47 @@ namespace Fort23.Mono
             btnUpgrade.onClick.AddListener(OnClickUpgrade);
             btnPromote.onClick.AddListener(OnClickPromote);
             btnSkill.onClick.AddListener(OnClickSkill);
+            btnPrev.onClick.AddListener(OnclickPrevHero);
+            btnNext.onClick.AddListener(OnclickNextHero);
+        }
+
+        private void OnclickPrevHero()
+        {
+            if (sourcePanel == null)
+            {
+                LogTool.Error("打开英雄界面的上个一个UIPanel未知");
+                return;
+            }
+            if (sourcePanel is HeroBagPanel)
+            {
+                HeroBagPanel heroBagPanel = (HeroBagPanel)sourcePanel;
+                HeroUITools.GetCloseHero(heroBagPanel.widgetHeroes, heroWidget, false);
+            }
+        }
+
+        private void OnclickNextHero()
+        {
+
+        }
+
+        public void SwitchHero(bool isNext)
+        {
+            if (sourcePanel == null)
+            {
+                LogTool.Error("打开英雄界面的上个一个UIPanel未知");
+                return;
+            }
+            if (sourcePanel is HeroBagPanel)
+            {
+                HeroBagPanel heroBagPanel = (HeroBagPanel)sourcePanel;
+                HeroUITools.GetCloseHero(heroBagPanel.widgetHeroes, heroWidget, isNext);
+            }
+
+            if (sourcePanel is MainUIPanel)
+            {
+                MainUIPanel mainUIPanel = (MainUIPanel)sourcePanel;
+            }
+            
         }
 
         public SkillUIComponent skillUIComponent;
@@ -70,11 +111,11 @@ namespace Fort23.Mono
             }
             else
             {
-                await UIManager.Instance.CreateGComponentForObject<HeroPowerUpPre>(objHeroPowerUpPre, Callback, root: rtBottom);    
+                await UIManager.Instance.CreateGComponentForObject<HeroPowerUpPre>(objHeroPowerUpPre, OpenPreUICallback, root: rtBottom);    
             }
         }
 
-        private async void Callback(HeroPowerUpPre pre)
+        private async void OpenPreUICallback(HeroPowerUpPre pre)
         {
             upPre = pre;
             pre.OpenPromotePre(heroInfo);
@@ -191,8 +232,6 @@ namespace Fort23.Mono
             curPreTyp = preTyp;
             btns1.SetActive(false);
             
-
-            
             if (preTyp == 1)
             {
                 btnPromote.gameObject.SetActive(false);
@@ -222,9 +261,6 @@ namespace Fort23.Mono
             }
         }
         
-        
-
-        
         /// <summary>
         /// 离开 升级/升星预览界面
         /// </summary>
@@ -272,11 +308,16 @@ namespace Fort23.Mono
             }
         }
 
+        public WidgetHero heroWidget;
+        public UIPanel sourcePanel;
+        
         private GameObjectPool modelObj;
         HeroPowerUpPre upPre;
-        public async void InitHeroDetailPanel(HeroInfo heroInfo)
+        public async void InitHeroDetailPanel(WidgetHero heroWidget, UIPanel sourcePanel = null)
         {
-            this.heroInfo = heroInfo;
+            this.heroInfo = heroWidget.heroInfo;
+            this.heroWidget = heroWidget;
+            this.sourcePanel = sourcePanel;
             
             btns1.SetActive(true);
             objHeroPowerUpPre.SetActive(false);
@@ -296,10 +337,7 @@ namespace Fort23.Mono
             // StarsLayout.GetComponent<LayoutGroup>().s
             // StarsLayout.GetComponent<LayoutGroup>().SetDirty();
             // LayoutRebuilder.ForceRebuildLayoutImmediate(StarsLayout.GetComponent<RectTransform>());
-
             
-            
-
             // GameObjectPool poolInterface =
             //     await GObjectPool.Instance.FetchAsync<GameObjectPool>(heroInfo.modelConfig.model + ".prefab", null);
             

+ 22 - 0
Assets/Scripts/GameUI/UI/Hero/HeroDetailPanelData.cs

@@ -329,6 +329,28 @@ namespace Fort23.Mono
 	      return _StarsObj;
 	     }
 	   }
+	  private Button _btnPrev;
+	  public Button btnPrev
+	   {
+	   get{
+	      if (_btnPrev == null)
+	       {
+	         _btnPrev  = GetUIUnit<Button>("btnPrev"); 
+	       }
+	      return _btnPrev;
+	     }
+	   }
+	  private Button _btnNext;
+	  public Button btnNext
+	   {
+	   get{
+	      if (_btnNext == null)
+	       {
+	         _btnNext  = GetUIUnit<Button>("btnNext"); 
+	       }
+	      return _btnNext;
+	     }
+	   }
 	  #endregion 自定义数据结束 
 	 public override async CTask SetUIGameObject(GameObject gObjectPoolInterface)
 	{

+ 14 - 0
Assets/Scripts/GameUI/UI/Hero/HeroUITools.cs

@@ -14,7 +14,21 @@ namespace Fort23.Mono
         
         
         
+        public static WidgetHero GetCloseHero(List<WidgetHero> widgetHeroes, WidgetHero widgetHero, bool isNext)
+        {
+            int idx = widgetHeroes.IndexOf(widgetHero);
+
+            if (isNext && idx < widgetHeroes.Count - 1)
+            {
+                return widgetHeroes[idx + 1];
+            }
 
+            if (!isNext && idx > 0)
+            {
+                return widgetHeroes[idx - 1];
+            }
+            return null;
+        }
         
         
         /// <summary>

+ 1 - 1
Assets/Scripts/GameUI/UI/Hero/WidgetHero.cs

@@ -161,7 +161,7 @@ namespace Fort23.Mono
             // }
             HeroDetailPanel heroDetailPanel =
                 await UIManager.Instance.LoadAndOpenPanel<HeroDetailPanel>(Callback, isFullUI: true);
-            heroDetailPanel.InitHeroDetailPanel(heroInfo);
+            heroDetailPanel.InitHeroDetailPanel(this, UIManager.Instance.currOpenPanel);
         }
 
         private void Callback(HeroDetailPanel obj)