1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-17 21:43:52 +08:00

Minor formatting changes

This commit is contained in:
MaxOhn 2019-08-19 23:51:47 +02:00
parent 83cb70db17
commit 3434458e0a

View File

@ -23,8 +23,8 @@ namespace osu.Game.Rulesets.Osu.Mods
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModAutoplay), typeof(OsuModWiggle), typeof(OsuModTransform) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModAutopilot), typeof(OsuModAutoplay), typeof(OsuModWiggle), typeof(OsuModTransform) };
private HashSet<DrawableOsuHitObject> movingObjects = new HashSet<DrawableOsuHitObject>(); private readonly HashSet<DrawableOsuHitObject> movingObjects = new HashSet<DrawableOsuHitObject>();
private int updateCounter = 0; private int updateCounter;
public void Update(Playfield playfield) public void Update(Playfield playfield)
{ {
@ -36,7 +36,9 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
// ... every 500th cursor update iteration // ... every 500th cursor update iteration
// (lower -> potential lags ; higher -> easier to miss if cursor too fast) // (lower -> potential lags ; higher -> easier to miss if cursor too fast)
if (updateCounter++ < 500) return; if (updateCounter++ < 500)
return;
updateCounter = 0; updateCounter = 0;
// First move objects to new destination, then remove them from movingObjects set if they're too old // First move objects to new destination, then remove them from movingObjects set if they're too old
@ -45,11 +47,13 @@ namespace osu.Game.Rulesets.Osu.Mods
var currentTime = playfield.Clock.CurrentTime; var currentTime = playfield.Clock.CurrentTime;
var h = d.HitObject; var h = d.HitObject;
d.ClearTransforms(); d.ClearTransforms();
switch (d) switch (d)
{ {
case DrawableHitCircle circle: case DrawableHitCircle circle:
d.MoveTo(drawableCursor.DrawPosition, Math.Max(0, h.StartTime - currentTime)); circle.MoveTo(drawableCursor.DrawPosition, Math.Max(0, h.StartTime - currentTime));
return currentTime > h.StartTime; return currentTime > h.StartTime;
case DrawableSlider slider: case DrawableSlider slider:
// Move slider to cursor // Move slider to cursor
@ -59,11 +63,13 @@ namespace osu.Game.Rulesets.Osu.Mods
// Move slider so that sliderball stays on the cursor // Move slider so that sliderball stays on the cursor
else else
d.MoveTo(drawableCursor.DrawPosition - slider.Ball.DrawPosition, Math.Max(0, h.StartTime - currentTime)); d.MoveTo(drawableCursor.DrawPosition - slider.Ball.DrawPosition, Math.Max(0, h.StartTime - currentTime));
return currentTime > (h as IHasEndTime).EndTime - 50; return currentTime > (h as IHasEndTime)?.EndTime - 50;
case DrawableSpinner spinner:
case DrawableSpinner _:
// TODO // TODO
return true; return true;
} }
return true; // never happens(?) return true; // never happens(?)
}); });
}; };
@ -79,6 +85,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
if (!(drawable is DrawableOsuHitObject d)) if (!(drawable is DrawableOsuHitObject d))
return; return;
var h = d.HitObject; var h = d.HitObject;
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt)) using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
movingObjects.Add(d); movingObjects.Add(d);