浏览代码

implement ime position, fix future & timer

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
c7ac8d9e
共有 3 个文件被更改,包括 26 次插入4 次删除
  1. 2
      com.unity.uiwidgets/Runtime/async2/future.cs
  2. 6
      com.unity.uiwidgets/Runtime/async2/timer.cs
  3. 22
      com.unity.uiwidgets/Runtime/ui2/window.cs

2
com.unity.uiwidgets/Runtime/async2/future.cs


future.then((object value) => {
remaining--;
if (values != null) {
values[pos] = (T) value;
values.Insert(pos, (T)value);
if (remaining == 0) {
result._completeWithValue(values);
}

6
com.unity.uiwidgets/Runtime/async2/timer.cs


_wakeupTime = UIMonoState_timerMillisecondClock();
}
}
static long _millisecondToNanosecond(long millisecond) {
return millisecond * 1000000L;
}
UIMonoState_postTaskForTime(_postTaskForTime, (IntPtr) callabackHandle, _wakeupTime * 1000L);
UIMonoState_postTaskForTime(_postTaskForTime, (IntPtr) callabackHandle, _millisecondToNanosecond(_wakeupTime));
}
[MonoPInvokeCallback(typeof(UIMonoState_postTaskForTimeCallback))]

22
com.unity.uiwidgets/Runtime/ui2/window.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;
using UnityEngine.UI;
namespace Unity.UIWidgets.ui {
public delegate void VoidCallback();

}
}
protected float queryDevicePixelRatio() {
return _panel.devicePixelRatioOverride;
}
D.assert(false, () => "window.windowPosToScreenPos is not implemented yet!");
return offset;
Camera camera = null;
var canvas = _panel.canvas;
if (canvas.renderMode != RenderMode.ScreenSpaceCamera) {
camera = canvas.GetComponent<GraphicRaycaster>().eventCamera;
}
var pos = new Vector2(offset.dx, offset.dy);
pos = pos * queryDevicePixelRatio() / _panel.canvas.scaleFactor;
var rectTransform = _panel.rectTransform;
var rect = rectTransform.rect;
pos.x += rect.min.x;
pos.y = rect.max.y - pos.y;
var worldPos = rectTransform.TransformPoint(new Vector2(pos.x, pos.y));
var screenPos = RectTransformUtility.WorldToScreenPoint(camera, worldPos);
return new Offset(screenPos.x, Screen.height - screenPos.y);
}
public void run(Action callback) {

正在加载...
取消
保存