40 lines
998 B
C#
40 lines
998 B
C#
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
|
|
|
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 = "未绑定";
|
|
}
|
|
}
|
|
}
|
|
} |