快捷键操作

This commit is contained in:
bob
2025-06-04 12:55:36 +08:00
parent 30836558ae
commit 55f49e1af7
8 changed files with 90 additions and 32 deletions

View File

@@ -54,6 +54,7 @@ namespace NBF
HideAnim = UIPanelAnimation.GetCenterScaleBig(this, true);
IsModal = true;
IsDontBack = true;
InputManager.OnUICanceled += OnUICanceled;
}
protected override void OnShow()
@@ -65,6 +66,27 @@ namespace NBF
MessageStyle.selectedIndex = _style;
}
private void OnUICanceled(string action)
{
if (!IsShowing) return;
if (!IsTop) return;
if (action == InputDef.UI.Enter)
{
OnClick(BtnConfirm);
}
else if (action == InputDef.UI.Back)
{
OnClick(BtnCancel);
}
}
protected override void OnDestroy()
{
base.OnDestroy();
InputManager.OnUICanceled -= OnUICanceled;
}
private void OnClick(GComponent btn)
{
_callback?.Invoke(btn == BtnConfirm);