26 lines
816 B
C#
26 lines
816 B
C#
using UnityEngine;
|
|
using LhorionIOSSDK;
|
|
|
|
public class InputHelper : MonoBehaviour
|
|
{
|
|
public static InputHelper Instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance == null) Instance = this;
|
|
else Destroy(gameObject);
|
|
}
|
|
|
|
// 触控数量(原生Touch无替换要求)
|
|
public int TouchCount => XInput.touchCount;
|
|
|
|
// 获取单点Touch
|
|
public Touch GetTouch(int index) => XInput.GetTouch(index);
|
|
|
|
public bool GetMouseButtonDown(int button) => XInput.GetMouseButtonDown(button);
|
|
public bool GetMouseButton(int button) => XInput.GetMouseButton(button);
|
|
public bool GetMouseButtonUp(int button) => XInput.GetMouseButtonUp(button);
|
|
|
|
// 重点:替换为SDK XInput.mousePosition
|
|
public Vector3 MousePosition => XInput.mousePosition;
|
|
} |