mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 23:23:30 +08:00
Add coverage for hit circle fade-out duration
This commit is contained in:
parent
69c1cd5b34
commit
e2a370f602
@ -13,6 +13,7 @@ using osu.Framework.Utils;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Edit;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
|
||||
@ -28,25 +29,27 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
public void TestHitCircleAnimationDisable()
|
||||
{
|
||||
HitCircle hitCircle = null;
|
||||
DrawableHitCircle drawableHitCircle = null;
|
||||
|
||||
AddStep("retrieve first hit circle", () => hitCircle = getHitCircle(0));
|
||||
toggleAnimations(true);
|
||||
seekSmoothlyTo(() => hitCircle.StartTime + 10);
|
||||
|
||||
AddAssert("hit circle piece has transforms", () =>
|
||||
{
|
||||
var drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle);
|
||||
return getTransformsRecursively(drawableHitCircle.CirclePiece).Any(t => t.EndTime > EditorClock.CurrentTime);
|
||||
});
|
||||
AddStep("retrieve drawable", () => drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle));
|
||||
AddAssert("hit circle piece has transforms",
|
||||
() => getTransformsRecursively(drawableHitCircle.CirclePiece).Any(t => t.EndTime > EditorClock.CurrentTime));
|
||||
|
||||
AddStep("retrieve second hit circle", () => hitCircle = getHitCircle(1));
|
||||
toggleAnimations(false);
|
||||
seekSmoothlyTo(() => hitCircle.StartTime + 10);
|
||||
|
||||
AddAssert("hit circle piece has no transforms", () =>
|
||||
AddStep("retrieve drawable", () => drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle));
|
||||
AddAssert("hit circle piece has no transforms",
|
||||
() => getTransformsRecursively(drawableHitCircle.CirclePiece).All(t => t.EndTime <= EditorClock.CurrentTime));
|
||||
AddAssert("hit circle has longer fade-out applied", () =>
|
||||
{
|
||||
var drawableHitCircle = (DrawableHitCircle)getDrawableObjectFor(hitCircle);
|
||||
return getTransformsRecursively(drawableHitCircle.CirclePiece).All(t => t.EndTime <= EditorClock.CurrentTime);
|
||||
var alphaTransform = drawableHitCircle.Transforms.Last(t => t.TargetMember == nameof(Alpha));
|
||||
return alphaTransform.EndTime - alphaTransform.StartTime == DrawableOsuEditorRuleset.EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,12 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
public class DrawableOsuEditorRuleset : DrawableOsuRuleset
|
||||
{
|
||||
/// <summary>
|
||||
/// Hit objects are intentionally made to fade out at a constant slower rate than in gameplay.
|
||||
/// This allows a mapper to gain better historical context and use recent hitobjects as reference / snap points.
|
||||
/// </summary>
|
||||
public const double EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION = 700;
|
||||
|
||||
public DrawableOsuEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||
: base(ruleset, beatmap, mods)
|
||||
{
|
||||
@ -46,12 +52,6 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
d.ApplyCustomUpdateState += updateState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hit objects are intentionally made to fade out at a constant slower rate than in gameplay.
|
||||
/// This allows a mapper to gain better historical context and use recent hitobjects as reference / snap points.
|
||||
/// </summary>
|
||||
private const double editor_hit_object_fade_out_extension = 700;
|
||||
|
||||
private void updateState(DrawableHitObject hitObject, ArmedState state)
|
||||
{
|
||||
if (state == ArmedState.Idle || hitAnimations.Value)
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
if (hitObject is DrawableHitCircle circle)
|
||||
{
|
||||
circle.ApproachCircle
|
||||
.FadeOutFromOne(editor_hit_object_fade_out_extension * 4)
|
||||
.FadeOutFromOne(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION * 4)
|
||||
.Expire();
|
||||
|
||||
circle.ApproachCircle.ScaleTo(1.1f, 300, Easing.OutQuint);
|
||||
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
hitObject.RemoveTransform(existing);
|
||||
|
||||
using (hitObject.BeginAbsoluteSequence(hitObject.HitStateUpdateTime))
|
||||
hitObject.FadeOut(editor_hit_object_fade_out_extension).Expire();
|
||||
hitObject.FadeOut(EDITOR_HIT_OBJECT_FADE_OUT_EXTENSION).Expire();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user