1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 18:32:55 +08:00

use playfield clock

This commit is contained in:
MaxOhn 2022-01-06 16:31:30 +01:00
parent 197ada1a8c
commit b3230868cc

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Mods
MaxValue = 1.0f,
};
private DateTime? lastUpdate;
private double? lastUpdate;
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
@ -45,11 +45,12 @@ namespace osu.Game.Rulesets.Osu.Mods
public void Update(Playfield playfield)
{
if (DateTime.Now - (lastUpdate ?? DateTime.MinValue) < TimeSpan.FromMilliseconds(100))
double currentTime = playfield.Clock.CurrentTime;
if (currentTime - (lastUpdate ?? double.MinValue) < 100)
return;
Vector2 cursorPos = playfield.Cursor.ActiveCursor.DrawPosition;
double currentTime = playfield.Clock.CurrentTime;
foreach (var drawable in playfield.HitObjectContainer.AliveObjects.OfType<DrawableOsuHitObject>())
{
@ -66,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Mods
}
}
lastUpdate = DateTime.Now;
lastUpdate = currentTime;
}
}
}