瀏覽代碼

Merge branch 'master' of http://192.168.123.2:3000/fort23/XY001

# Conflicts:
#	Assets/Scripts/GameUI/Fort23.Mono.asmdef   resolved by master version
DESKTOP-FB72PO8\Administrator 4 月之前
父節點
當前提交
4fa4396a47

+ 51 - 4
Assets/Res/UI/HeroDetailPanel.prefab

@@ -1199,7 +1199,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!4 &392410444561528066
 Transform:
   m_ObjectHideFlags: 0
@@ -2138,6 +2138,7 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
+  - {fileID: 6940070218244924220}
   - {fileID: 7318964256824165206}
   - {fileID: 392410444561528066}
   - {fileID: 6531592034564531019}
@@ -3585,6 +3586,42 @@ MonoBehaviour:
   m_FillOrigin: 0
   m_UseSpriteMesh: 0
   m_PixelsPerUnitMultiplier: 1
+--- !u!1 &2730325149181337415
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 7
+  m_Component:
+  - component: {fileID: 6940070218244924220}
+  m_Layer: 0
+  m_HasEditorInfo: 1
+  m_Name: ModelPos
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &6940070218244924220
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2730325149181337415}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: -400}
+  m_LocalScale: {x: 100, y: 100, z: 100}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 6190678789095275899}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0.5, y: 0.5}
+  m_AnchorMax: {x: 0.5, y: 0.5}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 100, y: 100}
+  m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &2740027711637496052
 GameObject:
   m_ObjectHideFlags: 0
@@ -5226,7 +5263,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_text: 10/10
+  m_text: <color=#FF4C4C>10</color>/10
   m_isRightToLeft: 0
   m_fontAsset: {fileID: 11400000, guid: 1b5c9a7370e424d53a1b8a999cf54a02, type: 2}
   m_sharedMaterial: {fileID: 7512481295523713106, guid: 1b5c9a7370e424d53a1b8a999cf54a02, type: 2}
@@ -5414,7 +5451,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &7655727355699048888
 RectTransform:
   m_ObjectHideFlags: 0
@@ -9195,6 +9232,16 @@ MonoBehaviour:
     - gameObject: {fileID: 2983232722897563720}
     - gameObject: {fileID: 7900421520403642917}
     - gameObject: {fileID: 1181932463234986561}
+  - key: ModelPos
+    gameObject: {fileID: 6940070218244924220}
+    isAssetBundle: 0
+    isList: 0
+    ListCollectorDatas:
+    - gameObject: {fileID: 9043530873077291103}
+    - gameObject: {fileID: 7786295750093721047}
+    - gameObject: {fileID: 2983232722897563720}
+    - gameObject: {fileID: 7900421520403642917}
+    - gameObject: {fileID: 1181932463234986561}
   isAssetBundle: 1
 --- !u!1 &6353668298983276286
 GameObject:
@@ -12671,7 +12718,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &6531592034564531019
 RectTransform:
   m_ObjectHideFlags: 0

文件差異過大導致無法顯示
+ 1029 - 7040
Assets/Scenes/UITest.scene


+ 37 - 1
Assets/Scripts/GameUI/UI/Hero/HeroDetailPanel.cs

@@ -1,3 +1,5 @@
+using Animancer;
+using Animancer.TransitionLibraries;
 using Common.Utility.CombatEvent;
 using Core.Language;
 using Core.Utility;
@@ -7,6 +9,7 @@ using Fort23.UTool;
 using GameLogic.Bag;
 using GameLogic.Hero;
 using UnityEngine;
+using UnityEngine.AI;
 using UnityEngine.UI;
 using Utility;
 
@@ -98,15 +101,48 @@ namespace Fort23.Mono
         private void OnClickClose()
         {
             UIManager.Instance.HideUIUIPanel(this);
+            GObjectPool.Instance.Recycle(modelObj);
         }
 
-        public void InitHeroDetailPanel(HeroInfo heroInfo)
+        private GameObjectPool modelObj;
+        public async void InitHeroDetailPanel(HeroInfo heroInfo)
         {
             this.heroInfo = heroInfo;
             iconZhiYe.icon_name = heroInfo.iconZhiYe;
             heroName.text = LanguageManager.Instance.Text(heroInfo.modelConfig.name);
             HeroUITools.SetStarShow(stars, heroInfo.star.Value);
 
+            // GameObjectPool poolInterface =
+            //     await GObjectPool.Instance.FetchAsync<GameObjectPool>(heroInfo.modelConfig.model + ".prefab", null);
+            
+            modelObj = await GObjectPool.Instance.FetchAsync<GameObjectPool>(heroInfo.modelConfig.model + ".prefab",
+                delegate(GameObjectPool pool)
+                {
+                    pool.own.GetComponent<NavMeshAgent>().enabled = false;
+                    pool.own.transform.parent = ModelPos;
+                    pool.own.transform.localEulerAngles = new Vector3(0, 180, 0);
+                    pool.own.transform.localPosition = new Vector3(0, 0.2f, 0);
+
+                    AnimancerComponent animancerComponent = pool.own.GetComponent<AnimancerComponent>();
+                    
+                    int max = animancerComponent.Transitions.Library.Count;
+                    for (int i = 0; i < max; i++)
+                    {
+                        if (animancerComponent.Transitions.Library.TryGetTransition(i,
+                                out TransitionModifierGroup transition))
+                        {
+                            TransitionAsset clipTransition2 = transition.Transition as TransitionAsset;
+                            if (clipTransition2 != null && clipTransition2.name == "idle")
+                            {
+                                animancerComponent.Play(clipTransition2);
+                                break;
+                            }
+                        }
+                    }
+                    HeroUITools.ChangeLayerRecursively(pool.own, LayerMask.NameToLayer("UI"));
+                    
+                });
+
             switch (heroInfo.modelConfig.rarity)
             {
                 case 1:

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

@@ -230,6 +230,17 @@ namespace Fort23.Mono
 	      return _btnPromote;
 	     }
 	   }
+	  private RectTransform _ModelPos;
+	  public RectTransform ModelPos
+	   {
+	   get{
+	      if (_ModelPos == null)
+	       {
+	         _ModelPos  = GetUIUnit<RectTransform>("ModelPos"); 
+	       }
+	      return _ModelPos;
+	     }
+	   }
 	  #endregion 自定义数据结束 
 	 public override async CTask SetUIGameObject(GameObject gObjectPoolInterface)
 	{

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

@@ -57,5 +57,24 @@ namespace Fort23.Mono
             }
         }
         
+        /// <summary>
+        /// 修改指定 GameObject 和其所有子对象的 Layer
+        /// </summary>
+        /// <param name="obj">目标 GameObject</param>
+        /// <param name="newLayer">新的 Layer 值</param>
+        public static void ChangeLayerRecursively(GameObject obj, int newLayer)
+        {
+            if (obj == null || obj.layer == newLayer) return;
+
+            // 修改当前对象的 Layer
+            obj.layer = newLayer;
+
+            // 遍历所有子对象,递归修改
+            foreach (Transform child in obj.transform)
+            {
+                ChangeLayerRecursively(child.gameObject, newLayer);
+            }
+        }
+        
     }
 }

部分文件因文件數量過多而無法顯示