完成按键输入按键显示

This commit is contained in:
2026-02-01 23:46:11 +08:00
parent e05561ff43
commit ebef45c4a3
95 changed files with 426 additions and 341 deletions

View File

@@ -42,10 +42,10 @@ namespace NBF
protected override void OnShow()
{
InputManager.Instance.Off(this);
InputManager.Instance.On(this);
SetActionIcon();
Settings.Instance.LoadAllSettings();
MenuList.SetTabs(tabList);
UseBottomMenu();
}
private void ChangeTab(int index)
@@ -109,11 +109,6 @@ namespace NBF
}
}
private void UseBottomMenu()
{
BottomMenu.Use(this);
}
private void OnResetSettings()
{
@@ -173,6 +168,15 @@ namespace NBF
Introduce.TextIntroduce.SetLanguage(item.Option.Name);
// Introduce.
}
for (var i = 0; i < _canSelectIndex.Count; i++)
{
var targetIndex = _canSelectIndex[i];
if (targetIndex == index)
{
_nowSelectIndex = i;
}
}
}
@@ -194,8 +198,26 @@ namespace NBF
#region Input Evnet
[InputInvoke(InputDef.UI.SubPrev)]
private void OnSubPrev()
private void SetActionIcon()
{
MenuList.SetBtnActionName(InputDef.UI.Prev, InputDef.UI.Next);
}
[InputInvoke(InputDef.UI.Prev, UIInputButtonShowMode.MenuLeft)]
private void OnPrev()
{
MenuList.OnClickBtnPrev();
}
[InputInvoke(InputDef.UI.Next, UIInputButtonShowMode.MenuRight)]
private void OnNext()
{
MenuList.OnClickBtnNext();
}
[InputInvoke(InputDef.UI.Left, UIInputButtonShowMode.BottomLeft)]
private void OnLeft()
{
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
{
@@ -203,8 +225,8 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.SubNext)]
private void OnSubNext()
[InputInvoke(InputDef.UI.Right, UIInputButtonShowMode.BottomLeft)]
private void OnRight()
{
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
{
@@ -212,19 +234,42 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.Up)]
[InputInvoke(InputDef.UI.Up, UIInputButtonShowMode.BottomLeft)]
private void OnUp()
{
ChangeListSelected();
}
[InputInvoke(InputDef.UI.Down)]
[InputInvoke(InputDef.UI.Down, UIInputButtonShowMode.BottomLeft)]
private void OnDown()
{
ChangeListSelected(false);
}
[InputInvoke(InputDef.UI.Back)]
[InputInvoke(InputDef.UI.Enter, UIInputButtonShowMode.BottomRight, "保存")]
private void OnApplySettings()
{
var options = Settings.Instance.GetOptionsByTab(_currentTab);
Log.Info("OnApplySettings");
foreach (var option in options)
{
option.Apply();
}
Notices.Success("TEXT_OP_SUCCESS");
}
[InputInvoke(InputDef.UI.Reset, UIInputButtonShowMode.BottomRight, "重置")]
private void OnReset()
{
MessageBox.Show("是否重置为默认?", (ret) =>
{
if (ret) OnResetSettings();
});
}
[InputInvoke(InputDef.UI.Back, UIInputButtonShowMode.BottomRight, "返回")]
private void OnBack()
{
if (Settings.Instance.HaveNotAppleSettings())
@@ -244,28 +289,6 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.Enter)]
private void OnApplySettings()
{
var options = Settings.Instance.GetOptionsByTab(_currentTab);
Log.Info("OnApplySettings");
foreach (var option in options)
{
option.Apply();
}
Notices.Success("TEXT_OP_SUCCESS");
}
[InputInvoke(InputDef.UI.Reset)]
private void OnReset()
{
MessageBox.Show("是否重置为默认?", (ret) =>
{
if (ret) OnResetSettings();
});
}
#endregion
protected override void OnHide()