浏览代码

Merge pull request #166 from Unity-Technologies/siyaoH/1.17/frame

ondemand frame
/main
GitHub 4 年前
当前提交
f0779539
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24
      com.unity.uiwidgets/Runtime/scheduler/binding.cs

24
com.unity.uiwidgets/Runtime/scheduler/binding.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using UnityEngine.Rendering;
using FrameTiming = Unity.UIWidgets.ui.FrameTiming;
namespace Unity.UIWidgets.scheduler {

return;
}
}
static readonly TimeSpan _coolDownDelay = new TimeSpan(0, 0, 0, 0, 200);
static Timer frameCoolDownTimer = null;
public void scheduleFrame() {
if (hasScheduledFrame || !framesEnabled) {

ensureFrameCallbacksRegistered();
Window.instance.scheduleFrame();
hasScheduledFrame = true;
onFrameRateSpeedUp();
frameCoolDownTimer?.cancel();
frameCoolDownTimer = Timer.create(_coolDownDelay,
() => {
onFrameRateCoolDown();
frameCoolDownTimer = null;
}
);
}
public const int defaultMaxRenderFrameInterval = 200;
public const int defaultMinRenderFrameInterval = 1;
void onFrameRateSpeedUp() {
OnDemandRendering.renderFrameInterval = defaultMinRenderFrameInterval;
}
void onFrameRateCoolDown() {
OnDemandRendering.renderFrameInterval = defaultMaxRenderFrameInterval;
}
public void scheduleForcedFrame() {

正在加载...
取消
保存