浏览代码

Merge branch 'framerate' into yczhang

/main
Yuncong Zhang 6 年前
当前提交
3cb81034
共有 2 个文件被更改,包括 20 次插入3 次删除
  1. 21
      Runtime/editor/editor_window.cs
  2. 2
      Tests/Editor/CanvasAndLayers.cs

21
Runtime/editor/editor_window.cs


bool _alive;
Timer scheduleFrameTimer;
const int maxTargetFrameRate = 60;
const int minTargetFrameRate = 15;
const int targetFrameRateAdaptStep = 10;
public bool alive {
get { return this._alive; }
}

D.assert(this._surface != null);
this._surface.Dispose();
this._surface = null;
QualitySettings.vSyncCount = 0;
}
public override IDisposable getScope() {

if (regenerateLayerTree) {
this._regenerateLayerTree = true;
}
}
Application.targetFrameRate = maxTargetFrameRate;
this.scheduleFrameTimer?.cancel();
this.scheduleFrameTimer = instance.run(
new TimeSpan(0, 0, 0, 1),
() => {
if (Application.targetFrameRate > minTargetFrameRate)
Application.targetFrameRate -= targetFrameRateAdaptStep;
else {
Application.targetFrameRate = minTargetFrameRate;
this.scheduleFrameTimer.cancel();
this.scheduleFrameTimer = null;
}
}, true);
}
public override void render(Scene scene) {
var layerTree = scene.takeLayerTree();

2
Tests/Editor/CanvasAndLayers.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEditor;
using UnityEditor.Experimental.UIElements;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Gradient = Unity.UIWidgets.ui.Gradient;

this._selected = 0;
this.titleContent = new GUIContent("CanvasAndLayers");
this.SetAntiAliasing(4);
}
void OnGUI() {

正在加载...
取消
保存