完成按键输入按键显示
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user