快捷键操作
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user