1
0
mirror of synced 2024-12-04 18:47:58 +01:00
WACVR/Assets/Script/Configuration/ButtonSettingManager.cs
2022-11-05 01:32:17 +01:00

30 lines
792 B
C#

using UnityEngine;
using System;
using TMPro;
using WindowsInput.Native;
public class ButtonSettingManager : MonoBehaviour
{
public ButtonType buttonType;
private PanelButton panelButton;
void Start()
{
panelButton = GetComponent<PanelButton>();
var widget = ConfigManager.GetConfigPanelWidget(Enum.GetName(typeof(ButtonType), buttonType));
var dropdown = widget.GetComponent<TMP_Dropdown>();
dropdown.onValueChanged.AddListener((int value) => {
panelButton.key = (VirtualKeyCode)Enum.GetValues(typeof(VirtualKeyCode)).GetValue(value);
});
dropdown.onValueChanged?.Invoke(dropdown.value);
}
public enum ButtonType
{
Test = 0,
Service = 1,
Coin = 2,
Custom = 3,
}
}