mirror of https://github.com/ppy/osu
Merge pull request #26576 from bdach/flashlight-broke
Fix flashlight not dimming if slider head is hit early
This commit is contained in:
commit
c623956b3f
|
@ -77,5 +77,83 @@ public void TestSliderDimsOnlyAfterStartTime()
|
||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSliderDoesDimAfterStartTimeIfHitEarly()
|
||||||
|
{
|
||||||
|
bool sliderDimmed = false;
|
||||||
|
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new OsuModFlashlight(),
|
||||||
|
PassCondition = () =>
|
||||||
|
{
|
||||||
|
sliderDimmed |=
|
||||||
|
Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0;
|
||||||
|
return Player.GameplayState.HasPassed && sliderDimmed;
|
||||||
|
},
|
||||||
|
Beatmap = new OsuBeatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new Slider
|
||||||
|
{
|
||||||
|
StartTime = 1000,
|
||||||
|
Path = new SliderPath(new[]
|
||||||
|
{
|
||||||
|
new PathControlPoint(),
|
||||||
|
new PathControlPoint(new Vector2(100))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReplayFrames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame(990, new Vector2(), OsuAction.LeftButton),
|
||||||
|
new OsuReplayFrame(2000, new Vector2(100), OsuAction.LeftButton),
|
||||||
|
new OsuReplayFrame(2001, new Vector2(100)),
|
||||||
|
},
|
||||||
|
Autoplay = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSliderDoesDimAfterStartTimeIfHitLate()
|
||||||
|
{
|
||||||
|
bool sliderDimmed = false;
|
||||||
|
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new OsuModFlashlight(),
|
||||||
|
PassCondition = () =>
|
||||||
|
{
|
||||||
|
sliderDimmed |=
|
||||||
|
Player.GameplayClockContainer.CurrentTime >= 1000 && Player.ChildrenOfType<ModFlashlight<OsuHitObject>.Flashlight>().Single().FlashlightDim > 0;
|
||||||
|
return Player.GameplayState.HasPassed && sliderDimmed;
|
||||||
|
},
|
||||||
|
Beatmap = new OsuBeatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<OsuHitObject>
|
||||||
|
{
|
||||||
|
new Slider
|
||||||
|
{
|
||||||
|
StartTime = 1000,
|
||||||
|
Path = new SliderPath(new[]
|
||||||
|
{
|
||||||
|
new PathControlPoint(),
|
||||||
|
new PathControlPoint(new Vector2(100))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReplayFrames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new OsuReplayFrame(1100, new Vector2(), OsuAction.LeftButton),
|
||||||
|
new OsuReplayFrame(2000, new Vector2(100), OsuAction.LeftButton),
|
||||||
|
new OsuReplayFrame(2001, new Vector2(100)),
|
||||||
|
},
|
||||||
|
Autoplay = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public partial class OsuModFlashlight : ModFlashlight<OsuHitObject>, IApplicable
|
||||||
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
||||||
{
|
{
|
||||||
if (drawable is DrawableSlider s)
|
if (drawable is DrawableSlider s)
|
||||||
s.Tracking.ValueChanged += _ => flashlight.OnSliderTrackingChange(s);
|
s.OnUpdate += _ => flashlight.OnSliderTrackingChange(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
|
private partial class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
|
||||||
|
|
Loading…
Reference in New Issue