|
|
|
|
|
|
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(); |
|
|
|