com.alicizax.unity.ui.exten.../Runtime/UXComponent/Hotkey/HotkeyBindComponent.cs
陈思海 32c0fc13fd 重构
1.重构UXButton
2.主Transition有UXSeletable负责 ,同时兼具导航
3.新增UXSlider  支持平滑过渡 适配手柄
4.优化部分逻辑bug
2025-12-09 15:08:41 +08:00

46 lines
1.1 KiB
C#

#if INPUTSYSTEM_SUPPORT
using AlicizaX.UI.Runtime;
using UnityEngine;
namespace AlicizaX.UI.Extension.UXComponent.Hotkey
{
[DisallowMultipleComponent]
public class HotkeyBindComponent : MonoBehaviour
{
private UIHolderObjectBase _holderObjectBase;
private void Awake()
{
_holderObjectBase = GetComponent<UIHolderObjectBase>();
_holderObjectBase.OnWindowShowEvent += BindHotKeys;
_holderObjectBase.OnWindowClosedEvent += UnBindHotKeys;
}
private void OnDestroy()
{
_holderObjectBase.OnWindowShowEvent -= BindHotKeys;
_holderObjectBase.OnWindowClosedEvent -= UnBindHotKeys;
}
[SerializeField]
private UXHotkeyButton[] hotButtons;
internal void BindHotKeys()
{
for (int i = 0; i < hotButtons.Length; i++)
{
hotButtons[i].BindHotKey();
}
}
internal void UnBindHotKeys()
{
for (int i = 0; i < hotButtons.Length; i++)
{
hotButtons[i].UnBindHotKey();
}
}
}
}
#endif