This commit is contained in:
NTG_Lenovo 2024-12-02 20:42:03 +09:00
commit d615b18620
4 changed files with 79 additions and 17 deletions

View File

@ -224,20 +224,22 @@ namespace BlueWater.Uis
Vector3 initialScale = _panel.localScale; Vector3 initialScale = _panel.localScale;
Vector3 targetScale = new Vector3(1.05f, 1.05f, 1.0f); // 타겟 스케일 설정 Vector3 targetScale = new Vector3(1.05f, 1.05f, 1.0f); // 타겟 스케일 설정
// 마우스 포인터의 화면 좌표(eventData.position)를 이미지의 로컬 좌표(localPoint)로 변환 /*
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(_rectTransform, Input.mousePosition, _uiCamera, // RectTransform의 화면 좌표를 가져오기 위한 변수
out var localPoint)) RectTransform rectTransform = GetComponent<RectTransform>();
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, Input.mousePosition, null, out var localPoint))
{ {
// RectTransform의 중심을 기준으로 정규화된 값으로 변환 // RectTransform의 크기를 기준으로 좌표를 정규화
Vector2 normalizedPoint = new Vector2( Vector2 normalizedPoint = new Vector2(
(localPoint.x / _rectTransform.rect.width) + 0.5f, localPoint.x / rectTransform.rect.width,
(localPoint.y / _rectTransform.rect.height) + 0.5f localPoint.y / rectTransform.rect.height
); );
// 좌표를 중심 기준으로 (-0.5, -0.5)에서 (0.5, 0.5)로 변환 (이미지 중앙이 0,0이 되도록) // 좌표를 중심 기준으로 (-0.5, -0.5)에서 (0.5, 0.5)로 변환
Vector2 centeredNormalizedPoint = normalizedPoint - new Vector2(0.5f, 0.5f); Vector2 centeredNormalizedPoint = normalizedPoint * 2f;
// Debug.Log($"Normalized Point: {centeredNormalizedPoint}"); // Debug.Log($"Normalized Point: {centeredNormalizedPoint}");
// X와 Y축의 회전 각도를 마우스 위치에 따라 계산 (최대 회전 각도를 15도로 제한) // X와 Y축의 회전 각도를 마우스 위치에 따라 계산 (최대 회전 각도를 15도로 제한)
float rotationX = Mathf.Clamp(-centeredNormalizedPoint.y * _maxRotationAngle * 2 * _returnSpeedTime, float rotationX = Mathf.Clamp(-centeredNormalizedPoint.y * _maxRotationAngle * 2 * _returnSpeedTime,
@ -245,12 +247,15 @@ namespace BlueWater.Uis
float rotationY = Mathf.Clamp(centeredNormalizedPoint.x * _maxRotationAngle * 2 * _returnSpeedTime, float rotationY = Mathf.Clamp(centeredNormalizedPoint.x * _maxRotationAngle * 2 * _returnSpeedTime,
-_maxRotationAngle, _maxRotationAngle); -_maxRotationAngle, _maxRotationAngle);
Debug.Log($"Normalized Point: {rotationX} x {rotationY}");
// 회전을 적용 (X축은 위아래 기울기, Y축은 좌우 기울기) // 회전을 적용 (X축은 위아래 기울기, Y축은 좌우 기울기)
_panel.GetComponent<RectTransform>().localRotation = _panel.GetComponent<RectTransform>().localRotation =
Quaternion.Euler(rotationX, rotationY, 0f); Quaternion.Euler(rotationX, rotationY, 0f);
_cardImage.GetComponent<RectTransform>().localRotation = Quaternion.Euler(-rotationX, 0f, 0f); _cardImage.GetComponent<RectTransform>().localRotation = Quaternion.Euler(-rotationX, 0f, 0f);
} }
*/
// 스케일 보간 (Lerp) // 스케일 보간 (Lerp)
float t = Mathf.Clamp01(_returnSpeedTime); float t = Mathf.Clamp01(_returnSpeedTime);
float easedT = 1 - Mathf.Pow(2, -10 * t); float easedT = 1 - Mathf.Pow(2, -10 * t);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -142,7 +142,7 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: 100 m_text: 100
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: dabfdeb80b25d44b4ace56414d0eb4ad, type: 2} m_fontAsset: {fileID: 0}
m_sharedMaterial: {fileID: 2100000, guid: 0e5360dce269ccc42b822a424d66fbd4, type: 2} m_sharedMaterial: {fileID: 2100000, guid: 0e5360dce269ccc42b822a424d66fbd4, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
@ -360,8 +360,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0} m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 30} m_AnchoredPosition: {x: 0, y: 70}
m_SizeDelta: {x: 400, y: 240} m_SizeDelta: {x: 400, y: 200}
m_Pivot: {x: 0.5, y: 0} m_Pivot: {x: 0.5, y: 0}
--- !u!222 &3904437696116363940 --- !u!222 &3904437696116363940
CanvasRenderer: CanvasRenderer:
@ -393,15 +393,15 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: "\uCE74\uB4DC \uC124\uBA85" m_text: "\uCE74\uB4DC \uC124\uBA85"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: dabfdeb80b25d44b4ace56414d0eb4ad, type: 2} m_fontAsset: {fileID: 11400000, guid: ab4e9b009d1d8c9499121e92eff6464d, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 19a626476403a2f40b9d0512f80d61d9, type: 2} m_sharedMaterial: {fileID: 2060004501589314750, guid: ab4e9b009d1d8c9499121e92eff6464d, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
m_fontColor32: m_fontColor32:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4278190080
m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0 m_enableVertexGradient: 0
m_colorMode: 3 m_colorMode: 3
m_fontColorGradient: m_fontColorGradient:
@ -515,7 +515,7 @@ MonoBehaviour:
m_Right: 0 m_Right: 0
m_Top: 0 m_Top: 0
m_Bottom: 0 m_Bottom: 0
m_ChildAlignment: 8 m_ChildAlignment: 7
m_Spacing: 5 m_Spacing: 5
m_ChildForceExpandWidth: 0 m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0 m_ChildForceExpandHeight: 0
@ -863,6 +863,7 @@ GameObject:
- component: {fileID: 3981473352066336261} - component: {fileID: 3981473352066336261}
- component: {fileID: 553588331708226939} - component: {fileID: 553588331708226939}
- component: {fileID: 2953333486680660764} - component: {fileID: 2953333486680660764}
- component: {fileID: 8149153454839836463}
m_Layer: 5 m_Layer: 5
m_Name: CardArea m_Name: CardArea
m_TagString: Untagged m_TagString: Untagged
@ -939,3 +940,59 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d1c4a04abae2e284384797a0c5044e99, type: 3} m_Script: {fileID: 11500000, guid: d1c4a04abae2e284384797a0c5044e99, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &8149153454839836463
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6830682350495907633}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 553588331708226939}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2953333486680660764}
m_TargetAssemblyTypeName: BlueWater.Uis.TycoonCardArea, Assembly-CSharp
m_MethodName: OnClick
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2