From 068cab2d8a71870253f1f2d77f2f4148f6796f95 Mon Sep 17 00:00:00 2001 From: "aube.lee" Date: Sat, 1 Mar 2025 21:46:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=94=8C=EB=A0=88=EC=9D=B4=20=EC=A4=91?= =?UTF-8?q?=20=ED=8F=AC=EC=85=98=20=EC=82=AC=EC=9A=A9=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller Buttons/Item Button.prefab | 335 +++++++++++++++++- .../UI/Prefabs/UI.ControllerUI.prefab | 105 +++++- .../Scripts/Backend/BackendItemDataManager.cs | 22 ++ .../Scripts/Character/CharacterBase.cs | 21 ++ .../Scripts/Character/PlayerDataManager.cs | 15 + .../Assets/Gameton/Scripts/UI/ControllerUI.cs | 43 +++ .../Scripts/UI/ControllerUI_ItemButton.cs | 49 +++ .../UI/ControllerUI_ItemButton.cs.meta | 11 + 8 files changed, 576 insertions(+), 25 deletions(-) create mode 100644 Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs create mode 100644 Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs.meta diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Controller Buttons/Item Button.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Controller Buttons/Item Button.prefab index 09e410c1..aef28719 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Controller Buttons/Item Button.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Controller Buttons/Item Button.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 1465902235892889161} - component: {fileID: 7199637668151358389} - component: {fileID: 5037893579223492369} + - component: {fileID: 1286343195759334092} m_Layer: 5 m_Name: Item Button m_TagString: Untagged @@ -33,6 +34,8 @@ RectTransform: - {fileID: 3934607050646536993} - {fileID: 4904233352001157308} - {fileID: 4563112448858901034} + - {fileID: 1125363230496170488} + - {fileID: 8821021749791282538} - {fileID: 3216526607566517833} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -105,6 +108,20 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 +--- !u!114 &1286343195759334092 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 122146249855187030} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e890b5f706c997b4396fb3fc11938954, type: 3} + m_Name: + m_EditorClassIdentifier: + coolTimeText: {fileID: 1611366555514620028} + coolTimeDimd: {fileID: 2919704506127201870} --- !u!1 &617315685229545521 GameObject: m_ObjectHideFlags: 0 @@ -133,6 +150,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 7404193634045564304} - {fileID: 6659454930266304818} - {fileID: 4630639144192007157} m_Father: {fileID: 1465902235892889161} @@ -140,8 +158,83 @@ RectTransform: m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: -12, y: -12} - m_SizeDelta: {x: 50, y: 50} + m_SizeDelta: {x: 60, y: 40} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2200470183937290979 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7404193634045564304} + - component: {fileID: 6826183447491261491} + - component: {fileID: 2749669449975143051} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7404193634045564304 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2200470183937290979} + 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: 3216526607566517833} + 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 &6826183447491261491 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2200470183937290979} + m_CullTransparentMesh: 1 +--- !u!114 &2749669449975143051 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2200470183937290979} + 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: 6ab1069070dcf1447b00b6a9297293ce, 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 &2253799602583015537 GameObject: m_ObjectHideFlags: 0 @@ -229,7 +322,7 @@ GameObject: - component: {fileID: 2711049478468106196} - component: {fileID: 6380820659219376626} m_Layer: 5 - m_Name: Image + m_Name: Potion Icon m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -357,10 +450,10 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: X5 + m_text: 5 m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontAsset: {fileID: 11400000, guid: 3116464c7616674448f2fb05b50bf91b, type: 2} + m_sharedMaterial: {fileID: -5364670637895760327, guid: 3116464c7616674448f2fb05b50bf91b, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] @@ -384,8 +477,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 24 - m_fontSizeBase: 24 + m_fontSize: 32 + m_fontSizeBase: 32 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -426,6 +519,96 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &6172311544684701394 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1125363230496170488} + - component: {fileID: 6600581202386279414} + - component: {fileID: 2919704506127201870} + - component: {fileID: 7246605180128853771} + m_Layer: 0 + m_Name: CoolDown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1125363230496170488 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6172311544684701394} + 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: 1465902235892889161} + 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_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6600581202386279414 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6172311544684701394} + m_CullTransparentMesh: 1 +--- !u!114 &2919704506127201870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6172311544684701394} + 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.1792453, g: 0.1792453, b: 0.1792453, a: 0.78039217} + 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: 7155d9d3c459a1945a29adc40045dc25, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 0 + m_FillClockwise: 1 + m_FillOrigin: 2 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7246605180128853771 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6172311544684701394} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: adb30198aa32dd140b5750692dd48104, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 75 + image: {fileID: 2919704506127201870} --- !u!1 &7327516494835756358 GameObject: m_ObjectHideFlags: 0 @@ -438,7 +621,7 @@ GameObject: - component: {fileID: 6733496919824856566} - component: {fileID: 1672729140695173625} m_Layer: 5 - m_Name: Image + m_Name: Outline m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -491,7 +674,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: f295eaea7e6cdb446b475b956ad416c1, type: 3} + m_Sprite: {fileID: 21300000, guid: 14d2538820879224f957a7c22f099577, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -576,3 +759,137 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7737587172022142573 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8821021749791282538} + - component: {fileID: 5780634883791292424} + - component: {fileID: 1611366555514620028} + m_Layer: 5 + m_Name: CoolDownText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8821021749791282538 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7737587172022142573} + 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: 1465902235892889161} + 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: 134.99997, y: -168.3333} + m_SizeDelta: {x: 100, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5780634883791292424 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7737587172022142573} + m_CullTransparentMesh: 1 +--- !u!114 &1611366555514620028 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7737587172022142573} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 3116464c7616674448f2fb05b50bf91b, type: 2} + m_sharedMaterial: {fileID: -5364670637895760327, guid: 3116464c7616674448f2fb05b50bf91b, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab index 29fc463c..44905270 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ControllerUI.prefab @@ -120,6 +120,11 @@ MonoBehaviour: joystick: {fileID: 7288066023221573359} skillButtonGroup: {fileID: 2009939342780089657} skillButtonPrefab: {fileID: 1708453278417668396} + hpPotionCount: {fileID: 6063099989028787624} + mpPotionCount: {fileID: 3723411150709511038} + itemButtons: + - {fileID: 428681987414334552} + - {fileID: 7096186581329386126} --- !u!1 &3229850477810591835 GameObject: m_ObjectHideFlags: 0 @@ -487,7 +492,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 122146249855187030, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_Name - value: Item Button + value: Hp Potion Button objectReference: {fileID: 0} - target: {fileID: 1465902235892889161, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_Pivot.x @@ -569,34 +574,46 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2919704506127201870, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_Material + value: + objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 3730925517357996718} + objectReference: {fileID: -4577297331876422106} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: PlayOneShot + value: OnClickHpPotionButton objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: UnityEngine.AudioSource, UnityEngine + value: TON.ControllerUI, Assembly-CSharp objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgument value: - objectReference: {fileID: 8300000, guid: 49ab3786fc950784581501b147c04533, type: 3} + objectReference: {fileID: 0} + - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_StringArgument + value: HP + objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.AudioClip, UnityEngine + value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 6380820659219376626, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: d1119b914f5731d47a7c29dea8839b98, type: 3} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -607,6 +624,28 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 1465902235892889161, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} m_PrefabInstance: {fileID: 1452685402175000212} m_PrefabAsset: {fileID: 0} +--- !u!114 &428681987414334552 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1286343195759334092, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + m_PrefabInstance: {fileID: 1452685402175000212} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e890b5f706c997b4396fb3fc11938954, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &6063099989028787624 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 4615218739836951356, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + m_PrefabInstance: {fileID: 1452685402175000212} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &4332357077754258245 PrefabInstance: m_ObjectHideFlags: 0 @@ -1274,7 +1313,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 122146249855187030, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_Name - value: Item Button + value: Mp Potion Button objectReference: {fileID: 0} - target: {fileID: 1465902235892889161, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_Pivot.x @@ -1356,39 +1395,73 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2919704506127201870, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_Material + value: + objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 3730925517357996718} + objectReference: {fileID: -4577297331876422106} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: PlayOneShot + value: OnClickMpPotionButton objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: UnityEngine.AudioSource, UnityEngine + value: TON.ControllerUI, Assembly-CSharp objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgument value: - objectReference: {fileID: 8300000, guid: 49ab3786fc950784581501b147c04533, type: 3} + objectReference: {fileID: 0} + - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_StringArgument + value: MP + objectReference: {fileID: 0} - target: {fileID: 5037893579223492369, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.AudioClip, UnityEngine + value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 6380820659219376626, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: e20890adda83b9f4db7dd5e9bca91492, type: 3} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} +--- !u!114 &3723411150709511038 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 4615218739836951356, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + m_PrefabInstance: {fileID: 8331864141961742402} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &7096186581329386126 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1286343195759334092, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} + m_PrefabInstance: {fileID: 8331864141961742402} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e890b5f706c997b4396fb3fc11938954, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!224 &7491548976331193867 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 1465902235892889161, guid: c8f2e3092439b7f409834ac140c97a78, type: 3} diff --git a/Gameton-06/Assets/Gameton/Scripts/Backend/BackendItemDataManager.cs b/Gameton-06/Assets/Gameton/Scripts/Backend/BackendItemDataManager.cs index e8acb149..16151c51 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Backend/BackendItemDataManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Backend/BackendItemDataManager.cs @@ -89,5 +89,27 @@ namespace TON }); } + public void UpdateHpData(int count) + { + Param param = new Param(); + param.Add("hp_potion", count); + + Backend.PlayerData.UpdateMyLatestData(USER_ITEM_TABLE, param, callback => + { + UserItemData updatedData = new UserItemData { hpPotion = count }; + }); + } + + public void UpdateMpData(int count) + { + Param param = new Param(); + param.Add("mp_potion", count); + + Backend.PlayerData.UpdateMyLatestData(USER_ITEM_TABLE, param, callback => + { + UserItemData updatedData = new UserItemData { mpPotion = count }; + }); + } + } } diff --git a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs index 4844dcb2..f5960f27 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Character/CharacterBase.cs @@ -206,6 +206,27 @@ namespace TON isRecovering = false; } + public void UsePotion(string type) + { + switch (type) + { + case "HP": + if (currentHP < maxHP) // currentHP가 maxHP보다 작을 때만 실행 + { + currentHP = Mathf.Min(currentHP + (maxHP * 0.2f), maxHP); // maxHP를 초과하지 않도록 보정 + OnHPChanged?.Invoke(currentHP, maxHP); + } + break; + case "MP": + if (currentSP < maxSP) // currentSP가 maxSP보다 작을 때만 실행 + { + currentSP = Mathf.Min(currentSP + (maxSP * 0.2f), maxSP); // maxSP를를 초과하지 않도록 보정 + OnSPChanged?.Invoke(currentSP, maxSP); + } + break; + } + } + public void SkillAttack(string skillId) { SkillBase skillBase = SkillDataManager.Singleton.GetSkillInstance(skillId); diff --git a/Gameton-06/Assets/Gameton/Scripts/Character/PlayerDataManager.cs b/Gameton-06/Assets/Gameton/Scripts/Character/PlayerDataManager.cs index 37ce2969..ea76ffcd 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Character/PlayerDataManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Character/PlayerDataManager.cs @@ -68,6 +68,21 @@ namespace TON }); } + public void UsePotion(string type) + { + switch (type) + { + case "HP": + userItem.hpPotion -= 1; + itemDataManager.UpdateHpData(userItem.hpPotion); + break; + case "MP": + userItem.mpPotion -= 1; + itemDataManager.UpdateMpData(userItem.mpPotion); + break; + } + } + public void AddGold(int amount) { goldAmount += amount; diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs index 939cc124..d32d9fc7 100644 --- a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs +++ b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; @@ -20,12 +21,24 @@ namespace TON public ControllerUI_SkillButton skillButtonPrefab; private List createdSkillButtons = new List(); + public UserItemData userItem { get; private set; } = new UserItemData(); + // 보유 포션 수량 + [SerializeField] private TextMeshProUGUI hpPotionCount; + [SerializeField] private TextMeshProUGUI mpPotionCount; + + public List itemButtons = new List(); + private void OnEnable() { skillButtonPrefab.gameObject.SetActive(false); Initalize(); } + private void FixedUpdate() + { + InitalizeItemData(); + } + public void Initalize() { // 이미 기존에 UI가 생성되어 있다면 삭제 @@ -59,6 +72,36 @@ namespace TON } } + private void InitalizeItemData() + { + userItem = PlayerDataManager.Singleton.userItem; + + hpPotionCount.text = $"{userItem.hpPotion}"; + mpPotionCount.text = $"{userItem.mpPotion}"; + } + + public void OnClickHpPotionButton() + { + if (userItem.hpPotion <= 0) + return; + + PlayerDataManager.Singleton.UsePotion("HP"); + + itemButtons[0].SetCurrentCoolDown(); + linkedCharactor.UsePotion("HP"); + } + + public void OnClickMpPotionButton() + { + if (userItem.mpPotion <= 0) + return; + + PlayerDataManager.Singleton.UsePotion("MP"); + + itemButtons[1].SetCurrentCoolDown(); + linkedCharactor.UsePotion("MP"); + } + public void OnClickJumpButton() { linkedCharactor.Jump(); diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs new file mode 100644 index 00000000..8195ae5a --- /dev/null +++ b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine.UI; +using UnityEngine; +using TMPro; + +namespace TON +{ + public class ControllerUI_ItemButton : MonoBehaviour + { + [SerializeField] private TextMeshProUGUI coolTimeText; + [SerializeField] private Image coolTimeDimd; + + private float currentCoolDown = 0f; + private float potionCoolDown = 5f; + + public void SetCurrentCoolDown() + { + currentCoolDown = potionCoolDown; // 쿨타임 시작 + } + + private void Update() + { + if (currentCoolDown == 0f) + return; + + UpdateCooldownUI(); + } + + private void UpdateCooldownUI() + { + if (coolTimeText == null || coolTimeDimd == null) + { + return; // UI가 삭제되었으면 업데이트 중단 + } + + currentCoolDown -= Time.deltaTime; + currentCoolDown = Mathf.Max(0, currentCoolDown); + + coolTimeText.gameObject.SetActive(currentCoolDown > 0); // 남은 쿨타임이 있을 때만 표시 + + if (coolTimeText.IsActive()) + { + coolTimeText.text = $"{currentCoolDown: 0}s"; // 정수 초단위 표시 + coolTimeDimd.fillAmount = currentCoolDown / potionCoolDown; // 1 → 0 으로 감소 + } + } + } +} diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs.meta b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs.meta new file mode 100644 index 00000000..bd8fbef7 --- /dev/null +++ b/Gameton-06/Assets/Gameton/Scripts/UI/ControllerUI_ItemButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e890b5f706c997b4396fb3fc11938954 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: