Remove unnecessary multi-slider tracking logic

This commit is contained in:
David Zhao 2019-04-24 18:25:38 +09:00
parent 4f31eee5ad
commit 8f101e4f60
1 changed files with 2 additions and 18 deletions

View File

@ -36,8 +36,6 @@ public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
{ {
private int slidersCurrentlyTracking;
public OsuFlashlight() public OsuFlashlight()
{ {
FlashlightSize = new Vector2(0, getSizeFor(0)); FlashlightSize = new Vector2(0, getSizeFor(0));
@ -45,22 +43,8 @@ public OsuFlashlight()
public void OnSliderTrackingChange(ValueChangedEvent<bool> e) public void OnSliderTrackingChange(ValueChangedEvent<bool> e)
{ {
// If any sliders are in a tracking state, a further dim should be applied to the (remaining) visible portion of the playfield over a brief duration. // If a slider is in a tracking state, a further dim should be applied to the (remaining) visible portion of the playfield over a brief duration.
if (e.NewValue) this.TransformTo(nameof(FlashlightDim), e.NewValue ? 0.8f : 0.0f, 50);
{
// The transform should only be applied when the first slider begins tracking.
if (++slidersCurrentlyTracking == 1)
this.TransformTo(nameof(FlashlightDim), 0.8f, 50);
}
else
{
if (slidersCurrentlyTracking == 0)
throw new InvalidOperationException($"The number of {nameof(slidersCurrentlyTracking)} cannot be below 0.");
// The fade is restored after the last slider exits a tracked state.
if (--slidersCurrentlyTracking == 0)
this.TransformTo(nameof(FlashlightDim), 0.0f, 50);
}
} }
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)