完成按键输入按键显示

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

@@ -15,6 +15,14 @@ namespace NBF
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
LeftList.onClickItem.Add(OnClickItem);
InputManager.OnUIInvokeChange += OnUIInvokeChange;
}
public override void Dispose()
{
InputManager.OnUIInvokeChange -= OnUIInvokeChange;
base.Dispose();
}
private void OnClickItem(EventContext context)
@@ -25,29 +33,26 @@ namespace NBF
Debug.Log("模拟点击===");
}
public void Use(UIPanel panel)
private void OnUIInvokeChange()
{
_panel = panel;
List.RemoveChildrenToPool();
LeftList.RemoveChildrenToPool();
// AddButtonItem(OnUse, "");
// AddButtonItem(OnTab, InputDef.UI.Tab);
// AddButtonItem(OnEnter, InputDef.UI.Enter);
// AddButtonItem(OnBack, InputDef.UI.Back);
var invokes = InputManager.Instance.GetUsableInvokes();
foreach (var uiInputInvoke in invokes)
{
var invokeData = uiInputInvoke.InputInvoke;
if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomLeft)
{
AddButton(invokeData.Name, invokeData.Key, false);
}
else if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomRight)
{
AddButton(invokeData.Name, invokeData.Key);
}
}
}
public void AddRightButton(string inputName, string showName = "")
{
AddButton(inputName, string.Empty, true);
}
public void AddLeftButton(string inputName, string showName = "")
{
AddButton(inputName, string.Empty, false);
}
public void AddButton(string inputName, string showName = "", bool isRight = true)
{
if (isRight)