Yuncong Zhang 6 年前
当前提交
b34c1e93
共有 2 个文件被更改,包括 18 次插入25 次删除
  1. 31
      Runtime/editor/editor_window.cs
  2. 12
      Runtime/ui/window.cs

31
Runtime/editor/editor_window.cs


this.flushMicrotasks();
}
}
static readonly TimeSpan _coolDownDelay = new TimeSpan(0, 0, 0, 0, 200);
static Timer frameCoolDownTimer;
doSpeedUp();
doCoolDown();
onFrameRateSpeedUp();
frameCoolDownTimer?.cancel();
frameCoolDownTimer = instance.run(
_coolDownDelay,
() => {
onFrameRateCoolDown();
frameCoolDownTimer = null;
});
}
public override void render(Scene scene) {

};
this._binding.renderView?.visitChildren(visitor);
}
}
static Timer scheduleFrameTimer;
static void doSpeedUp() {
onFrameRateSpeedUp();
}
static void doCoolDown() {
scheduleFrameTimer?.cancel();
scheduleFrameTimer = instance.run(
new TimeSpan(0, 0, 0, 0, 200),
() => {
onFrameRateCoolDown();
scheduleFrameTimer = null;
});
}
}
}

12
Runtime/ui/window.cs


public const int defaultMaxTargetFrameRate = 60;
public const int defaultMinTargetFrameRate = 15;
static Action _onFrameRateSpeedUp = defaultFrateRateSpeedUp;
static Action _onFrameRateSpeedUp = defaultFrameRateSpeedUp;
_onFrameRateSpeedUp = defaultFrateRateSpeedUp;
_onFrameRateSpeedUp = defaultFrameRateSpeedUp;
}
else {
_onFrameRateSpeedUp = value;

static void defaultFrateRateSpeedUp() {
static void defaultFrameRateSpeedUp() {
static Action _onFrameRateCoolDown = defaultFrateRateCoolDown;
static Action _onFrameRateCoolDown = defaultFrameRateCoolDown;
_onFrameRateCoolDown = defaultFrateRateCoolDown;
_onFrameRateCoolDown = defaultFrameRateCoolDown;
}
else {
_onFrameRateCoolDown = value;

static void defaultFrateRateCoolDown() {
static void defaultFrameRateCoolDown() {
Application.targetFrameRate = defaultMinTargetFrameRate;
}
}
正在加载...
取消
保存