diff --git a/Assets/01.Scenes/01.Tycoon_1.unity b/Assets/01.Scenes/01.Tycoon_1.unity index c408e1248..7968a8bb1 100644 --- a/Assets/01.Scenes/01.Tycoon_1.unity +++ b/Assets/01.Scenes/01.Tycoon_1.unity @@ -4137,7 +4137,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _persistent: 0 - _customerDataSo: {fileID: 11400000, guid: e6ce9d58057b580479880585947969d8, type: 2} + k__BackingField: {fileID: 0} _customerPrefab: {fileID: -2302002259734456648, guid: 23195e611c71ad44b8a1ccb2b6e0efe5, type: 3} _customerSpawnTransform: {fileID: 1038321203} _checkEmptySeatInterval: 0.5 @@ -10827,6 +10827,7 @@ RectTransform: - {fileID: 1909799357} - {fileID: 587277061} - {fileID: 2055805161} + - {fileID: 1728221817} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 40.052, y: -1.303, z: -0.86} m_AnchorMin: {x: 0, y: 0} @@ -18664,22 +18665,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _persistent: 0 - k__BackingField: 3 - CurrentHeart: 0 - Invincibility: 0 - k__BackingField: 1 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 - k__BackingField: 1000 k__BackingField: {fileID: 1665075870} k__BackingField: {fileID: 1665075872} _dailyBgm: TycoonDailyBgm1 - _levelDataSo: {fileID: 11400000, guid: 702b1ed0ce71d1b4aa1ddbce67e475a1, type: 2} - _cardDataSo: {fileID: 11400000, guid: 4607b374e49ab734da548949f9e10fed, type: 2} + k__BackingField: {fileID: 11400000, guid: 702b1ed0ce71d1b4aa1ddbce67e475a1, type: 2} + k__BackingField: {fileID: 11400000, guid: 4607b374e49ab734da548949f9e10fed, type: 2} --- !u!114 &1665075870 MonoBehaviour: m_ObjectHideFlags: 0 @@ -19351,6 +19341,108 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1723000583} m_CullTransparentMesh: 1 +--- !u!1001 &1728221816 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1049919592} + m_Modifications: + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_SizeDelta.x + value: 500 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_SizeDelta.y + value: 800 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalRotation.w + value: -0.00000004371139 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalRotation.y + value: -1 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -180 + objectReference: {fileID: 0} + - target: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7279465393450390489, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + propertyPath: m_Name + value: Card + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cf200ba34deabdb41847ac49e53704be, type: 3} +--- !u!224 &1728221817 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 3945043186252027743, guid: cf200ba34deabdb41847ac49e53704be, type: 3} + m_PrefabInstance: {fileID: 1728221816} + m_PrefabAsset: {fileID: 0} --- !u!1 &1730879242 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/02.Scripts/Tycoon/TycoonManager.cs b/Assets/02.Scripts/Tycoon/TycoonManager.cs index 93cb31f50..adb2c908c 100644 --- a/Assets/02.Scripts/Tycoon/TycoonManager.cs +++ b/Assets/02.Scripts/Tycoon/TycoonManager.cs @@ -10,36 +10,6 @@ namespace BlueWater.Tycoons { public class TycoonManager : Singleton { - - [field: Title("캐릭터 스테이터스")] - [field: SerializeField, CLabel("최대 체력")] - public int MaxHeart { get; set; } = 3; - - [field: SerializeField, CLabel("현재 체력")] - private int CurrentHeart; - [field: SerializeField, CLabel("무적")] - public bool Invincibility = false; - public int _CurrentHeart { get => CurrentHeart; set { if (!Invincibility) { CurrentHeart = value;}}} - - [field: SerializeField, CLabel("이동 속도")] - public float Chracter_Speed { get; set; } = 1.0f; - - [field: Title("음식 스테이터스")] - [field: SerializeField, CLabel("Liquid A")] - public int LiquidA { get; set; } = 1000; - [field: SerializeField, CLabel("Liquid B")] - public int LiquidB { get; set; } = 1000; - [field: SerializeField, CLabel("Liquid C")] - public int LiquidC { get; set; } = 1000; - [field: SerializeField, CLabel("Liquid D")] - public int LiquidD { get; set; } = 1000; - [field: SerializeField, CLabel("Liquid E")] - public int LiquidE { get; set; } = 1000; - [field: SerializeField, CLabel("Garnish A")] - public int GarnishA { get; set; } = 1000; - [field: SerializeField, CLabel("Garnish B")] - public int GarnishB { get; set; } = 1000; - [field: Title("컴포넌트")] [field: SerializeField] public CustomerTableController CustomerTableController { get; private set; } @@ -80,25 +50,6 @@ namespace BlueWater.Tycoons CustomerTableController = GetComponent(); TycoonStageController = GetComponent(); } - - private Dictionary InitializeDictionary(List dataList, Func keySelector) - { - return dataList.ToDictionary(keySelector); - } - - public T GetDataByIdx(Dictionary dataDictionary, string idx) where T : class - { - if (dataDictionary.TryGetValue(idx, out var data)) - return data; - - Debug.LogError($"{idx}와 일치하는 아이템이 없습니다."); - return null; - } - - public int GetTotalItemCount(Dictionary dataDictionary) - { - return dataDictionary.Count; - } } } \ No newline at end of file diff --git a/Assets/02.Scripts/Ui/Tycoon/TycoonCard.cs b/Assets/02.Scripts/Ui/Tycoon/TycoonCard.cs index bf9a3cf07..34f8f8dd6 100644 --- a/Assets/02.Scripts/Ui/Tycoon/TycoonCard.cs +++ b/Assets/02.Scripts/Ui/Tycoon/TycoonCard.cs @@ -53,7 +53,6 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl [field: SerializeField, CLabel("기울기 복원 속도")] private float returnSpeed = 1.0f; private bool isPointerInside; // 이미지 안에 마우스가 있는지 여부를 추적 - private Coroutine moveRotationCoroutine; private Coroutine endRotationCoroutine; private Image image; @@ -63,23 +62,23 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl void Start() { rectTransform = GetComponent(); - _cardData_IDX = TycoonManager.Instance.GetCardDataByIdx(_cardData); + _cardData_IDX = TycoonManager.Instance.CardDataSo.GetDataByIdx("HeartPlus"); - Transform nameTransform = transform.Find("Name"); + Transform nameTransform = transform.Find("Name "); Transform infoTransform = transform.Find("Infomation"); TextMeshProUGUI nametextComponent = nameTransform.GetComponent(); nametextComponent.text = _cardData_IDX.Img; + Debug.Log(_cardData_IDX.Img); TextMeshProUGUI infotextComponent = infoTransform.GetComponent(); infotextComponent.text = _cardData_IDX.ScriptText; + Debug.Log(_cardData_IDX.ScriptText); image = transform.Find("Image").GetComponent(); } - - [Button("회전")] public void Rotation_Start() @@ -95,26 +94,8 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl currentRotationCoroutine = StartCoroutine(RotateOverTime()); - var cardData = TycoonManager.Instance.CardDataSo.GetDataByIdx(_cardData); - // Resources.Load() } - - - void Start() - { - _cardData_IDX = TycoonManager.Instance.CardDataSo.GetDataByIdx(_cardData); - - Transform nameTransform = transform.Find("Name"); - Transform infoTransform = transform.Find("Infomation"); - - TextMeshProUGUI nametextComponent = nameTransform.GetComponent(); - nametextComponent.text = _cardData_IDX.Img; - - TextMeshProUGUI infotextComponent = infoTransform.GetComponent(); - infotextComponent.text = _cardData_IDX.ScriptText; - - } // 마우스가 이미지 위에 올라갔을 때 호출 public void OnPointerEnter(PointerEventData eventData) @@ -139,12 +120,6 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl endRotationCoroutine = null; } - if (moveRotationCoroutine != null) - { - StopCoroutine(moveRotationCoroutine); - moveRotationCoroutine = null; - } - endRotationCoroutine = StartCoroutine(ReturnToZeroRotation()); isPointerInside = false; @@ -159,33 +134,15 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl public void OnPointerMove(PointerEventData eventData) { - if (endRotationCoroutine != null) + if (isPointerInside) { - StopCoroutine(endRotationCoroutine); - endRotationCoroutine = null; - } - - if (moveRotationCoroutine != null) - { - StopCoroutine(moveRotationCoroutine); - moveRotationCoroutine = null; - } - - moveRotationCoroutine = StartCoroutine(SmoothMoveToMouse(eventData)); - } - - // 마우스의 움직임을 천천히 따라가도록 하는 코루틴 - private IEnumerator SmoothMoveToMouse(PointerEventData eventData) - { - while (isPointerInside) - { - Vector2 localPoint; + Vector2 localPoint; // 마우스 포인터의 화면 좌표(eventData.position)를 이미지의 로컬 좌표(localPoint)로 변환 if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, out localPoint)) { // 이미지 내에서의 좌표를 정규화된 값으로 변환 (0,0)이 이미지의 왼쪽 아래, (1,1)이 오른쪽 위 - Vector2 normalizedPoint = new Vector2( + Vector2 normalizedPoint = new Vector2( (localPoint.x - rectTransform.rect.xMin) / rectTransform.rect.width, (localPoint.y - rectTransform.rect.yMin) / rectTransform.rect.height ); @@ -194,21 +151,13 @@ public class TycoonCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl Vector2 centeredNormalizedPoint = normalizedPoint - new Vector2(0.5f, 0.5f); // X와 Y축의 회전 각도를 마우스 위치에 따라 계산 (최대 회전 각도를 15도로 제한) - float targetRotationX = Mathf.Clamp(centeredNormalizedPoint.y * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle); - float targetRotationY = Mathf.Clamp(-centeredNormalizedPoint.x * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle); - - // 현재 회전 값 - Vector3 currentRotation = rectTransform.localRotation.eulerAngles; - - // 목표 회전 값으로 부드럽게 이동 (Slerp) - float rotationX = Mathf.LerpAngle(currentRotation.x, targetRotationX, Time.deltaTime * 1.0f); - float rotationY = Mathf.LerpAngle(currentRotation.y, targetRotationY, Time.deltaTime * 1.0f); + float rotationX = Mathf.Clamp(centeredNormalizedPoint.y * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle); + float rotationY = Mathf.Clamp(-centeredNormalizedPoint.x * maxRotationAngle * 2, -maxRotationAngle, maxRotationAngle); // 회전을 적용 (X축은 위아래 기울기, Y축은 좌우 기울기) rectTransform.localRotation = Quaternion.Euler(rotationX, rotationY, 0f); - // 천천히 이동하므로 매 프레임마다 기다림 - yield return null; + // Debug.Log($"Mouse Position on Image (relative): ({normalizedPoint.x}, {normalizedPoint.y}), Rotation: ({rotationX}, {rotationY})"); } } }