From 12d5ac8fbd05bca4dd3c5cdf35948d0880dfd4bf Mon Sep 17 00:00:00 2001 From: fiore Date: Thu, 13 Mar 2025 17:33:21 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20:=20=EC=BD=94=EC=9D=B8=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=EC=8B=9C=20=ED=81=AC=EA=B8=B0=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 코인 초기화시에도 크기 조절되도록 수정 --- Assets/Prefabs/Coins Panel.prefab | 10 +- Assets/Script/Common/CoinsPanelController.cs | 20 +- Assets/Trash Can/CoinTEST.unity | 227 +++++++++---------- 3 files changed, 127 insertions(+), 130 deletions(-) diff --git a/Assets/Prefabs/Coins Panel.prefab b/Assets/Prefabs/Coins Panel.prefab index 11abdf8..7960ab9 100644 --- a/Assets/Prefabs/Coins Panel.prefab +++ b/Assets/Prefabs/Coins Panel.prefab @@ -51,11 +51,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: eea2199565579f74994703cd3b57324b, type: 3} m_Name: m_EditorClassIdentifier: - _coinsRemoveImageObject: {fileID: 4198953742281733827} - _coinsCountText: {fileID: 2892066450466788586} - _coinsRemoveAudioClip: {fileID: 8300000, guid: 585a9de0fb7ee4163af5c559ba5b2364, type: 3} - _coinsAddAudioClip: {fileID: 8300000, guid: 1ec44182fa76a4b3eb1459c0a6d9a8ab, type: 3} - _coinsEmptyAudioClip: {fileID: 8300000, guid: 908a78cb991984977bea42916bed8684, type: 3} + coinsRemoveImageObject: {fileID: 4198953742281733827} + coinsCountText: {fileID: 2892066450466788586} + coinsRemoveAudioClip: {fileID: 8300000, guid: 585a9de0fb7ee4163af5c559ba5b2364, type: 3} + coinsAddAudioClip: {fileID: 8300000, guid: 1ec44182fa76a4b3eb1459c0a6d9a8ab, type: 3} + coinsEmptyAudioClip: {fileID: 8300000, guid: 908a78cb991984977bea42916bed8684, type: 3} --- !u!82 &5499754916380040505 AudioSource: m_ObjectHideFlags: 0 diff --git a/Assets/Script/Common/CoinsPanelController.cs b/Assets/Script/Common/CoinsPanelController.cs index f410fb2..7084e72 100644 --- a/Assets/Script/Common/CoinsPanelController.cs +++ b/Assets/Script/Common/CoinsPanelController.cs @@ -16,10 +16,9 @@ public class CoinsPanelController : MonoBehaviour [SerializeField] private AudioClip coinsEmptyAudioClip; private Color _coinsColor; - private AudioSource _audioSource; - private int _coinsCount; + private RectTransform _coinsRect; // 1. 코인 추가 연출 // 2. 코인 감소 연출 @@ -29,6 +28,7 @@ public class CoinsPanelController : MonoBehaviour { _audioSource = GetComponent(); _coinsColor = coinsRemoveImageObject.GetComponent().color; + _coinsRect = GetComponent(); } private void Start() @@ -36,7 +36,7 @@ public class CoinsPanelController : MonoBehaviour coinsRemoveImageObject.SetActive(false); // TODO : 코인 수량 초기화 - InitCoinsCount(0); + InitCoinsCount(500); } /// @@ -47,6 +47,15 @@ public class CoinsPanelController : MonoBehaviour { _coinsCount = coinsCount; coinsCountText.text = _coinsCount.ToString(); + + ResizingCoinsRect(); + } + + private void ResizingCoinsRect() + { + // Coins Panel의 Width를 글자 수에 따라 변경 + var textLength = coinsCountText.text.Length; + _coinsRect.sizeDelta = new Vector2(100 + textLength * 30f, 100f); } private void ChangeTextAnimation(bool isAdd, Action action) @@ -71,8 +80,7 @@ public class CoinsPanelController : MonoBehaviour } // Coins Panel의 Width를 글자 수에 따라 변경 - var textLength = coinsCountText.text.Length; - GetComponent().sizeDelta = new Vector2(100 + textLength * 30f, 100f); + ResizingCoinsRect(); // 새로운 코인 수 추가 애니메이션 coinsCountText.rectTransform.DOAnchorPosY(yPos, 0); @@ -149,7 +157,7 @@ public class CoinsPanelController : MonoBehaviour .OnComplete( ()=>ChangeTextAnimation(false, ()=> { // TODO: 코인 수량 감소 - // GameManager.Instance.heartCount--; + // GameManager.Instance.CoinsCount--; action?.Invoke(); })); // 텍스트 떨어지는 연출 } diff --git a/Assets/Trash Can/CoinTEST.unity b/Assets/Trash Can/CoinTEST.unity index 399f215..9fd1118 100644 --- a/Assets/Trash Can/CoinTEST.unity +++ b/Assets/Trash Can/CoinTEST.unity @@ -390,112 +390,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 844513473} m_CullTransparentMesh: 1 ---- !u!1001 &858030149 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1646812740} - m_Modifications: - - target: {fileID: 646100354038727038, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_Name - value: Coins Panel - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_SizeDelta.x - value: 160 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_SizeDelta.y - value: 100 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4063434195558959060, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} ---- !u!224 &858030150 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - m_PrefabInstance: {fileID: 858030149} - m_PrefabAsset: {fileID: 0} --- !u!1 &914195315 GameObject: m_ObjectHideFlags: 0 @@ -762,17 +656,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 998975801} m_CullTransparentMesh: 1 ---- !u!114 &1428613160 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 4222531876603999234, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} - m_PrefabInstance: {fileID: 858030149} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: eea2199565579f74994703cd3b57324b, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1646812739 GameObject: m_ObjectHideFlags: 0 @@ -804,7 +687,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 858030150} + - {fileID: 2074562024} - {fileID: 914195316} - {fileID: 998975802} m_Father: {fileID: 1778089776} @@ -864,7 +747,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fa7a7d93b873b524bafa6f9a411fe465, type: 3} m_Name: m_EditorClassIdentifier: - coinsPanelController: {fileID: 1428613160} + coinsPanelController: {fileID: 0} --- !u!1 &1778089772 GameObject: m_ObjectHideFlags: 0 @@ -1059,6 +942,112 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1905737107 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1646812740} + m_Modifications: + - target: {fileID: 646100354038727038, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_Name + value: Coins Panel + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_SizeDelta.x + value: 160 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4063434195558959060, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} +--- !u!224 &2074562024 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1769668775421633028, guid: dc5d544dd6fd6e544b8e7399440a8323, type: 3} + m_PrefabInstance: {fileID: 1905737107} + m_PrefabAsset: {fileID: 0} --- !u!1 &2100860557 GameObject: m_ObjectHideFlags: 0