mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Add ability to change spin speed in spinner test
This commit is contained in:
parent
f16400929d
commit
0da0855692
@ -6,6 +6,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
@ -26,6 +27,15 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
private TestDrawableSpinner drawableSpinner;
|
||||
|
||||
private readonly BindableDouble spinRate = new BindableDouble();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AddSliderStep("Spin rate", 0.5, 5, 1, val => spinRate.Value = val);
|
||||
}
|
||||
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void TestVariousSpinners(bool autoplay)
|
||||
@ -86,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { OverallDifficulty = od });
|
||||
|
||||
return drawableSpinner = new TestDrawableSpinner(spinner, true)
|
||||
return drawableSpinner = new TestDrawableSpinner(spinner, true, spinRate)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Depth = depthIndex++,
|
||||
@ -114,7 +124,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
||||
|
||||
drawableSpinner = new TestDrawableSpinner(spinner, auto)
|
||||
drawableSpinner = new TestDrawableSpinner(spinner, auto, spinRate)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Depth = depthIndex++,
|
||||
@ -130,18 +140,20 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
private partial class TestDrawableSpinner : DrawableSpinner
|
||||
{
|
||||
private readonly bool auto;
|
||||
private readonly BindableDouble spinRate;
|
||||
|
||||
public TestDrawableSpinner(Spinner s, bool auto)
|
||||
public TestDrawableSpinner(Spinner s, bool auto, BindableDouble spinRate)
|
||||
: base(s)
|
||||
{
|
||||
this.auto = auto;
|
||||
this.spinRate = spinRate;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (auto)
|
||||
RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * 2));
|
||||
RotationTracker.AddRotation((float)(Clock.ElapsedFrameTime * spinRate.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user