팝업 시스템 수정
This commit is contained in:
parent
6bfd22161c
commit
6350216fec
@ -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;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace PixelCrushers.DialogueSystem.SpineSupport
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class ConfirmUi : PopupUi<RestaurantUiActions>, IEventHandler<ShowConfirmPopupUiEvent>
|
||||
public class ConfirmUi : PopupUi<RestaurantUiActions>
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI _messageLabel;
|
||||
[SerializeField] private LocalizeStringEvent _messageLabelLocalizeStringEvent;
|
||||
@ -29,21 +29,12 @@ protected override void Start()
|
||||
base.Start();
|
||||
|
||||
_messageLabel.text = string.Empty;
|
||||
|
||||
EventBus.Register<ShowConfirmPopupUiEvent>(this);
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
|
||||
public override void Open(OpenPopupUiEvent evt)
|
||||
{
|
||||
base.OnDestroy();
|
||||
base.Open(evt);
|
||||
|
||||
EventBus.Unregister<ShowConfirmPopupUiEvent>(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()
|
||||
|
@ -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;
|
||||
|
||||
|
@ -48,21 +48,18 @@ protected override async void TryRegister()
|
||||
|
||||
var startedHandler = new Action<InputAction.CallbackContext>(context =>
|
||||
{
|
||||
//if (!UiManager.Instance.IsTopPopup(this)) return;
|
||||
OnInputStarted(actionEnum, context);
|
||||
});
|
||||
inputAction.started += startedHandler;
|
||||
|
||||
var performedHandler = new Action<InputAction.CallbackContext>(context =>
|
||||
{
|
||||
//if (!UiManager.Instance.IsTopPopup(this)) return;
|
||||
OnInputPerformed(actionEnum, context);
|
||||
});
|
||||
inputAction.performed += performedHandler;
|
||||
|
||||
var canceledHandler = new Action<InputAction.CallbackContext>(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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<TodayMenuRemovedEvent>(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;
|
||||
|
@ -2,13 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class UiManager : Singleton<UiManager>, IManager, IEventHandler<OpenPopupUiEvent>, IEventHandler<ClosePopupUiEvent>
|
||||
{
|
||||
private readonly Dictionary<Type, BasePopupUi> _popupUIs = new();
|
||||
private readonly Stack<BasePopupUi> _popupStack = new();
|
||||
[ReadOnly, ShowInInspector] private readonly Stack<BasePopupUi> _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)
|
||||
|
Loading…
Reference in New Issue
Block a user