mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
extend TestCaseHitCircle with new steps
- Hidden, Size and Scale - also fix Auto still missing because no judgement was created
This commit is contained in:
@ -41,10 +41,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
foreach (var d in drawables.OfType<DrawableOsuHitObject>())
|
foreach (var d in drawables.OfType<DrawableOsuHitObject>())
|
||||||
d.ApplyCustomUpdateState += customSequence;
|
d.ApplyCustomUpdateState += CustomSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void customSequence(DrawableHitObject drawable, ArmedState state)
|
protected void CustomSequence(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject d))
|
if (!(drawable is DrawableOsuHitObject d))
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise
|
circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise
|
||||||
break;
|
break;
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
slider.InitialCircle.ApplyCustomUpdateState += customSequence;
|
slider.InitialCircle.ApplyCustomUpdateState += CustomSequence;
|
||||||
|
|
||||||
using (slider.BeginAbsoluteSequence(fadeOutTime, true))
|
using (slider.BeginAbsoluteSequence(fadeOutTime, true))
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,9 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -21,7 +24,10 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private bool auto;
|
private bool auto;
|
||||||
|
private bool hidden;
|
||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
|
private int circleSize;
|
||||||
|
private float circleScale;
|
||||||
|
|
||||||
public TestCaseHitCircle()
|
public TestCaseHitCircle()
|
||||||
{
|
{
|
||||||
@ -30,6 +36,9 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
AddStep("Single", () => addSingle());
|
AddStep("Single", () => addSingle());
|
||||||
AddStep("Stream", addStream);
|
AddStep("Stream", addStream);
|
||||||
AddToggleStep("Auto", v => auto = v);
|
AddToggleStep("Auto", v => auto = v);
|
||||||
|
AddToggleStep("Hidden", v => hidden = v);
|
||||||
|
AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s);
|
||||||
|
AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
private void addSingle(double timeOffset = 0, Vector2? positionOffset = null)
|
||||||
@ -39,20 +48,25 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
var circle = new HitCircle
|
var circle = new HitCircle
|
||||||
{
|
{
|
||||||
StartTime = Time.Current + 1000 + timeOffset,
|
StartTime = Time.Current + 1000 + timeOffset,
|
||||||
Position = positionOffset.Value
|
Position = positionOffset.Value,
|
||||||
|
ComboColour = Color4.LightSeaGreen
|
||||||
};
|
};
|
||||||
|
|
||||||
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 });
|
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
||||||
|
|
||||||
var drawable = new DrawableHitCircle(circle)
|
var drawable = new TestDrawableHitCircle(circle, auto)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
Scale = new Vector2(circleScale),
|
||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
};
|
};
|
||||||
|
|
||||||
if (auto)
|
if (auto)
|
||||||
drawable.State.Value = ArmedState.Hit;
|
drawable.State.Value = ArmedState.Hit;
|
||||||
|
|
||||||
|
if (hidden)
|
||||||
|
drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence;
|
||||||
|
|
||||||
Add(drawable);
|
Add(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,5 +80,33 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
pos += new Vector2(10);
|
pos += new Vector2(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestOsuModHidden : OsuModHidden
|
||||||
|
{
|
||||||
|
public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestDrawableHitCircle : DrawableHitCircle
|
||||||
|
{
|
||||||
|
private readonly bool auto;
|
||||||
|
|
||||||
|
public TestDrawableHitCircle(OsuHitObject h, bool auto) : base(h)
|
||||||
|
{
|
||||||
|
this.auto = auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||||
|
{
|
||||||
|
if (auto && !userTriggered && timeOffset > 0)
|
||||||
|
{
|
||||||
|
// pretend we really hit it
|
||||||
|
AddJudgement(new OsuJudgement
|
||||||
|
{
|
||||||
|
Result = HitObject.ScoreResultForOffset(timeOffset)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
base.CheckForJudgements(userTriggered, timeOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user