From f87efd28dec95e1d857726c5dbb73bdae485de1f Mon Sep 17 00:00:00 2001 From: Ino Date: Fri, 10 Jan 2025 10:18:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EB=B9=84=20botmenu=20=EC=95=A0?= =?UTF-8?q?=EB=8B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Res_Addr/MainUI/NewGameUI.prefab | 187 ++++++++++++++++++++++-- Assets/Script/UI/Common/BotMenu.cs | 55 ++++++- 2 files changed, 228 insertions(+), 14 deletions(-) diff --git a/Assets/Res_Addr/MainUI/NewGameUI.prefab b/Assets/Res_Addr/MainUI/NewGameUI.prefab index 896a7a9a3..efd588662 100644 --- a/Assets/Res_Addr/MainUI/NewGameUI.prefab +++ b/Assets/Res_Addr/MainUI/NewGameUI.prefab @@ -1726,6 +1726,96 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &230632775684196528 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 288084172194771993} + - component: {fileID: 2649292944399785029} + - component: {fileID: 52555683443523375} + - component: {fileID: 2250254578025718475} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &288084172194771993 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230632775684196528} + 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: 4546882025923078743} + m_Father: {fileID: 3239032025348355019} + 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, y: 1} +--- !u!222 &2649292944399785029 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230632775684196528} + m_CullTransparentMesh: 1 +--- !u!114 &52555683443523375 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230632775684196528} + 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: 65f581562538e304cbbfe8ee3beab09c, type: 3} + 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!114 &2250254578025718475 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 230632775684196528} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 --- !u!1 &231750566656321776 GameObject: m_ObjectHideFlags: 0 @@ -15844,7 +15934,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1738194743749524113} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -15853,11 +15943,11 @@ RectTransform: - {fileID: 7667312995523209903} - {fileID: 382330358059753916} - {fileID: 8295776365815767436} - m_Father: {fileID: 4670786236948560329} + m_Father: {fileID: 288084172194771993} 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: -188.2, y: 92.3} + m_AnchoredPosition: {x: -0.0008239746, y: -0.000289917} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &6073836825621844675 @@ -15873,7 +15963,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 0 + m_Left: -257 m_Right: 0 m_Top: 0 m_Bottom: 0 @@ -50240,7 +50330,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5628033596425043958} - - {fileID: 4546882025923078743} + - {fileID: 3239032025348355019} m_Father: {fileID: 2931286266799411332} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} @@ -50261,7 +50351,9 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: go_Camera: {fileID: 0} - tf_layout: {fileID: 4546882025923078743} + rtf_onoff: {fileID: 5628033596425043958} + rtf_layout: {fileID: 4546882025923078743} + m_layout: {fileID: 6073836825621844675} --- !u!1 &5051286401690443021 GameObject: m_ObjectHideFlags: 0 @@ -79134,6 +79226,82 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_localtextKey: 296 +--- !u!1 &8146651848587170604 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3239032025348355019} + - component: {fileID: 4886195220926575564} + - component: {fileID: 8655065850031674027} + m_Layer: 5 + m_Name: Scroll View + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3239032025348355019 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8146651848587170604} + 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: 288084172194771993} + m_Father: {fileID: 4670786236948560329} + 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: 63.88, y: 94} + m_SizeDelta: {x: 534.29, y: 128.62} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4886195220926575564 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8146651848587170604} + m_CullTransparentMesh: 1 +--- !u!114 &8655065850031674027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8146651848587170604} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 4546882025923078743} + m_Horizontal: 1 + m_Vertical: 0 + m_MovementType: 1 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 1 + m_Viewport: {fileID: 288084172194771993} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 0} + m_HorizontalScrollbarVisibility: 2 + m_VerticalScrollbarVisibility: 2 + m_HorizontalScrollbarSpacing: -3 + m_VerticalScrollbarSpacing: -3 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] --- !u!1 &8150718138861807147 GameObject: m_ObjectHideFlags: 0 @@ -85728,7 +85896,6 @@ MonoBehaviour: m_BattleUI: {fileID: 2351113276399051383} arr_PetCard: - {fileID: 5800997328715883900} - go_quickmenu: {fileID: 5040239726474730018} FarmMenu: - {fileID: 2229716252797852782} - {fileID: 3479054844949023046} @@ -89368,7 +89535,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 46.2, y: -177.6} + m_AnchoredPosition: {x: 46.19995, y: -177.59998} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4823950854918263793 @@ -90538,13 +90705,13 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 9196446261128169687} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4670786236948560329} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: -266.50003, y: 87.40001} diff --git a/Assets/Script/UI/Common/BotMenu.cs b/Assets/Script/UI/Common/BotMenu.cs index 2995df37b..28203f28d 100644 --- a/Assets/Script/UI/Common/BotMenu.cs +++ b/Assets/Script/UI/Common/BotMenu.cs @@ -1,10 +1,14 @@ +using System.Collections; using UnityEngine; +using UnityEngine.UI; public class BotMenu : MonoBehaviourSingletonTemplate { - public Transform tf_layout; + public RectTransform rtf_onoff, rtf_layout; + public HorizontalLayoutGroup m_layout; - bool bOn = true; + private bool bOn = true; // 현재 상태 (On/Off) + private bool isAnimating = false; // 애니메이션 진행 여부 확인 private void OnEnable() { @@ -13,12 +17,55 @@ public class BotMenu : MonoBehaviourSingletonTemplate void Set_OnOff() { - for (int i = 0; i < tf_layout.childCount; i++) - tf_layout.GetChild(i).gameObject.SetActive(bOn); + // 애니메이션이 이미 진행 중이라면 실행하지 않음 + if (isAnimating) return; + + StartCoroutine(Co_OnOff()); + } + + IEnumerator Co_OnOff() + { + isAnimating = true; // 애니메이션 시작 + + var targetValue = bOn ? -257 : -800; // 목표 값 + var startValue = m_layout.padding.left; // 시작 값 + var duration = 0.15f; // 애니메이션 시간 + var elapsedTime = 0f; + + // 초기 회전 값과 목표 회전 값 설정 + var startRotation = rtf_onoff.localEulerAngles.z; + var targetRotation = bOn ? -90f : 90f; + + while (elapsedTime < duration) + { + elapsedTime += Time.deltaTime; + var t = Mathf.Clamp01(elapsedTime / duration); + + // 선형 보간으로 padding.left 값을 업데이트 + var newValue = Mathf.Lerp(startValue, targetValue, t); + m_layout.padding.left = Mathf.RoundToInt(newValue); + LayoutRebuilder.ForceRebuildLayoutImmediate(rtf_layout); + + // 선형 보간으로 회전값 업데이트 + var newRotation = Mathf.LerpAngle(startRotation, targetRotation, t); + rtf_onoff.localEulerAngles = new Vector3(rtf_onoff.localEulerAngles.x, rtf_onoff.localEulerAngles.y, newRotation); + + // 변경된 값을 레이아웃에 반영 + m_layout.CalculateLayoutInputHorizontal(); + yield return null; + } + + // 최종 값 설정 + m_layout.padding.left = targetValue; + rtf_onoff.localEulerAngles = new Vector3(rtf_onoff.localEulerAngles.x, rtf_onoff.localEulerAngles.y, targetRotation); + LayoutRebuilder.ForceRebuildLayoutImmediate(rtf_layout); + + isAnimating = false; // 애니메이션 종료 } public void OnClick_OnOff() { + // 상태를 토글하고 애니메이션 시작 bOn = !bOn; Set_OnOff(); }