diff --git a/osu.Android.props b/osu.Android.props
index 5497a82a7a..e5a1ec2f4e 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -54,6 +54,6 @@
-
+
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs
index 4676f14655..bbb50c287b 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs
@@ -7,12 +7,10 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
-using osu.Framework.Graphics;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
-using osu.Game.Screens;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
@@ -21,7 +19,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Tests
{
- public class TestSceneLegacyBeatmapSkin : OsuTestScene
+ public class TestSceneLegacyBeatmapSkin : ScreenTestScene
{
[Resolved]
private AudioManager audio { get; set; }
@@ -65,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.Tests
ExposedPlayer player;
Beatmap.Value = new CustomSkinWorkingBeatmap(audio, beatmapHasColours);
- Child = new OsuScreenStack(player = new ExposedPlayer(userHasCustomColours)) { RelativeSizeAxes = Axes.Both };
+
+ LoadScreen(player = new ExposedPlayer(userHasCustomColours));
return player;
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
index b6fc9821a4..33d79d9cbc 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
@@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private const double time_during_slide_2 = 3000;
private const double time_during_slide_3 = 3500;
private const double time_during_slide_4 = 3800;
+ private const double time_slider_end = 4000;
private List judgementResults;
private bool allJudgedFired;
@@ -284,6 +285,48 @@ namespace osu.Game.Rulesets.Osu.Tests
AddAssert("Tracking acquired", assertMidSliderJudgements);
}
+ ///
+ /// Scenario:
+ /// - Press a key on the slider head
+ /// - While holding the key, move cursor close to the edge of tracking area
+ /// - Keep the cursor on the edge of tracking area until the slider ends
+ /// Expected Result:
+ /// A passing test case will have the slider track the cursor throughout the whole test.
+ ///
+ [Test]
+ public void TestTrackingAreaEdge()
+ {
+ performTest(new List
+ {
+ new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
+ new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
+ new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.199f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
+ });
+
+ AddAssert("Tracking kept", assertGreatJudge);
+ }
+
+ ///
+ /// Scenario:
+ /// - Press a key on the slider head
+ /// - While holding the key, move cursor just outside the tracking area
+ /// - Keep the cursor just outside the tracking area until the slider ends
+ /// Expected Result:
+ /// A passing test case will have the slider drop the tracking on frame 2.
+ ///
+ [Test]
+ public void TestTrackingAreaOutsideEdge()
+ {
+ performTest(new List
+ {
+ new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
+ new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
+ new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.201f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
+ });
+
+ AddAssert("Tracking dropped", assertMidSliderJudgementFail);
+ }
+
private bool assertGreatJudge() => judgementResults.Last().Type == HitResult.Great;
private bool assertHeadMissTailTracked() => judgementResults[^2].Type == HitResult.Great && judgementResults.First().Type == HitResult.Miss;
@@ -294,6 +337,8 @@ namespace osu.Game.Rulesets.Osu.Tests
private ScoreAccessibleReplayPlayer currentPlayer;
+ private const float slider_path_length = 25;
+
private void performTest(List frames)
{
AddStep("load player", () =>
@@ -309,8 +354,8 @@ namespace osu.Game.Rulesets.Osu.Tests
Path = new SliderPath(PathType.PerfectCurve, new[]
{
Vector2.Zero,
- new Vector2(25, 0),
- }, 25),
+ new Vector2(slider_path_length, 0),
+ }, slider_path_length),
}
},
BeatmapInfo =
diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
index 1d8c4708c1..9d4e016eae 100644
--- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
+++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
index 6c4fbbac17..a5e89210f6 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointConnection.cs
@@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
///
/// The start time of .
///
- public readonly Bindable StartTime = new Bindable();
+ public readonly Bindable StartTime = new BindableDouble();
///
/// The which s will exit from.
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
index 3162f4b379..4ef63bb2a0 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
@@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly IBindable positionBindable = new Bindable();
private readonly IBindable stackHeightBindable = new Bindable();
- private readonly IBindable scaleBindable = new Bindable();
+ private readonly IBindable scaleBindable = new BindableFloat();
public OsuAction? HitAction => HitArea.HitAction;
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
index 20b31c68f2..8fdcd060e7 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs
@@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
InternalChild = scaleContainer = new ReverseArrowPiece();
}
- private readonly IBindable scaleBindable = new Bindable();
+ private readonly IBindable scaleBindable = new BindableFloat();
[BackgroundDependencyLoader]
private void load()
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
index cd3c572ba0..7403649184 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
@@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly IBindable positionBindable = new Bindable();
private readonly IBindable stackHeightBindable = new Bindable();
- private readonly IBindable scaleBindable = new Bindable();
+ private readonly IBindable scaleBindable = new BindableFloat();
public DrawableSlider(Slider s)
: base(s)
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
index 9d4d9958a1..60b5c335d6 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
@@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
};
}
- private readonly IBindable scaleBindable = new Bindable();
+ private readonly IBindable scaleBindable = new BindableFloat();
[BackgroundDependencyLoader]
private void load()
diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
index ef7b077480..b89b0cafc4 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
@@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public Func GetInitialHitAction;
private readonly Slider slider;
- public readonly Drawable FollowCircle;
+ private readonly Drawable followCircle;
+ private readonly Drawable trackingArea;
private readonly DrawableSlider drawableSlider;
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
@@ -38,7 +39,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Children = new[]
{
- FollowCircle = new FollowCircleContainer
+ // This is separate from the visible followcircle to ensure consistent internal tracking area (needed to match osu-stable)
+ trackingArea = new CircularContainer
+ {
+ Origin = Anchor.Centre,
+ Anchor = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both
+ },
+ followCircle = new FollowCircleContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
@@ -95,8 +103,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
tracking = value;
- FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint);
- FollowCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
+ // Tracking area is bigger than the visible followcircle and scales instantly to match osu-stable
+ trackingArea.ScaleTo(tracking ? 2.4f : 1f);
+ followCircle.ScaleTo(tracking ? 2f : 1f, 300, Easing.OutQuint);
+ followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
}
}
@@ -149,7 +159,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
// in valid time range
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
// in valid position range
- lastScreenSpaceMousePosition.HasValue && FollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
+ lastScreenSpaceMousePosition.HasValue && trackingArea.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
// valid action
(actions?.Any(isValidTrackingAction) ?? false);
}
diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
index 0ba712a83f..15af141c99 100644
--- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
+++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs
@@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public double Radius => OBJECT_RADIUS * Scale;
- public readonly Bindable ScaleBindable = new Bindable(1);
+ public readonly Bindable ScaleBindable = new BindableFloat(1);
public float Scale
{
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
index a463542e64..79b5d1b7f8 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorContainer.cs
@@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateScale();
- CursorScale = new Bindable();
+ CursorScale = new BindableFloat();
CursorScale.ValueChanged += e => ActiveCursor.Scale = cursorTrail.Scale = new Vector2(e.NewValue);
calculateScale();
diff --git a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
index ca3030db3e..abba444c73 100644
--- a/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ b/osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
Add(localCursorContainer = new OsuCursorContainer());
- localCursorScale = new Bindable();
+ localCursorScale = new BindableFloat();
localCursorScale.BindTo(localCursorContainer.CursorScale);
localCursorScale.BindValueChanged(scale => cursorScaleContainer.Scale = new Vector2(scale.NewValue), true);
}
diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs
index 589ec7e8aa..29bcc7df9e 100644
--- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs
+++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs
@@ -302,8 +302,8 @@ namespace osu.Game.Tests.Visual.Background
}
public readonly Bindable DimEnabled = new Bindable();
- public readonly Bindable DimLevel = new Bindable();
- public readonly Bindable BlurLevel = new Bindable();
+ public readonly Bindable DimLevel = new BindableDouble();
+ public readonly Bindable BlurLevel = new BindableDouble();
public new BeatmapCarousel Carousel => base.Carousel;
diff --git a/osu.Game/Tests/Visual/AllPlayersTestScene.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs
similarity index 59%
rename from osu.Game/Tests/Visual/AllPlayersTestScene.cs
rename to osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs
index dd65c8c382..83a7b896d2 100644
--- a/osu.Game/Tests/Visual/AllPlayersTestScene.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAllRulesetPlayers.cs
@@ -2,49 +2,66 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
+using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Configuration;
using osu.Game.Rulesets;
+using osu.Game.Rulesets.Catch;
+using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Osu;
+using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.Play;
-namespace osu.Game.Tests.Visual
+namespace osu.Game.Tests.Visual.Gameplay
{
///
/// A base class which runs test for all available rulesets.
/// Steps to be run for each ruleset should be added via .
///
- public abstract class AllPlayersTestScene : RateAdjustedBeatmapTestScene
+ public abstract class TestSceneAllRulesetPlayers : RateAdjustedBeatmapTestScene
{
protected Player Player;
[BackgroundDependencyLoader]
private void load(RulesetStore rulesets)
{
- foreach (var r in rulesets.AvailableRulesets)
- {
- Player p = null;
- AddStep(r.Name, () => p = loadPlayerFor(r));
- AddUntilStep("player loaded", () =>
- {
- if (p?.IsLoaded == true)
- {
- p = null;
- return true;
- }
-
- return false;
- });
-
- AddCheckSteps();
- }
-
OsuConfigManager manager;
Dependencies.Cache(manager = new OsuConfigManager(LocalStorage));
manager.GetBindable(OsuSetting.DimLevel).Value = 1.0;
}
+ [Test]
+ public void TestOsu() => runForRuleset(new OsuRuleset().RulesetInfo);
+
+ [Test]
+ public void TestTaiko() => runForRuleset(new TaikoRuleset().RulesetInfo);
+
+ [Test]
+ public void TestCatch() => runForRuleset(new CatchRuleset().RulesetInfo);
+
+ [Test]
+ public void TestMania() => runForRuleset(new ManiaRuleset().RulesetInfo);
+
+ private void runForRuleset(RulesetInfo ruleset)
+ {
+ Player p = null;
+ AddStep($"load {ruleset.Name} player", () => p = loadPlayerFor(ruleset));
+ AddUntilStep("player loaded", () =>
+ {
+ if (p?.IsLoaded == true)
+ {
+ p = null;
+ return true;
+ }
+
+ return false;
+ });
+
+ AddCheckSteps();
+ }
+
protected abstract void AddCheckSteps();
private Player loadPlayerFor(RulesetInfo rulesetInfo)
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs
index 069b965d9b..4daab8d137 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs
@@ -12,7 +12,7 @@ using osu.Game.Storyboards;
namespace osu.Game.Tests.Visual.Gameplay
{
[Description("Player instantiated with an autoplay mod.")]
- public class TestSceneAutoplay : AllPlayersTestScene
+ public class TestSceneAutoplay : TestSceneAllRulesetPlayers
{
private ClockBackedTestWorkingBeatmap.TrackVirtualManual track;
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs
index 81050b1637..de257c9e53 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailAnimation.cs
@@ -10,7 +10,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
- public class TestSceneFailAnimation : AllPlayersTestScene
+ public class TestSceneFailAnimation : TestSceneAllRulesetPlayers
{
protected override Player CreatePlayer(Ruleset ruleset)
{
@@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public override IReadOnlyList RequiredTypes => new[]
{
- typeof(AllPlayersTestScene),
+ typeof(TestSceneAllRulesetPlayers),
typeof(TestPlayer),
typeof(Player),
};
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs
index 2045072c79..d80efb2c6e 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs
@@ -10,7 +10,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
- public class TestSceneFailJudgement : AllPlayersTestScene
+ public class TestSceneFailJudgement : TestSceneAllRulesetPlayers
{
protected override Player CreatePlayer(Ruleset ruleset)
{
diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
index 1a83e35e4f..ad5bab4681 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestScenePause.cs
@@ -36,6 +36,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public override void SetUpSteps()
{
base.SetUpSteps();
+
AddStep("resume player", () => Player.GameplayClockContainer.Start());
confirmClockRunning(true);
}
diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs
index 4d701f56a9..8f767659c6 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerReferenceLeaking.cs
@@ -10,7 +10,7 @@ using osu.Game.Storyboards;
namespace osu.Game.Tests.Visual.Gameplay
{
- public class TestScenePlayerReferenceLeaking : AllPlayersTestScene
+ public class TestScenePlayerReferenceLeaking : TestSceneAllRulesetPlayers
{
private readonly WeakList workingWeakReferences = new WeakList();
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs
index 36335bc54a..e82722e7a2 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplay.cs
@@ -13,7 +13,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
[Description("Player instantiated with a replay.")]
- public class TestSceneReplay : AllPlayersTestScene
+ public class TestSceneReplay : TestSceneAllRulesetPlayers
{
protected override Player CreatePlayer(Ruleset ruleset)
{
diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
index 1561d0d11d..19bdaff6ff 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
@@ -38,9 +38,21 @@ namespace osu.Game.Tests.Visual.Online
private TestChatOverlay chatOverlay;
private ChannelManager channelManager;
- private readonly Channel channel1 = new Channel(new User()) { Name = "test really long username", Topic = "Topic for channel 1" };
- private readonly Channel channel2 = new Channel(new User()) { Name = "test2", Topic = "Topic for channel 2" };
- private readonly Channel channel3 = new Channel(new User()) { Name = "channel with no topic" };
+ private readonly List channels;
+
+ private Channel channel1 => channels[0];
+ private Channel channel2 => channels[1];
+
+ public TestSceneChatOverlay()
+ {
+ channels = Enumerable.Range(1, 10)
+ .Select(index => new Channel(new User())
+ {
+ Name = $"Channel no. {index}",
+ Topic = index == 3 ? null : $"We talk about the number {index} here"
+ })
+ .ToList();
+ }
[SetUp]
public void Setup()
@@ -49,7 +61,7 @@ namespace osu.Game.Tests.Visual.Online
{
ChannelManagerContainer container;
- Child = container = new ChannelManagerContainer(new List { channel1, channel2, channel3 })
+ Child = container = new ChannelManagerContainer(channels)
{
RelativeSizeAxes = Axes.Both,
};
@@ -103,7 +115,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestSearchInSelector()
{
- AddStep("search for 'test2'", () => chatOverlay.ChildrenOfType().First().Text = "test2");
+ AddStep("search for 'no. 2'", () => chatOverlay.ChildrenOfType().First().Text = "no. 2");
AddUntilStep("only channel 2 visible", () =>
{
var listItems = chatOverlay.ChildrenOfType().Where(c => c.IsPresent);
@@ -111,6 +123,36 @@ namespace osu.Game.Tests.Visual.Online
});
}
+ [Test]
+ public void TestChannelShortcutKeys()
+ {
+ AddStep("join 10 channels", () => channels.ForEach(channel => channelManager.JoinChannel(channel)));
+ AddStep("close channel selector", () =>
+ {
+ InputManager.PressKey(Key.Escape);
+ InputManager.ReleaseKey(Key.Escape);
+ });
+ AddUntilStep("wait for close", () => chatOverlay.SelectionOverlayState == Visibility.Hidden);
+
+ for (int zeroBasedIndex = 0; zeroBasedIndex < 10; ++zeroBasedIndex)
+ {
+ var oneBasedIndex = zeroBasedIndex + 1;
+ var targetNumberKey = oneBasedIndex % 10;
+ var targetChannel = channels[zeroBasedIndex];
+ AddStep($"press Alt+{targetNumberKey}", () => pressChannelHotkey(targetNumberKey));
+ AddAssert($"channel #{oneBasedIndex} is selected", () => channelManager.CurrentChannel.Value == targetChannel);
+ }
+ }
+
+ private void pressChannelHotkey(int number)
+ {
+ var channelKey = Key.Number0 + number;
+ InputManager.PressKey(Key.AltLeft);
+ InputManager.PressKey(channelKey);
+ InputManager.ReleaseKey(Key.AltLeft);
+ InputManager.ReleaseKey(channelKey);
+ }
+
private void clickDrawable(Drawable d)
{
InputManager.MoveMouseTo(d);
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs
new file mode 100644
index 0000000000..3d3517ada4
--- /dev/null
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs
@@ -0,0 +1,175 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Linq;
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Testing;
+using osu.Game.Beatmaps;
+using osu.Game.Graphics;
+using osu.Game.Rulesets;
+using osu.Game.Rulesets.Mods;
+using osu.Game.Screens.Select.Details;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.SongSelect
+{
+ [System.ComponentModel.Description("Advanced beatmap statistics display")]
+ public class TestSceneAdvancedStats : OsuTestScene
+ {
+ private TestAdvancedStats advancedStats;
+
+ [Resolved]
+ private RulesetStore rulesets { get; set; }
+
+ [Resolved]
+ private OsuColour colours { get; set; }
+
+ [SetUp]
+ public void Setup() => Schedule(() => Child = advancedStats = new TestAdvancedStats
+ {
+ Width = 500
+ });
+
+ private BeatmapInfo exampleBeatmapInfo => new BeatmapInfo
+ {
+ RulesetID = 0,
+ Ruleset = rulesets.AvailableRulesets.First(),
+ BaseDifficulty = new BeatmapDifficulty
+ {
+ CircleSize = 7.2f,
+ DrainRate = 3,
+ OverallDifficulty = 5.7f,
+ ApproachRate = 3.5f
+ },
+ StarDifficulty = 4.5f
+ };
+
+ [Test]
+ public void TestNoMod()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = exampleBeatmapInfo);
+
+ AddStep("no mods selected", () => SelectedMods.Value = Array.Empty());
+
+ AddAssert("first bar text is Circle Size", () => advancedStats.ChildrenOfType().First().Text == "Circle Size");
+ AddAssert("circle size bar is white", () => barIsWhite(advancedStats.FirstValue));
+ AddAssert("HP drain bar is white", () => barIsWhite(advancedStats.HpDrain));
+ AddAssert("accuracy bar is white", () => barIsWhite(advancedStats.Accuracy));
+ AddAssert("approach rate bar is white", () => barIsWhite(advancedStats.ApproachRate));
+ }
+
+ [Test]
+ public void TestManiaFirstBarText()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = new BeatmapInfo
+ {
+ Ruleset = rulesets.GetRuleset(3),
+ BaseDifficulty = new BeatmapDifficulty
+ {
+ CircleSize = 5,
+ DrainRate = 4.3f,
+ OverallDifficulty = 4.5f,
+ ApproachRate = 3.1f
+ },
+ StarDifficulty = 8
+ });
+
+ AddAssert("first bar text is Key Count", () => advancedStats.ChildrenOfType().First().Text == "Key Count");
+ }
+
+ [Test]
+ public void TestEasyMod()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = exampleBeatmapInfo);
+
+ AddStep("select EZ mod", () =>
+ {
+ var ruleset = advancedStats.Beatmap.Ruleset.CreateInstance();
+ SelectedMods.Value = new[] { ruleset.GetAllMods().OfType().Single() };
+ });
+
+ AddAssert("circle size bar is blue", () => barIsBlue(advancedStats.FirstValue));
+ AddAssert("HP drain bar is blue", () => barIsBlue(advancedStats.HpDrain));
+ AddAssert("accuracy bar is blue", () => barIsBlue(advancedStats.Accuracy));
+ AddAssert("approach rate bar is blue", () => barIsBlue(advancedStats.ApproachRate));
+ }
+
+ [Test]
+ public void TestHardRockMod()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = exampleBeatmapInfo);
+
+ AddStep("select HR mod", () =>
+ {
+ var ruleset = advancedStats.Beatmap.Ruleset.CreateInstance();
+ SelectedMods.Value = new[] { ruleset.GetAllMods().OfType().Single() };
+ });
+
+ AddAssert("circle size bar is red", () => barIsRed(advancedStats.FirstValue));
+ AddAssert("HP drain bar is red", () => barIsRed(advancedStats.HpDrain));
+ AddAssert("accuracy bar is red", () => barIsRed(advancedStats.Accuracy));
+ AddAssert("approach rate bar is red", () => barIsRed(advancedStats.ApproachRate));
+ }
+
+ [Test]
+ public void TestUnchangedDifficultyAdjustMod()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = exampleBeatmapInfo);
+
+ AddStep("select unchanged Difficulty Adjust mod", () =>
+ {
+ var ruleset = advancedStats.Beatmap.Ruleset.CreateInstance();
+ var difficultyAdjustMod = ruleset.GetAllMods().OfType().Single();
+ difficultyAdjustMod.ReadFromDifficulty(advancedStats.Beatmap.BaseDifficulty);
+ SelectedMods.Value = new[] { difficultyAdjustMod };
+ });
+
+ AddAssert("circle size bar is white", () => barIsWhite(advancedStats.FirstValue));
+ AddAssert("HP drain bar is white", () => barIsWhite(advancedStats.HpDrain));
+ AddAssert("accuracy bar is white", () => barIsWhite(advancedStats.Accuracy));
+ AddAssert("approach rate bar is white", () => barIsWhite(advancedStats.ApproachRate));
+ }
+
+ [Test]
+ public void TestChangedDifficultyAdjustMod()
+ {
+ AddStep("set beatmap", () => advancedStats.Beatmap = exampleBeatmapInfo);
+
+ AddStep("select changed Difficulty Adjust mod", () =>
+ {
+ var ruleset = advancedStats.Beatmap.Ruleset.CreateInstance();
+ var difficultyAdjustMod = ruleset.GetAllMods().OfType().Single();
+ var originalDifficulty = advancedStats.Beatmap.BaseDifficulty;
+ var adjustedDifficulty = new BeatmapDifficulty
+ {
+ CircleSize = originalDifficulty.CircleSize,
+ DrainRate = originalDifficulty.DrainRate - 0.5f,
+ OverallDifficulty = originalDifficulty.OverallDifficulty,
+ ApproachRate = originalDifficulty.ApproachRate + 2.2f,
+ };
+ difficultyAdjustMod.ReadFromDifficulty(adjustedDifficulty);
+ SelectedMods.Value = new[] { difficultyAdjustMod };
+ });
+
+ AddAssert("circle size bar is white", () => barIsWhite(advancedStats.FirstValue));
+ AddAssert("drain rate bar is blue", () => barIsBlue(advancedStats.HpDrain));
+ AddAssert("accuracy bar is white", () => barIsWhite(advancedStats.Accuracy));
+ AddAssert("approach rate bar is red", () => barIsRed(advancedStats.ApproachRate));
+ }
+
+ private bool barIsWhite(AdvancedStats.StatisticRow row) => row.ModBar.AccentColour == Color4.White;
+ private bool barIsBlue(AdvancedStats.StatisticRow row) => row.ModBar.AccentColour == colours.BlueDark;
+ private bool barIsRed(AdvancedStats.StatisticRow row) => row.ModBar.AccentColour == colours.Red;
+
+ private class TestAdvancedStats : AdvancedStats
+ {
+ public new StatisticRow FirstValue => base.FirstValue;
+ public new StatisticRow HpDrain => base.HpDrain;
+ public new StatisticRow Accuracy => base.Accuracy;
+ public new StatisticRow ApproachRate => base.ApproachRate;
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs
index 6aa5a76490..acf037198f 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs
@@ -3,14 +3,8 @@
using System.Linq;
using NUnit.Framework;
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using osu.Framework.Testing;
using osu.Game.Beatmaps;
-using osu.Game.Graphics;
-using osu.Game.Graphics.UserInterface;
-using osu.Game.Rulesets;
-using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelect
@@ -180,27 +174,5 @@ namespace osu.Game.Tests.Visual.SongSelect
OnlineBeatmapID = 162,
});
}
-
- [Resolved]
- private RulesetStore rulesets { get; set; }
-
- [Resolved]
- private OsuColour colours { get; set; }
-
- [Test]
- public void TestModAdjustments()
- {
- TestAllMetrics();
-
- Ruleset ruleset = rulesets.AvailableRulesets.First().CreateInstance();
-
- AddStep("with EZ mod", () => SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModEasy) });
-
- AddAssert("first bar coloured blue", () => details.ChildrenOfType().Skip(1).First().AccentColour == colours.BlueDark);
-
- AddStep("with HR mod", () => SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModHardRock) });
-
- AddAssert("first bar coloured red", () => details.ChildrenOfType().Skip(1).First().AccentColour == colours.Red);
- }
}
}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
index fc06780431..c01dee2959 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
@@ -72,19 +72,24 @@ namespace osu.Game.Tests.Visual.SongSelect
// required to get bindables attached
Add(music);
- Beatmap.SetDefault();
-
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
}
private OsuConfigManager config;
- [SetUp]
- public virtual void SetUp() => Schedule(() =>
+ [SetUpSteps]
+ public override void SetUpSteps()
{
- Ruleset.Value = new OsuRuleset().RulesetInfo;
- manager?.Delete(manager.GetAllUsableBeatmapSets());
- });
+ base.SetUpSteps();
+
+ AddStep("delete all beatmaps", () =>
+ {
+ Ruleset.Value = new OsuRuleset().RulesetInfo;
+ manager?.Delete(manager.GetAllUsableBeatmapSets());
+
+ Beatmap.SetDefault();
+ });
+ }
[Test]
public void TestSingleFilterOnEnter()
@@ -120,9 +125,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
-
- AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
- AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
}
[Test]
@@ -148,9 +150,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
-
- AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
- AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
}
[Test]
@@ -180,9 +179,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
-
- AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
- AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
}
[Test]
@@ -213,9 +209,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
-
- AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
- AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
}
[Test]
diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs
index 2c0fa49b5d..f2aef0995f 100644
--- a/osu.Game/Overlays/ChatOverlay.cs
+++ b/osu.Game/Overlays/ChatOverlay.cs
@@ -321,8 +321,10 @@ namespace osu.Game.Overlays
private void selectTab(int index)
{
- var channel = ChannelTabControl.Items.Skip(index).FirstOrDefault();
- if (channel != null && !(channel is ChannelSelectorTabItem.ChannelSelectorTabChannel))
+ var channel = ChannelTabControl.Items
+ .Where(tab => !(tab is ChannelSelectorTabItem.ChannelSelectorTabChannel))
+ .ElementAtOrDefault(index);
+ if (channel != null)
ChannelTabControl.Current.Value = channel;
}
diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs
index 19f06e99f1..7c7daf6eb9 100644
--- a/osu.Game/Overlays/MusicController.cs
+++ b/osu.Game/Overlays/MusicController.cs
@@ -196,7 +196,7 @@ namespace osu.Game.Overlays
if (!instant)
queuedDirection = TrackChangeDirection.Next;
- var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? BeatmapSets.FirstOrDefault();
+ var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
if (playable != null)
{
diff --git a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs
index 717ec4fb1a..f65c909155 100644
--- a/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs
+++ b/osu.Game/Overlays/Profile/Sections/ProfileItemContainer.cs
@@ -44,8 +44,8 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
- background.Colour = idleColour = colourProvider.Background4;
- hoverColour = colourProvider.Background3;
+ background.Colour = idleColour = colourProvider.Background3;
+ hoverColour = colourProvider.Background2;
}
protected override bool OnHover(HoverEvent e)
diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
index 5196bef48d..c9f787bb26 100644
--- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
+++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs
@@ -1,10 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
-using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -16,14 +16,16 @@ using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osuTK;
-using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableProfileScore : CompositeDrawable
{
+ private const int height = 40;
private const int performance_width = 80;
- private const int content_padding = 10;
+
+ private const float performance_background_shear = 0.45f;
+ private static readonly float performance_background_width = performance_width + (height / 4f * MathF.Tan(performance_background_shear));
protected readonly ScoreInfo Score;
@@ -38,7 +40,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Score = score;
RelativeSizeAxes = Axes.X;
- Height = 40;
+ Height = height;
}
[BackgroundDependencyLoader]
@@ -51,7 +53,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
new Container
{
RelativeSizeAxes = Axes.Both,
- Padding = new MarginPadding { Left = content_padding, Right = performance_width + content_padding },
+ Padding = new MarginPadding { Left = 10, Right = performance_width + 30 },
Children = new Drawable[]
{
new FillFlowContainer
@@ -142,20 +144,26 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
new Box
{
- RelativeSizeAxes = Axes.Both,
- Size = new Vector2(1, 0.5f),
- Colour = Color4.Black.Opacity(0.5f),
- Shear = new Vector2(-0.45f, 0),
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ RelativeSizeAxes = Axes.Y,
+ Width = performance_background_width,
+ Height = 0.5f,
+ Colour = colourProvider.Background4,
+ Shear = new Vector2(-performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0),
},
new Box
{
- RelativeSizeAxes = Axes.Both,
+ Anchor = Anchor.TopRight,
+ Origin = Anchor.TopRight,
+ RelativeSizeAxes = Axes.Y,
RelativePositionAxes = Axes.Y,
- Size = new Vector2(1, -0.5f),
+ Width = performance_background_width,
+ Height = -0.5f,
Position = new Vector2(0, 1),
- Colour = Color4.Black.Opacity(0.5f),
- Shear = new Vector2(0.45f, 0),
+ Colour = colourProvider.Background4,
+ Shear = new Vector2(performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0),
},
createDrawablePerformance().With(d =>
diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs
index 8f2dbce6f7..422bf00c6d 100644
--- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs
+++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs
@@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Toolbar
{
int requested = e.Key - Key.Number1;
- RulesetInfo found = Rulesets.AvailableRulesets.Skip(requested).FirstOrDefault();
+ RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
if (found != null)
Current.Value = found;
return true;
diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs
index ab8dccb9dd..5ac1d4ecc4 100644
--- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs
+++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs
@@ -154,7 +154,7 @@ namespace osu.Game.Rulesets.Edit
{
if (e.Key >= Key.Number1 && e.Key <= Key.Number9)
{
- var item = toolboxCollection.Items.Skip(e.Key - Key.Number1).FirstOrDefault();
+ var item = toolboxCollection.Items.ElementAtOrDefault(e.Key - Key.Number1);
if (item != null)
{
diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs
index bd96441ebb..c09844e0c6 100644
--- a/osu.Game/Rulesets/Objects/HitObject.cs
+++ b/osu.Game/Rulesets/Objects/HitObject.cs
@@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects
///
public event Action DefaultsApplied;
- public readonly Bindable StartTimeBindable = new Bindable();
+ public readonly Bindable StartTimeBindable = new BindableDouble();
///
/// The time at which the HitObject starts.
diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs
index 3ced9ee753..50fd127093 100644
--- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs
+++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs
@@ -36,7 +36,7 @@ namespace osu.Game.Screens.Backgrounds
///
/// The amount of blur to be applied in addition to user-specified blur.
///
- public readonly Bindable BlurAmount = new Bindable();
+ public readonly Bindable BlurAmount = new BindableFloat();
internal readonly IBindable IsBreakTime = new Bindable();
@@ -119,7 +119,7 @@ namespace osu.Game.Screens.Backgrounds
///
/// Used in contexts where there can potentially be both user and screen-specified blurring occuring at the same time, such as in
///
- public readonly Bindable BlurAmount = new Bindable();
+ public readonly Bindable BlurAmount = new BindableFloat();
public Background Background
{
diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs
index 56c400e869..7ab91677a9 100644
--- a/osu.Game/Screens/Select/Details/AdvancedStats.cs
+++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs
@@ -16,6 +16,7 @@ using System.Collections.Generic;
using osu.Game.Rulesets.Mods;
using System.Linq;
using osu.Framework.Threading;
+using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
@@ -26,7 +27,8 @@ namespace osu.Game.Screens.Select.Details
[Resolved]
private IBindable> mods { get; set; }
- private readonly StatisticRow firstValue, hpDrain, accuracy, approachRate, starDifficulty;
+ protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
+ private readonly StatisticRow starDifficulty;
private BeatmapInfo beatmap;
@@ -52,10 +54,10 @@ namespace osu.Game.Screens.Select.Details
Spacing = new Vector2(4f),
Children = new[]
{
- firstValue = new StatisticRow(), //circle size/key amount
- hpDrain = new StatisticRow { Title = "HP Drain" },
- accuracy = new StatisticRow { Title = "Accuracy" },
- approachRate = new StatisticRow { Title = "Approach Rate" },
+ FirstValue = new StatisticRow(), //circle size/key amount
+ HpDrain = new StatisticRow { Title = "HP Drain" },
+ Accuracy = new StatisticRow { Title = "Accuracy" },
+ ApproachRate = new StatisticRow { Title = "Approach Rate" },
starDifficulty = new StatisticRow(10, true) { Title = "Star Difficulty" },
},
};
@@ -122,24 +124,24 @@ namespace osu.Game.Screens.Select.Details
case 3:
// Account for mania differences locally for now
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes
- firstValue.Title = "Key Count";
- firstValue.Value = (baseDifficulty?.CircleSize ?? 0, null);
+ FirstValue.Title = "Key Count";
+ FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, null);
break;
default:
- firstValue.Title = "Circle Size";
- firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize);
+ FirstValue.Title = "Circle Size";
+ FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize);
break;
}
starDifficulty.Value = ((float)(Beatmap?.StarDifficulty ?? 0), null);
- hpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate);
- accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty);
- approachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate);
+ HpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate);
+ Accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty);
+ ApproachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate);
}
- private class StatisticRow : Container, IHasAccentColour
+ public class StatisticRow : Container, IHasAccentColour
{
private const float value_width = 25;
private const float name_width = 70;
@@ -147,7 +149,8 @@ namespace osu.Game.Screens.Select.Details
private readonly float maxValue;
private readonly bool forceDecimalPlaces;
private readonly OsuSpriteText name, valueText;
- private readonly Bar bar, modBar;
+ private readonly Bar bar;
+ public readonly Bar ModBar;
[Resolved]
private OsuColour colours { get; set; }
@@ -173,14 +176,14 @@ namespace osu.Game.Screens.Select.Details
bar.Length = value.baseValue / maxValue;
valueText.Text = (value.adjustedValue ?? value.baseValue).ToString(forceDecimalPlaces ? "0.00" : "0.##");
- modBar.Length = (value.adjustedValue ?? 0) / maxValue;
+ ModBar.Length = (value.adjustedValue ?? 0) / maxValue;
- if (value.adjustedValue > value.baseValue)
- modBar.AccentColour = valueText.Colour = colours.Red;
+ if (Precision.AlmostEquals(value.baseValue, value.adjustedValue ?? value.baseValue, 0.05f))
+ ModBar.AccentColour = valueText.Colour = Color4.White;
+ else if (value.adjustedValue > value.baseValue)
+ ModBar.AccentColour = valueText.Colour = colours.Red;
else if (value.adjustedValue < value.baseValue)
- modBar.AccentColour = valueText.Colour = colours.BlueDark;
- else
- modBar.AccentColour = valueText.Colour = Color4.White;
+ ModBar.AccentColour = valueText.Colour = colours.BlueDark;
}
}
@@ -217,7 +220,7 @@ namespace osu.Game.Screens.Select.Details
BackgroundColour = Color4.White.Opacity(0.5f),
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
},
- modBar = new Bar
+ ModBar = new Bar
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs
index c851b201d7..6a03cfb68e 100644
--- a/osu.Game/Screens/Select/FilterControl.cs
+++ b/osu.Game/Screens/Select/FilterControl.cs
@@ -149,8 +149,8 @@ namespace osu.Game.Screens.Select
private readonly IBindable ruleset = new Bindable();
private readonly Bindable showConverted = new Bindable();
- private readonly Bindable minimumStars = new Bindable();
- private readonly Bindable maximumStars = new Bindable();
+ private readonly Bindable minimumStars = new BindableDouble();
+ private readonly Bindable maximumStars = new BindableDouble();
public readonly Box Background;
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index a16401a527..f9f015643d 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -345,8 +345,8 @@ namespace osu.Game.Screens.Select
selectionChangedDebounce = null;
}
- if (performStartAction)
- OnStart();
+ if (performStartAction && OnStart())
+ Carousel.AllowSelection = false;
}
///
@@ -500,6 +500,8 @@ namespace osu.Game.Screens.Select
public override void OnResuming(IScreen last)
{
+ Carousel.AllowSelection = true;
+
BeatmapDetails.Leaderboard.RefreshScores();
Beatmap.Value.Track.Looping = true;
@@ -647,7 +649,6 @@ namespace osu.Game.Screens.Select
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
- Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
Beatmap.BindValueChanged(workingBeatmapChanged);
boundLocalBindables = true;
diff --git a/osu.Game/Tests/Visual/PlayerTestScene.cs b/osu.Game/Tests/Visual/PlayerTestScene.cs
index 3ed65bee61..7c5ba7d30f 100644
--- a/osu.Game/Tests/Visual/PlayerTestScene.cs
+++ b/osu.Game/Tests/Visual/PlayerTestScene.cs
@@ -33,8 +33,10 @@ namespace osu.Game.Tests.Visual
}
[SetUpSteps]
- public virtual void SetUpSteps()
+ public override void SetUpSteps()
{
+ base.SetUpSteps();
+
AddStep(ruleset.RulesetInfo.Name, loadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
}
diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs
index 707aa61283..feca592049 100644
--- a/osu.Game/Tests/Visual/ScreenTestScene.cs
+++ b/osu.Game/Tests/Visual/ScreenTestScene.cs
@@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Testing;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
@@ -27,11 +28,23 @@ namespace osu.Game.Tests.Visual
});
}
- protected void LoadScreen(OsuScreen screen)
+ protected void LoadScreen(OsuScreen screen) => Stack.Push(screen);
+
+ [SetUpSteps]
+ public virtual void SetUpSteps() => addExitAllScreensStep();
+
+ [TearDownSteps]
+ public void TearDownSteps() => addExitAllScreensStep();
+
+ private void addExitAllScreensStep()
{
- if (Stack.CurrentScreen != null)
+ AddUntilStep("exit all screens", () =>
+ {
+ if (Stack.CurrentScreen == null) return true;
+
Stack.Exit();
- Stack.Push(screen);
+ return false;
+ });
}
}
}
diff --git a/osu.Game/Tests/Visual/ScrollingTestContainer.cs b/osu.Game/Tests/Visual/ScrollingTestContainer.cs
index bdad3d278c..161ebe7030 100644
--- a/osu.Game/Tests/Visual/ScrollingTestContainer.cs
+++ b/osu.Game/Tests/Visual/ScrollingTestContainer.cs
@@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual
public readonly Bindable Direction = new Bindable();
IBindable IScrollingInfo.Direction => Direction;
- public readonly Bindable TimeRange = new Bindable(1000) { Value = 1000 };
+ public readonly Bindable TimeRange = new BindableDouble(1000) { Value = 1000 };
IBindable IScrollingInfo.TimeRange => TimeRange;
public readonly TestScrollAlgorithm Algorithm = new TestScrollAlgorithm();
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 0ea558bbc7..b38b7ff9b1 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index a215bc65e8..6ab3c0f2d2 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -74,7 +74,7 @@
-
+
@@ -82,7 +82,7 @@
-
+