HKMBFZ/Assets/Scripts/Szz_Scripts/ModelBtnManager.cs

79 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public enum ButtonType
{
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
,
,
,
,
num1,num2, num3, num4, num5, num6,num7, num8, num9,num0,
,
退,
,
,
,,
,,
,
,
,
,
,
}
public class ModelBtnManager : MonoBehaviour
{
// 所有按钮的控制器
public ModelButtonController[] modelButtons;
// 使用字典来映射按钮类型与其对应的事件
private Dictionary<ButtonType, UnityEvent> buttonActions = new Dictionary<ButtonType, UnityEvent>();
void Start()
{
// 初始时可以绑定一些默认事件
//buttonActions.Add(ButtonType.Button1, new UnityEvent());
//buttonActions.Add(ButtonType.Button2, new UnityEvent());
//buttonActions.Add(ButtonType.Button3, new UnityEvent());
// 设置按钮事件
//SetupPanel();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.F1))
{
Debug.Log("F1");
}
}
/// <summary>
/// 清除所有按钮事件
/// </summary>
public void ClearAllBtnEvent()
{
foreach (var btn in modelButtons)
{
btn.ClearAllEvent();
}
}
}