From 3decbe16d015444323d4d08ff2c60b890e488c5b Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Tue, 5 Aug 2025 14:14:39 +0900 Subject: [PATCH] =?UTF-8?q?ui=20navigation=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_ScriptAssets/Prefabs/UiManager.prefab | 26 +++++++++++++++++++ Assets/_DDD/_Scripts/GameUi/BaseUi.cs | 8 ++++++ Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs | 4 +-- .../RestaurantManagementUi.cs | 1 - Assets/_DDD/_Scripts/GameUi/UiManager.cs | 15 +++++++++++ 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab index bd1487947..98ea62fbc 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab +++ b/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab @@ -2087,6 +2087,7 @@ GameObject: m_Component: - component: {fileID: 6555851050378238242} - component: {fileID: 895343445285308768} + - component: {fileID: 1368992355976611131} m_Layer: 5 m_Name: RestaurantManagementUi m_TagString: Untagged @@ -2133,6 +2134,18 @@ MonoBehaviour: _cookwareCategoryTabs: {fileID: 195952124745473889} _completeBatchFilledImage: {fileID: 4012160685168048845} _holdCompleteTime: 1 +--- !u!225 &1368992355976611131 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3049036770990482859} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 --- !u!1 &3260392999935947701 GameObject: m_ObjectHideFlags: 0 @@ -7710,6 +7723,7 @@ GameObject: m_Component: - component: {fileID: 5810968388153251297} - component: {fileID: 4354590683901102911} + - component: {fileID: 8448676306840617674} m_Layer: 5 m_Name: ConfirmUi m_TagString: Untagged @@ -7753,6 +7767,18 @@ MonoBehaviour: _messageLabelLocalizeStringEvent: {fileID: 454474333795482723} _cancelButton: {fileID: 8075936514757677367} _confirmButton: {fileID: 770991170480152559} +--- !u!225 &8448676306840617674 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8821125485568642200} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 --- !u!1 &8845694206544237833 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/_DDD/_Scripts/GameUi/BaseUi.cs b/Assets/_DDD/_Scripts/GameUi/BaseUi.cs index fd0dd0054..ac18cdc94 100644 --- a/Assets/_DDD/_Scripts/GameUi/BaseUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/BaseUi.cs @@ -5,12 +5,14 @@ namespace DDD { public abstract class BaseUi : MonoBehaviour { + protected CanvasGroup _canvasGroup; protected GameObject _panel; public virtual bool IsBlockingTime => false; public virtual bool IsOpen => _panel.activeSelf; protected virtual void Awake() { + _canvasGroup = GetComponent(); _panel = transform.Find(CommonConstants.Panel).gameObject; } @@ -35,5 +37,11 @@ protected virtual void TryUnregister() { } public virtual void OpenPanel() => _panel.SetActive(true); public virtual void ClosePanel() => _panel.SetActive(false); + + public virtual void SetUiInteractable(bool active) + { + _canvasGroup.interactable = active; + _canvasGroup.blocksRaycasts = active; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs b/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs index ef5305b20..0d6015b27 100644 --- a/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs @@ -18,7 +18,6 @@ public class ConfirmUi : PopupUi private Action _onCancel; private Action _onConfirm; - // TODO : 마지막 팝업에서만 NAVIGATION protected override GameObject GetInitialSelected() { return _confirmButton.gameObject; @@ -58,8 +57,7 @@ public override void Open(OpenPopupUiEvent evt) _cancelButton.gameObject.SetActive(evt.IsCancelButtonVisible); } - - // TODO : 두 팝업 사이의 문제 해결 + protected override bool OnInputPerformed(RestaurantUiActions actionEnum, InputAction.CallbackContext context) { if (base.OnInputPerformed(actionEnum, context) == false) return false; diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs index c748bf0cc..a57817096 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -162,7 +162,6 @@ private void OnSectionTabSelected(RestaurantManagementSectionType section) default: throw new ArgumentOutOfRangeException(nameof(section), section, null); } - // TODO : 추후 Menu, Cookware, Worker에 맞춰 다른 콘텐츠 노출 처리 } private void OnCategoryTabSelected(InventoryCategoryType category) diff --git a/Assets/_DDD/_Scripts/GameUi/UiManager.cs b/Assets/_DDD/_Scripts/GameUi/UiManager.cs index 9e67bc0dc..21d28a412 100644 --- a/Assets/_DDD/_Scripts/GameUi/UiManager.cs +++ b/Assets/_DDD/_Scripts/GameUi/UiManager.cs @@ -106,6 +106,8 @@ public void PushPopup(BasePopupUi popup) } _popupStack.Push(popup); + + UpdatePopupCanvasGroups(); } public void PopPopup(BasePopupUi popup) @@ -134,6 +136,19 @@ public void PopPopup(BasePopupUi popup) { InputManager.Instance.SwitchCurrentActionMap(_previousActionMap); } + + UpdatePopupCanvasGroups(); + } + + private void UpdatePopupCanvasGroups() + { + if (_popupStack.Count == 0) return; + + foreach (var popupUi in _popupStack) + { + bool isTop = IsTopPopup(popupUi); + popupUi.SetUiInteractable(isTop); + } } } } \ No newline at end of file