浏览代码

fix Time. Do not use Stopwatch. Use Time.time.

/main
kg 6 年前
当前提交
2b96915a
共有 2 个文件被更改,包括 27 次插入15 次删除
  1. 40
      Runtime/editor/editor_window.cs
  2. 2
      Runtime/engine/UIWidgetsPanel.cs

40
Runtime/editor/editor_window.cs


using System;
using System.Collections.Generic;
using System.Diagnostics;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;

this._windowAdapter.OnGUI(Event.current);
}
float? lastUpdateTime;
if (this.lastUpdateTime != null) {
float deltaTime = (float)EditorApplication.timeSinceStartup - this.lastUpdateTime.Value;
PerformanceUtils.instance.updateDeltaTime(deltaTime);
}
this.lastUpdateTime = (float) EditorApplication.timeSinceStartup;
this._windowAdapter.Update();
}

protected override Vector2 queryWindowSize() {
return this.editorWindow.position.size;
}
protected override TimeSpan getTime() {
return TimeSpan.FromSeconds(EditorApplication.timeSinceStartup);
}
float? _lastUpdateTime;
protected override float getUnscaledDeltaTime() {
if (this._lastUpdateTime == null) {
this._lastUpdateTime = (float) EditorApplication.timeSinceStartup;
}
float deltaTime = (float) EditorApplication.timeSinceStartup - this._lastUpdateTime.Value;
this._lastUpdateTime = (float) EditorApplication.timeSinceStartup;
return deltaTime;
}
}
#endif

float _lastWindowWidth;
float _lastWindowHeight;
readonly TimeSpan _epoch = new TimeSpan(Stopwatch.GetTimestamp());
bool _regenerateLayerTree;
Surface _surface;

get { return this._alive; }
}
protected virtual TimeSpan getTime() {
return TimeSpan.FromSeconds(Time.time);
}
protected virtual float getUnscaledDeltaTime() {
return Time.unscaledDeltaTime;
}
protected virtual void updateSafeArea() {
}

return new EditorWindowSurface();
}
this.onBeginFrame(new TimeSpan(Stopwatch.GetTimestamp()) - this._epoch);
this.onBeginFrame(this.getTime());
}
this.flushMicrotasks();

}
public void Update() {
PerformanceUtils.instance.updateDeltaTime(this.getUnscaledDeltaTime());
Timer.update();
bool hasFocus = this.hasFocus();

2
Runtime/engine/UIWidgetsPanel.cs


using Unity.UIWidgets.async;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

}
protected virtual void Update() {
PerformanceUtils.instance.updateDeltaTime(Time.unscaledDeltaTime);
this._displayMetrics.Update();
UIWidgetsMessageManager.ensureUIWidgetsMessageManagerIfNeeded();

正在加载...
取消
保存