首次提交
This commit is contained in:
40
Assets/Scripts/UI/Common/Button/BtnInputName.cs
Normal file
40
Assets/Scripts/UI/Common/Button/BtnInputName.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using NBF.Setting;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnInputName : GButton
|
||||
{
|
||||
// private InputAction _inputAction;
|
||||
private KeyBoardOption _keyBoardOption;
|
||||
private int _index;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetData(int index, KeyBoardOption boardOption)
|
||||
{
|
||||
_index = index;
|
||||
_keyBoardOption = boardOption;
|
||||
// _inputAction = inputAction;
|
||||
|
||||
|
||||
var bindings = boardOption.InputAction.bindings;
|
||||
|
||||
if (bindings.Count > index)
|
||||
{
|
||||
title = boardOption.GetDisplayString(); //boardOption.InputAction.GetBindingDisplayString(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "未绑定";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user