浏览代码

cache RawTouch and dispatch during Input_Update

/siyaoH-1.17-combineTouch
siyao 3 年前
当前提交
a699ee53
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. 18
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs

18
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs


void Input_OnEnable() {
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
UnityEngine.UIWidgets.InitUIWidgets.Init();
UnityEngine.UIWidgets.RawTouchEvent += ProcessRawTouch;
UnityEngine.UIWidgets.RawTouchEvent += CacheRawTouch;
#endif
_inputMode = Input.mousePresent ? UIWidgetsInputMode.Mouse : UIWidgetsInputMode.Touch;
}

Stationary = 2,
Ended = 3,
Canceled = 4
}
void CacheRawTouch(UnityEngine.UIWidgets.RawTouchEventParam param) {
rawTouchEventParams.Enqueue(param);
}
void ProcessRawTouch(UnityEngine.UIWidgets.RawTouchEventParam param) {

break;
}
}
Queue<UnityEngine.UIWidgets.RawTouchEventParam> rawTouchEventParams =
new Queue<UnityEngine.UIWidgets.RawTouchEventParam>();
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
UnityEngine.UIWidgets.RawTouchEvent -= ProcessRawTouch;
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
UnityEngine.UIWidgets.RawTouchEvent -= CacheRawTouch;
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
while (rawTouchEventParams.isNotEmpty()) {
ProcessRawTouch(rawTouchEventParams.Dequeue());
}
#endif
//we only process hover events for desktop applications
if (_inputMode == UIWidgetsInputMode.Mouse) {
if (_isEntered) {

正在加载...
取消
保存