MAME.Core/MAME.Unity/Assets/Script/UMAME/UniInterface/UniKeyboard.cs

77 lines
2.4 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using UnityEngine;
2024-08-30 17:33:22 +08:00
public class UniKeyboard : MonoBehaviour
{
2024-08-30 17:33:22 +08:00
public KeyCodeCore mKeyCodeCore = new KeyCodeCore();
#region
public UILongClickButton btnP1;
public UILongClickButton btnCoin1;
public UILongClickButton btnA;
public UILongClickButton btnB;
public UILongClickButton btnC;
public UILongClickButton btnD;
2024-08-30 17:33:22 +08:00
//public UILongClickButton btnE;
//public UILongClickButton btnF;
public UILongClickButton btnAB;
public UILongClickButton btnCD;
public UILongClickButton btnABC;
public Transform tfKeyPad;
2024-08-30 17:33:22 +08:00
public FloatingJoystick mJoystick;
#endregion
2024-08-30 17:33:22 +08:00
public List<UILongClickButton> mUIBtns = new List<UILongClickButton>();
void Awake()
{
mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>();
tfKeyPad = GameObject.Find("tfKeyPad").transform;
btnP1 = GameObject.Find("btnP1").GetComponent<UILongClickButton>();
btnCoin1 = GameObject.Find("btnCoin1").GetComponent<UILongClickButton>();
btnA = GameObject.Find("btnA").GetComponent<UILongClickButton>();
btnB = GameObject.Find("btnB").GetComponent<UILongClickButton>();
btnC = GameObject.Find("btnC").GetComponent<UILongClickButton>();
btnD = GameObject.Find("btnD").GetComponent<UILongClickButton>();
2024-08-30 17:33:22 +08:00
//btnE = GameObject.Find("btnE")?.GetComponent<UILongClickButton>();
//btnF = GameObject.Find("btnF")?.GetComponent<UILongClickButton>();
btnAB = GameObject.Find("btnAB").GetComponent<UILongClickButton>();
btnCD = GameObject.Find("btnCD").GetComponent<UILongClickButton>();
btnABC = GameObject.Find("btnABC").GetComponent<UILongClickButton>();
mUIBtns.Add(btnP1);
mUIBtns.Add(btnCoin1);
mUIBtns.Add(btnA);
mUIBtns.Add(btnB);
mUIBtns.Add(btnC);
mUIBtns.Add(btnD);
mUIBtns.Add(btnAB);
mUIBtns.Add(btnCD);
mUIBtns.Add(btnABC);
2024-08-30 17:33:22 +08:00
//if (btnE != null)
//{
// mUIBtns.Add(btnE);
// btnE.gameObject.SetActive(false);
//}
//else
//{
// mUIBtns.Add(btnF);
// btnF.gameObject.SetActive(false);
//}
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
tfKeyPad.gameObject.SetActive(false);
#endif
mKeyCodeCore.Init(this,false);
}
2024-08-30 17:33:22 +08:00
void OnEnable()
{
}
void Update()
{
2024-08-30 17:33:22 +08:00
mKeyCodeCore.UpdateLogic();
}
}