diff --git a/Assets/Art/UIPrefab/UIBody3DMenuTree.prefab b/Assets/Art/UIPrefab/UIBody3DMenuTree.prefab index 4d98f5d9..2d8809e2 100644 --- a/Assets/Art/UIPrefab/UIBody3DMenuTree.prefab +++ b/Assets/Art/UIPrefab/UIBody3DMenuTree.prefab @@ -618,7 +618,7 @@ GameObject: - component: {fileID: 4241166032354527677} - component: {fileID: 5435028851309332385} m_Layer: 0 - m_Name: Background + m_Name: Bg m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -637,6 +637,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6328242271330880581} + - {fileID: 5894363737722245234} m_Father: {fileID: 251803197481128702} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} @@ -911,6 +912,81 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 0 +--- !u!1 &6026612945988023146 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5894363737722245234} + - component: {fileID: 4513527160489183252} + - component: {fileID: 6563839704117627199} + m_Layer: 0 + m_Name: half + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5894363737722245234 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6026612945988023146} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7840789038907519404} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -6, y: -6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4513527160489183252 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6026612945988023146} + m_CullTransparentMesh: 1 +--- !u!114 &6563839704117627199 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6026612945988023146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &6242602124528966384 GameObject: m_ObjectHideFlags: 0 @@ -1060,7 +1136,7 @@ GameObject: - component: {fileID: 5822037825308611511} - component: {fileID: 8829331589693888189} m_Layer: 0 - m_Name: Checkmark + m_Name: Fg m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scripts/UI/UIBody3DInfo.cs b/Assets/Scripts/UI/UIBody3DInfo.cs index c55bab14..9cd81f03 100644 --- a/Assets/Scripts/UI/UIBody3DInfo.cs +++ b/Assets/Scripts/UI/UIBody3DInfo.cs @@ -140,7 +140,7 @@ namespace QFramework.Example public void ListItemFacotry(Body3D.Body body) { GameObject obj = GameObject.Instantiate(ListItem.gameObject, ListContent); - obj.transform.Find("Label").GetComponent().text = body.Name; + obj.transform.Find("Label").GetComponent().text = body.Name + ">"; obj.transform.SetAsFirstSibling(); if (body.parent != null) { diff --git a/Assets/Scripts/UI/UIBody3DMenuTree.cs b/Assets/Scripts/UI/UIBody3DMenuTree.cs index 367344f9..21c46ce6 100644 --- a/Assets/Scripts/UI/UIBody3DMenuTree.cs +++ b/Assets/Scripts/UI/UIBody3DMenuTree.cs @@ -13,7 +13,10 @@ namespace QFramework.Example public partial class UIBody3DMenuTree : UIPanel { - + /// + /// 搜索结果按钮与菜单按钮的对应 + /// + Dictionary searchItemMap = new Dictionary(); protected override void OnInit(IUIData uiData = null) { // please add init code here @@ -141,8 +144,8 @@ namespace QFramework.Example private void RefreshSearchContent(string str) { // 清空SearchContent下的所有子物体 + searchItemMap.Clear(); SearchContent.RemoveAllChildren(); - // 递归检查子物体的子物体 CheckChildren(Content, str); @@ -168,17 +171,23 @@ namespace QFramework.Example { // 复制该子物体到 SearchContent 中 GameObject clone = GameObject.Instantiate(SearchItem.gameObject, SearchContent); + searchItemMap.Add(clone, child.gameObject); Transform subContent = child.Find("SubContent"); // 检查是否有子内容 if (subContent.childCount > 0) { - Transform buttonLabel = clone.transform.Find("Button/Label"); + Button btn = clone.transform.Find("Button").GetComponent