From 6350216fec49b38d3668c70e5e8175419307d476 Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Tue, 5 Aug 2025 13:00:01 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EC=8B=9C=EC=8A=A4?= =?UTF-8?q?=ED=85=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Grid Core/MultiGridUIManager.cs | 20 ++++++------- .../Scripts/SpineDialogueUI.cs | 2 +- Assets/_DDD/_Scripts/GameEvent/GameEvents.cs | 12 +++----- Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs | 11 +++++-- Assets/_DDD/_Scripts/GameUi/BaseUi.cs | 6 ++-- Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs | 26 ++++++----------- .../_DDD/_Scripts/GameUi/GlobalMessageUi.cs | 4 +-- Assets/_DDD/_Scripts/GameUi/PopupUi.cs | 19 +++++------- .../RestaurantManagementUi.cs | 29 ++++++++++--------- Assets/_DDD/_Scripts/GameUi/UiManager.cs | 7 +++-- 10 files changed, 66 insertions(+), 70 deletions(-) diff --git a/Assets/External/EasyGridBuilder Pro/Scripts/Core Grid Scripts/Grid Core/MultiGridUIManager.cs b/Assets/External/EasyGridBuilder Pro/Scripts/Core Grid Scripts/Grid Core/MultiGridUIManager.cs index 985c31eec..967b1bfb1 100644 --- a/Assets/External/EasyGridBuilder Pro/Scripts/Core Grid Scripts/Grid Core/MultiGridUIManager.cs +++ b/Assets/External/EasyGridBuilder Pro/Scripts/Core Grid Scripts/Grid Core/MultiGridUIManager.cs @@ -118,7 +118,7 @@ private void Start() { if (!animationOpenTrigger) { - buildableListAnimator.SetTrigger("Open"); + buildableListAnimator.SetTrigger("OpenPanel"); animationOpenTrigger = true; animationCloseTrigger = false; } @@ -130,7 +130,7 @@ private void Start() { if (!animationCloseTrigger) { - buildableListAnimator.SetTrigger("Close"); + buildableListAnimator.SetTrigger("ClosePanel"); animationOpenTrigger = false; animationCloseTrigger = true; } @@ -300,7 +300,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationOpenTrigger) { - buildableListAnimator.SetTrigger("Open"); + buildableListAnimator.SetTrigger("OpenPanel"); animationOpenTrigger = true; animationCloseTrigger = false; } @@ -312,7 +312,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationCloseTrigger) { - buildableListAnimator.SetTrigger("Close"); + buildableListAnimator.SetTrigger("ClosePanel"); animationOpenTrigger = false; animationCloseTrigger = true; } @@ -325,7 +325,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationOpenTrigger) { - buildableListAnimator.SetTrigger("Open"); + buildableListAnimator.SetTrigger("OpenPanel"); animationOpenTrigger = true; animationCloseTrigger = false; } @@ -337,7 +337,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationCloseTrigger) { - buildableListAnimator.SetTrigger("Close"); + buildableListAnimator.SetTrigger("ClosePanel"); animationOpenTrigger = false; animationCloseTrigger = true; } @@ -350,7 +350,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationOpenTrigger) { - buildableListAnimator.SetTrigger("Open"); + buildableListAnimator.SetTrigger("OpenPanel"); animationOpenTrigger = true; animationCloseTrigger = false; } @@ -362,7 +362,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationCloseTrigger) { - buildableListAnimator.SetTrigger("Close"); + buildableListAnimator.SetTrigger("ClosePanel"); animationOpenTrigger = false; animationCloseTrigger = true; } @@ -375,7 +375,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationOpenTrigger) { - buildableListAnimator.SetTrigger("Open"); + buildableListAnimator.SetTrigger("OpenPanel"); animationOpenTrigger = true; animationCloseTrigger = false; } @@ -387,7 +387,7 @@ private void OnGridModeChangeMethod(object sender, EventArgs e) { if (!animationCloseTrigger) { - buildableListAnimator.SetTrigger("Close"); + buildableListAnimator.SetTrigger("ClosePanel"); animationOpenTrigger = false; animationCloseTrigger = true; } diff --git a/Assets/External/Pixel Crushers/Dialogue System/Third Party Support/Spine Support/Example/Spine Subtitle Panels Example/Scripts/SpineDialogueUI.cs b/Assets/External/Pixel Crushers/Dialogue System/Third Party Support/Spine Support/Example/Spine Subtitle Panels Example/Scripts/SpineDialogueUI.cs index 142920f58..efffe84e4 100644 --- a/Assets/External/Pixel Crushers/Dialogue System/Third Party Support/Spine Support/Example/Spine Subtitle Panels Example/Scripts/SpineDialogueUI.cs +++ b/Assets/External/Pixel Crushers/Dialogue System/Third Party Support/Spine Support/Example/Spine Subtitle Panels Example/Scripts/SpineDialogueUI.cs @@ -4,7 +4,7 @@ namespace PixelCrushers.DialogueSystem.SpineSupport { /// - /// Overrides the StandardDialogueUI Open() method to read the conversation's custom fields. + /// Overrides the StandardDialogueUI OpenPanel() method to read the conversation's custom fields. /// - "Panel # Actor" specifies the actor in panel #. /// - "Panel # Start Visible" specifies whether panel # should start visible. /// diff --git a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs index 4d215e7af..e4c342f34 100644 --- a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs +++ b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs @@ -11,7 +11,6 @@ public static class GameEvents public static OpenPopupUiEvent OpenPopupUiEvent = new(); public static ClosePopupUiEvent ClosePopupUiEvent = new(); public static ShowGlobalMessageEvent ShowGlobalMessageEvent = new(); - public static ShowConfirmPopupUiEvent ShowConfirmPopupUiEvent = new(); public static InventoryChangedEvent InventoryChangedEvent = new(); } @@ -57,22 +56,19 @@ public class ShowGlobalMessageEvent : IEvent public float FadeDuration; } - public class ShowConfirmPopupUiEvent : IEvent + public class OpenPopupUiEvent : IEvent { + public Type UiType; + public string NewMessageKey; public Action OnConfirm; public Action OnCancel; public bool IsCancelButtonVisible; } - public class OpenPopupUiEvent : IEvent - { - public Type UiType; - } - public class ClosePopupUiEvent : IEvent { - public Type UiType; + public Type UiType; } public class InventoryChangedEvent : IEvent diff --git a/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs b/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs index a263f4e06..2a98badd8 100644 --- a/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs @@ -21,11 +21,18 @@ protected override void Update() } } - public override void Open() + public virtual void Open(OpenPopupUiEvent evt) { - base.Open(); + base.OpenPanel(); EventSystem.current.SetSelectedGameObject(GetInitialSelected()); } + + public virtual void Close() + { + var evt = GameEvents.ClosePopupUiEvent; + evt.UiType = GetType(); + EventBus.Broadcast(evt); + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/BaseUi.cs b/Assets/_DDD/_Scripts/GameUi/BaseUi.cs index 4cd951e52..fd0dd0054 100644 --- a/Assets/_DDD/_Scripts/GameUi/BaseUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/BaseUi.cs @@ -17,7 +17,7 @@ protected virtual void Awake() protected virtual void Start() { TryRegister(); - Close(); + ClosePanel(); } protected virtual void Update() @@ -33,7 +33,7 @@ protected virtual void OnDestroy() protected virtual void TryRegister() { } protected virtual void TryUnregister() { } - public virtual void Open() => _panel.SetActive(true); - public virtual void Close() => _panel.SetActive(false); + public virtual void OpenPanel() => _panel.SetActive(true); + public virtual void ClosePanel() => _panel.SetActive(false); } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs b/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs index 2646593fa..ef5305b20 100644 --- a/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/ConfirmUi.cs @@ -8,7 +8,7 @@ namespace DDD { - public class ConfirmUi : PopupUi, IEventHandler + public class ConfirmUi : PopupUi { [SerializeField] private TextMeshProUGUI _messageLabel; [SerializeField] private LocalizeStringEvent _messageLabelLocalizeStringEvent; @@ -29,21 +29,12 @@ protected override void Start() base.Start(); _messageLabel.text = string.Empty; - - EventBus.Register(this); - - Close(); } - - protected override void OnDestroy() + + public override void Open(OpenPopupUiEvent evt) { - base.OnDestroy(); + base.Open(evt); - EventBus.Unregister(this); - } - - public void Invoke(ShowConfirmPopupUiEvent evt) - { _messageLabelLocalizeStringEvent.StringReference = LocalizationManager.Instance.GetLocalizedString(evt.NewMessageKey); _cancelButton.onClick.RemoveAllListeners(); @@ -65,14 +56,13 @@ public void Invoke(ShowConfirmPopupUiEvent evt) _confirmButton.onClick.AddListener(() => _onConfirm?.Invoke()); _cancelButton.gameObject.SetActive(evt.IsCancelButtonVisible); - - Open(); } + // TODO : 두 팝업 사이의 문제 해결 - protected override void OnInputPerformed(RestaurantUiActions actionEnum, InputAction.CallbackContext context) + protected override bool OnInputPerformed(RestaurantUiActions actionEnum, InputAction.CallbackContext context) { - base.OnInputPerformed(actionEnum, context); + if (base.OnInputPerformed(actionEnum, context) == false) return false; switch (actionEnum) { @@ -83,6 +73,8 @@ protected override void OnInputPerformed(RestaurantUiActions actionEnum, InputAc HandleInteract1Performed(); break; } + + return true; } private void HandleCancelPerformed() diff --git a/Assets/_DDD/_Scripts/GameUi/GlobalMessageUi.cs b/Assets/_DDD/_Scripts/GameUi/GlobalMessageUi.cs index e119e5de7..a931ba570 100644 --- a/Assets/_DDD/_Scripts/GameUi/GlobalMessageUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/GlobalMessageUi.cs @@ -54,7 +54,7 @@ private void TryDisplayNext() _isDisplayingMessage = true; _messageText.text = LocalizationManager.Instance.GetString(evt.NewMessageKey); - Open(); + OpenPanel(); _fadeTween?.Kill(); _fadeTween = DOTween.Sequence() @@ -63,7 +63,7 @@ private void TryDisplayNext() .Append(_canvasGroup.DOFade(0f, evt.FadeDuration)) .OnComplete(() => { - Close(); + ClosePanel(); _fadeTween = null; _isDisplayingMessage = false; diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi.cs index 67b66a52c..8b7fb5018 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi.cs @@ -48,21 +48,18 @@ protected override async void TryRegister() var startedHandler = new Action(context => { - //if (!UiManager.Instance.IsTopPopup(this)) return; OnInputStarted(actionEnum, context); }); inputAction.started += startedHandler; var performedHandler = new Action(context => { - //if (!UiManager.Instance.IsTopPopup(this)) return; OnInputPerformed(actionEnum, context); }); inputAction.performed += performedHandler; var canceledHandler = new Action(context => { - //if (!UiManager.Instance.IsTopPopup(this)) return; OnInputCanceled(actionEnum, context); }); inputAction.canceled += canceledHandler; @@ -91,9 +88,9 @@ protected override void TryUnregister() _registeredHandlers.Clear(); } - public override void Open() + public override void Open(OpenPopupUiEvent evt) { - base.Open(); + base.Open(evt); transform.SetAsLastSibling(); @@ -103,19 +100,19 @@ public override void Open() } } - protected virtual void OnInputStarted(T actionEnum, InputAction.CallbackContext context) + protected virtual bool OnInputStarted(T actionEnum, InputAction.CallbackContext context) { - if (!_isTopPopup) return; + return _isTopPopup; } - protected virtual void OnInputPerformed(T actionEnum, InputAction.CallbackContext context) + protected virtual bool OnInputPerformed(T actionEnum, InputAction.CallbackContext context) { - if (!_isTopPopup) return; + return _isTopPopup; } - protected virtual void OnInputCanceled(T actionEnum, InputAction.CallbackContext context) + protected virtual bool OnInputCanceled(T actionEnum, InputAction.CallbackContext context) { - if (!_isTopPopup) return; + return _isTopPopup; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs index 40d286ed5..c748bf0cc 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -30,11 +30,13 @@ protected override void Update() var multiply = _holdCompleteTime / 1f; if (_elapsedTime >= 1f) { - HandleInteract2Canceled(); // TODO : 추후에 팝업 연결 - var evt = GameEvents.ShowConfirmPopupUiEvent; + // TODO : 추후에 체크리스트와 비교해서 팝업 띄울지 말지 결정 + HandleInteract2Canceled(); + var evt = GameEvents.OpenPopupUiEvent; + evt.UiType = typeof(ConfirmUi); evt.IsCancelButtonVisible = true; evt.NewMessageKey = "Global_Message_001"; - evt.OnConfirm = Close; + evt.OnConfirm = ClosePanel; EventBus.Broadcast(evt); //HandleCancelPerformed(); return; @@ -57,9 +59,9 @@ protected override GameObject GetInitialSelected() return _cookwareCategoryTabs.GetFirstInteractableButton; } - public async override void Open() + public async override void Open(OpenPopupUiEvent evt) { - base.Open(); + base.Open(evt); await _inventoryView.Initialize(); _sectionTabs.Initialize(OnSectionTabSelected); @@ -78,9 +80,9 @@ public override void Close() EventBus.Unregister(this); } - protected override void OnInputPerformed(RestaurantUiActions actionEnum, InputAction.CallbackContext context) + protected override bool OnInputPerformed(RestaurantUiActions actionEnum, InputAction.CallbackContext context) { - base.OnInputPerformed(actionEnum, context); + if (base.OnInputPerformed(actionEnum, context) == false) return false; switch (actionEnum) { @@ -100,11 +102,13 @@ protected override void OnInputPerformed(RestaurantUiActions actionEnum, InputAc HandleInteract2Performed(); break; } + + return true; } - protected override void OnInputCanceled(RestaurantUiActions actionEnum, InputAction.CallbackContext context) + protected override bool OnInputCanceled(RestaurantUiActions actionEnum, InputAction.CallbackContext context) { - base.OnInputCanceled(actionEnum, context); + if (base.OnInputPerformed(actionEnum, context) == false) return false; switch (actionEnum) { @@ -112,13 +116,13 @@ protected override void OnInputCanceled(RestaurantUiActions actionEnum, InputAct HandleInteract2Canceled(); break; } + + return true; } private void HandleCancelPerformed() { - var evt = GameEvents.ClosePopupUiEvent; - evt.UiType = GetType(); - EventBus.Broadcast(evt); + Close(); } private void HandleMoveTabPerformed(int direction) @@ -133,7 +137,6 @@ private void HandleInteract1Performed() interactable?.OnInteract(); } - // TODO : 버튼과 연동 private void HandleInteract2Performed() { _isHolding = true; diff --git a/Assets/_DDD/_Scripts/GameUi/UiManager.cs b/Assets/_DDD/_Scripts/GameUi/UiManager.cs index 09f964d64..9e67bc0dc 100644 --- a/Assets/_DDD/_Scripts/GameUi/UiManager.cs +++ b/Assets/_DDD/_Scripts/GameUi/UiManager.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Sirenix.OdinInspector; namespace DDD { public class UiManager : Singleton, IManager, IEventHandler, IEventHandler { private readonly Dictionary _popupUIs = new(); - private readonly Stack _popupStack = new(); + [ReadOnly, ShowInInspector] private readonly Stack _popupStack = new(); private InputActionMaps _previousActionMap = InputActionMaps.None; private readonly object _uiPauseRequester = new(); @@ -57,7 +58,7 @@ public void Invoke(OpenPopupUiEvent evt) if (!popup.IsOpen) { PushPopup(popup); - popup.Open(); + popup.Open(evt); if (popup.IsBlockingTime) { @@ -76,7 +77,7 @@ public void Invoke(ClosePopupUiEvent evt) { if (popup.IsOpen) { - popup.Close(); + popup.ClosePanel(); PopPopup(popup); if (popup.IsBlockingTime)