您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

37 行
1.0 KiB

using Unity.UIWidgets.ui;
using UnityEngine.EventSystems;
namespace Unity.UIWidgets.engine {
public static class InputUtils {
const int mouseScrollId = 1;
const int preservedPointerKeyNum = 10;
public static PointerDeviceKind getPointerDeviceKind() {
#if UNITY_IOS || UNITY_ANDROID
return PointerDeviceKind.touch;
#else
return PointerDeviceKind.mouse;
#endif
}
public static int getPointerDeviceKey(PointerEventData eventData) {
#if UNITY_IOS || UNITY_ANDROID
return getTouchFingerKey(eventData.pointerId);
#else
return getMouseButtonKey((int) eventData.button);
#endif
}
public static int getScrollButtonKey() {
return mouseScrollId;
}
public static int getMouseButtonKey(int buttonId) {
return buttonId + preservedPointerKeyNum;
}
public static int getTouchFingerKey(int fingerId) {
return fingerId + preservedPointerKeyNum;
}
}
}