Treat non-DrawableHitCircle's similar to OsuModHidden

This commit is contained in:
MaxOhn 2018-10-09 18:36:12 +02:00
parent 1366b53a71
commit 954bcd8c12
2 changed files with 59 additions and 4 deletions

View File

@ -1,11 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
@ -21,11 +24,61 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{ {
foreach (var drawable in drawables) foreach (var drawable in drawables)
drawable.ApplyCustomUpdateState += ApplyTraceableState;
}
/* Similar to ApplyHiddenState, only different if drawable is DrawableHitCircle.
* If we'd use ApplyHiddenState instead but only on non-DrawableHitCircle's, then
* the nested object HeadCircle of DrawableSlider would still use ApplyHiddenState,
* thus treating the DrawableHitCircle with the hidden mod instead of the traceable mod.
*/
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
{
if (!(drawable is DrawableOsuHitObject d))
return;
var h = d.HitObject;
var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadeIn;
// new duration from completed fade in to end (before fading out)
var longFadeDuration = ((h as IHasEndTime)?.EndTime ?? h.StartTime) - fadeOutStartTime;
switch (drawable)
{ {
if (drawable is DrawableHitCircle c) case DrawableHitCircle circle:
c.HideButApproachCircle(); // we only want to see the approach circle
if (drawable is DrawableSlider s) using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
s.HeadCircle.HideButApproachCircle(); circle.HideButApproachCircle();
// approach circle fades out quickly at StartTime
using (drawable.BeginAbsoluteSequence(h.StartTime, true))
circle.ApproachCircle.FadeOut(50);
break;
case DrawableSlider slider:
using (slider.BeginAbsoluteSequence(fadeOutStartTime, true))
slider.Body.FadeOut(longFadeDuration, Easing.Out);
break;
case DrawableSliderTick sliderTick:
// slider ticks fade out over up to one second
var tickFadeOutDuration = Math.Min(sliderTick.HitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000);
using (sliderTick.BeginAbsoluteSequence(sliderTick.HitObject.StartTime - tickFadeOutDuration, true))
sliderTick.FadeOut(tickFadeOutDuration);
break;
case DrawableSpinner spinner:
// hide elements we don't care about.
spinner.Disc.Hide();
spinner.Ticks.Hide();
spinner.Background.Hide();
using (spinner.BeginAbsoluteSequence(fadeOutStartTime + longFadeDuration, true))
spinner.FadeOut(h.TimePreempt);
break;
} }
} }
} }

View File

@ -81,6 +81,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circle.Hide(); circle.Hide();
circle.AlwaysPresent = true; circle.AlwaysPresent = true;
ring.Hide(); ring.Hide();
flash.Hide();
explode.Hide();
number.Hide(); number.Hide();
glow.Hide(); glow.Hide();
} }