|
|
|
|
|
|
|
|
|
|
float? _lastUpdateTime; |
|
|
|
|
|
|
|
protected override float getUnscaledDeltaTime() { |
|
|
|
protected override void updateDeltaTime() { |
|
|
|
float deltaTime = (float) EditorApplication.timeSinceStartup - this._lastUpdateTime.Value; |
|
|
|
this.deltaTime = (float) EditorApplication.timeSinceStartup - this._lastUpdateTime.Value; |
|
|
|
this.unscaledDeltaTime = this.deltaTime; |
|
|
|
return deltaTime; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
Window window { get; } |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public abstract class WindowAdapter : Window { |
|
|
|
static readonly List<WindowAdapter> _windowAdapters = new List<WindowAdapter>(); |
|
|
|
|
|
|
|
|
|
|
return TimeSpan.FromSeconds(Time.time); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual float getUnscaledDeltaTime() { |
|
|
|
return Time.unscaledDeltaTime; |
|
|
|
protected float deltaTime; |
|
|
|
protected float unscaledDeltaTime; |
|
|
|
|
|
|
|
protected virtual void updateDeltaTime() { |
|
|
|
this.deltaTime = Time.unscaledDeltaTime; |
|
|
|
this.unscaledDeltaTime = Time.deltaTime; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void updateSafeArea() { |
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
else if (evt.type == EventType.ScrollWheel) { |
|
|
|
this._scrollInput.onScroll(-evt.delta.x * this._devicePixelRatio, |
|
|
|
this.onScroll(-evt.delta.x * this._devicePixelRatio, |
|
|
|
-evt.delta.y * this._devicePixelRatio, |
|
|
|
evt.mousePosition.x * this._devicePixelRatio, |
|
|
|
evt.mousePosition.y * this._devicePixelRatio, |
|
|
|
|
|
|
TextInput.OnGUI(); |
|
|
|
} |
|
|
|
|
|
|
|
void _updateScrollInput() { |
|
|
|
var deltaScroll = this._scrollInput.getScrollDelta(); |
|
|
|
public void onScroll(float deltaX, float deltaY, float posX, float posY, int buttonId) { |
|
|
|
this._scrollInput.onScroll(deltaX, |
|
|
|
deltaY, |
|
|
|
posX, |
|
|
|
posY, |
|
|
|
buttonId |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _updateScrollInput(float deltaTime) { |
|
|
|
var deltaScroll = this._scrollInput.getScrollDelta(deltaTime); |
|
|
|
|
|
|
|
if (deltaScroll == Vector2.zero) { |
|
|
|
return; |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void Update() { |
|
|
|
this.updateDeltaTime(this.getUnscaledDeltaTime()); |
|
|
|
this.updateDeltaTime(); |
|
|
|
this.updateFPS(this.unscaledDeltaTime); |
|
|
|
|
|
|
|
Timer.update(); |
|
|
|
|
|
|
|
|
|
|
this._updateScrollInput(); |
|
|
|
this._updateScrollInput(this.deltaTime); |
|
|
|
TextInput.Update(); |
|
|
|
this._timerProvider.update(this.flushMicrotasks); |
|
|
|
this.flushMicrotasks(); |
|
|
|