mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 14:47:18 +08:00
Merge pull request #10427 from peppy/fix-hidden-first-object
Fix first hitobject in osu! hidden mod not getting correct fade applied
This commit is contained in:
commit
93f5ea57a5
@ -42,7 +42,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private double lastSliderHeadFadeOutStartTime;
|
private double lastSliderHeadFadeOutStartTime;
|
||||||
private double lastSliderHeadFadeOutDuration;
|
private double lastSliderHeadFadeOutDuration;
|
||||||
|
|
||||||
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
|
protected override void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, true);
|
||||||
|
|
||||||
|
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, false);
|
||||||
|
|
||||||
|
private void applyState(DrawableHitObject drawable, bool increaseVisibility)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject d))
|
if (!(drawable is DrawableOsuHitObject d))
|
||||||
return;
|
return;
|
||||||
@ -86,14 +90,23 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
lastSliderHeadFadeOutStartTime = fadeOutStartTime;
|
lastSliderHeadFadeOutStartTime = fadeOutStartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't want to see the approach circle
|
Drawable fadeTarget = circle;
|
||||||
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
|
||||||
circle.ApproachCircle.Hide();
|
if (increaseVisibility)
|
||||||
|
{
|
||||||
|
// only fade the circle piece (not the approach circle) for the increased visibility object.
|
||||||
|
fadeTarget = circle.CirclePiece;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we don't want to see the approach circle
|
||||||
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||||
|
circle.ApproachCircle.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
// fade out immediately after fade in.
|
// fade out immediately after fade in.
|
||||||
using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true))
|
using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true))
|
||||||
circle.FadeOut(fadeOutDuration);
|
fadeTarget.FadeOut(fadeOutDuration);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
|
@ -38,7 +38,15 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
if (IncreaseFirstObjectVisibility.Value)
|
if (IncreaseFirstObjectVisibility.Value)
|
||||||
drawables = drawables.SkipWhile(h => !IsFirstHideableObject(h)).Skip(1);
|
{
|
||||||
|
drawables = drawables.SkipWhile(h => !IsFirstHideableObject(h));
|
||||||
|
|
||||||
|
var firstObject = drawables.FirstOrDefault();
|
||||||
|
if (firstObject != null)
|
||||||
|
firstObject.ApplyCustomUpdateState += ApplyFirstObjectIncreaseVisibilityState;
|
||||||
|
|
||||||
|
drawables = drawables.Skip(1);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var dho in drawables)
|
foreach (var dho in drawables)
|
||||||
dho.ApplyCustomUpdateState += ApplyHiddenState;
|
dho.ApplyCustomUpdateState += ApplyHiddenState;
|
||||||
@ -65,6 +73,20 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply a special visibility state to the first object in a beatmap, if the user chooses to turn on the "increase first object visibility" setting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
|
/// <param name="state">The state of the hit object.</param>
|
||||||
|
protected virtual void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply a hidden state to the provided object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The hit object to apply the state change to.</param>
|
||||||
|
/// <param name="state">The state of the hit object.</param>
|
||||||
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user