浏览代码
Merge branch 'material' into 'master'
Merge branch 'material' into 'master'
support touch input on ios/android mobile device See merge request upm-packages/ui-widgets/com.unity.uiwidgets!82/main
Shenhua Gu
6 年前
当前提交
93bca2f7
共有 3 个文件被更改,包括 94 次插入 和 23 次删除
-
69Runtime/engine/WidgetCanvas.cs
-
37Runtime/engine/input_utils.cs
-
11Runtime/engine/input_utils.cs.meta
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 59b547839c038453d82019f8bef7d407 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue