diff --git a/Prefabs/handMenuButtonPrefab.prefab b/Prefabs/handMenuButtonPrefab.prefab index adf860e..df8d02f 100644 --- a/Prefabs/handMenuButtonPrefab.prefab +++ b/Prefabs/handMenuButtonPrefab.prefab @@ -1,5 +1,80 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &2827295834620005008 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6172332255966151713} + - component: {fileID: 5512862471390106759} + - component: {fileID: 7289734377001799295} + m_Layer: 5 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6172332255966151713 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827295834620005008} + 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: 2152916731631440467} + 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: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5512862471390106759 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827295834620005008} + m_CullTransparentMesh: 1 +--- !u!114 &7289734377001799295 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827295834620005008} + 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: 1, g: 1, b: 1, 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: 21300000, guid: 01c9a8bf23c12eb4f9de8510786d3b52, type: 3} + 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 &5044333991272172211 GameObject: m_ObjectHideFlags: 0 @@ -32,10 +107,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 3214908287399388135} 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: 0, y: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 22.5, y: 0} + m_SizeDelta: {x: -45, y: 40} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &721533012943717586 CanvasRenderer: @@ -99,7 +174,7 @@ MonoBehaviour: m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 - m_HorizontalAlignment: 2 + m_HorizontalAlignment: 1 m_VerticalAlignment: 512 m_textAlignment: 65535 m_characterSpacing: 0 @@ -110,7 +185,7 @@ MonoBehaviour: m_charWidthMaxAdj: 0 m_enableWordWrapping: 1 m_wordWrappingRatios: 0.4 - m_overflowMode: 0 + m_overflowMode: 2 m_linkedTextComponent: {fileID: 0} parentLinkedComponent: {fileID: 0} m_enableKerning: 1 @@ -134,6 +209,82 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &6159024145498940321 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2152916731631440467} + - component: {fileID: 7044291855128376003} + - component: {fileID: 5089933871113702611} + m_Layer: 5 + m_Name: Graphic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2152916731631440467 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6159024145498940321} + 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: 6172332255966151713} + m_Father: {fileID: 3214908287399388135} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 40, y: 40} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &7044291855128376003 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6159024145498940321} + m_CullTransparentMesh: 1 +--- !u!114 &5089933871113702611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6159024145498940321} + 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: 1, g: 1, b: 1, 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &6268896315730717319 GameObject: m_ObjectHideFlags: 0 @@ -144,7 +295,8 @@ GameObject: m_Component: - component: {fileID: 3214908287399388135} - component: {fileID: 9010663336430904804} - - component: {fileID: 2302973234404424886} + - component: {fileID: 3826983172897042623} + - component: {fileID: 6145718140741343571} - component: {fileID: 7246227573358393957} m_Layer: 5 m_Name: handMenuButtonPrefab @@ -166,6 +318,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7245477669059734699} + - {fileID: 2152916731631440467} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} @@ -181,7 +334,22 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6268896315730717319} m_CullTransparentMesh: 1 ---- !u!114 &2302973234404424886 +--- !u!114 &3826983172897042623 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6268896315730717319} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb258bdb3efb0a54e8abb3f678f01d37, type: 3} + m_Name: + m_EditorClassIdentifier: + m_spriteImage: {fileID: 7289734377001799295} + m_text: {fileID: 6838571361396830952} + m_button: {fileID: 7246227573358393957} +--- !u!114 &6145718140741343571 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -194,7 +362,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 0.29803923} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -251,7 +419,7 @@ MonoBehaviour: m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 - m_TargetGraphic: {fileID: 2302973234404424886} + m_TargetGraphic: {fileID: 5089933871113702611} m_OnClick: m_PersistentCalls: m_Calls: [] diff --git a/Scripts/UI/HandMenu/HandMenuButton.cs b/Scripts/UI/HandMenu/HandMenuButton.cs new file mode 100644 index 0000000..33f0475 --- /dev/null +++ b/Scripts/UI/HandMenu/HandMenuButton.cs @@ -0,0 +1,35 @@ +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +public class HandMenuButton : MonoBehaviour +{ + [SerializeField] Image m_spriteImage; + public Sprite Sprite + { + get => m_spriteImage != null ? m_spriteImage.sprite : null; + set + { + if (m_spriteImage == null) return; + + m_spriteImage.sprite = value; + m_spriteImage.gameObject.SetActive(value != null); + } + } + [SerializeField] TMP_Text m_text; + public string Text + { + get => m_text != null ? m_text.text : string.Empty; + set + { + if (m_text != null) + m_text.text = value; + } + } + [SerializeField] Button m_button; + public Button Button + { + get => m_button; + private set => m_button = value; + } +} diff --git a/Scripts/UI/HandMenu/HandMenuButton.cs.meta b/Scripts/UI/HandMenu/HandMenuButton.cs.meta new file mode 100644 index 0000000..006be6e --- /dev/null +++ b/Scripts/UI/HandMenu/HandMenuButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb258bdb3efb0a54e8abb3f678f01d37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/UI/HandMenu/MainPanel.cs b/Scripts/UI/HandMenu/MainPanel.cs index 1320f56..2d35c05 100644 --- a/Scripts/UI/HandMenu/MainPanel.cs +++ b/Scripts/UI/HandMenu/MainPanel.cs @@ -37,14 +37,16 @@ public void AddPanelButton(MenuPanel panel) } - var button = Instantiate(m_buttonPrefab, m_scrollviewContent).GetComponent