浏览代码

add Promise.Delayed

/main
kg 6 年前
当前提交
f1006919
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 7
      Runtime/promise/Promise_NonGeneric.cs
  2. 13
      Tests/Editor/CanvasAndLayers.cs

7
Runtime/promise/Promise_NonGeneric.cs


promise.Reject(ex);
return promise;
}
public static IPromise Delayed(TimeSpan duration) {
var promise = new Promise();
Window.instance.run(duration, () => { promise.Resolve(); });
return promise;
}
public IPromise Finally(Action onComplete) {
var promise = new Promise(isSync: true);

13
Tests/Editor/CanvasAndLayers.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;

Window.instance = this._windowAdapter;
if (Event.current.type == EventType.MouseDown) {
Promise.Delayed(new TimeSpan(0, 0, 5)).Then(() => { Debug.Log("Promise.Delayed: 5s"); });
}
this._options[this._selected]();
Window.instance = null;

}, null, TileMode.clamp)
};
// canvas.drawRect(
// Unity.UIWidgets.ui.Rect.fromLTRB(10, 10, 110, 110),
// paint);
canvas.rotate(Mathf.PI * 15 / 180);
var path = new Path();
path.moveTo(10, 150);
path.lineTo(10, 160);

}
canvas.drawPath(path, paint);
canvas.rotate(Mathf.PI * 15 / 180);
canvas.translate(100, 100);

正在加载...
取消
保存