From 208af8eab9abbc07115bb79e267c1a82a779625c Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 15:49:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Art/UIPrefab/UITools.prefab | 82 ++++++++++++++++++++++++++++-- Assets/Scripts/UI/UITools.cs | 4 +- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/Assets/Art/UIPrefab/UITools.prefab b/Assets/Art/UIPrefab/UITools.prefab index dd87420e..a6d862c3 100644 --- a/Assets/Art/UIPrefab/UITools.prefab +++ b/Assets/Art/UIPrefab/UITools.prefab @@ -522,7 +522,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7464141640143892343} - - {fileID: 3051202814640239909} + - {fileID: 4775158531114985421} - {fileID: 642645979159612403} m_Father: {fileID: 8969698929162076767} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1055,7 +1055,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6746250251467292074} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -1063,7 +1063,7 @@ RectTransform: - {fileID: 1684458048730538019} - {fileID: 5860908020037853715} - {fileID: 8568704472119011922} - m_Father: {fileID: 5675325337001315481} + m_Father: {fileID: 4775158531114985421} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1183,3 +1183,79 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9141652036248099059 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775158531114985421} + - component: {fileID: 5397078064978493576} + - component: {fileID: 6634696415031054332} + m_Layer: 0 + m_Name: IconBg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775158531114985421 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + 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: + - {fileID: 3051202814640239909} + m_Father: {fileID: 5675325337001315481} + 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: 76, y: 76} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5397078064978493576 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + m_CullTransparentMesh: 1 +--- !u!114 &6634696415031054332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9141652036248099059} + 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.07058824, g: 0.15686275, b: 0.19607843, a: 1} + m_RaycastTarget: 0 + 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 diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 368bf262..11f27906 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -59,7 +59,7 @@ namespace QFramework.Example GameObject obj = GameObject.Instantiate(ItemPrefab.gameObject, Content); obj.name = item.Name; obj.transform.Find("Name").GetComponent().text = item.Name; - Image icon = obj.transform.Find("Icon").GetComponent(); + Image icon = obj.transform.Find("IconBg/Icon").GetComponent(); var localImageUrl = Global.deviceIconsPath + item.Icon; GameObject right = icon.transform.Find("Right").gameObject; GameObject wrong = icon.transform.Find("Wrong").gameObject; @@ -124,7 +124,7 @@ namespace QFramework.Example public void SetSelected(GameObject item, bool isRight) { - Transform icon = item.transform.Find("Icon"); + Transform icon = item.transform.Find("IconBg/Icon"); GameObject right = icon.Find("Right").gameObject; GameObject wrong = icon.Find("Wrong").gameObject; GameObject Selected = icon.Find("Selected").gameObject;