diff --git a/global.json b/global.json
index 233a040d18..a9a531f59c 100644
--- a/global.json
+++ b/global.json
@@ -5,6 +5,6 @@
"version": "3.1.100"
},
"msbuild-sdks": {
- "Microsoft.Build.Traversal": "2.0.52"
+ "Microsoft.Build.Traversal": "2.1.1"
}
}
\ No newline at end of file
diff --git a/osu.Android.props b/osu.Android.props
index 1a76a24496..f62ba48953 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -51,7 +51,7 @@
-
-
+
+
diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
index f9d56dfa78..dfe3bf8af4 100644
--- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
+++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs
index 18cc300ff9..f009c10a9c 100644
--- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs
+++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmap.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
@@ -23,19 +22,19 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
{
Name = @"Fruit Count",
Content = fruits.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
},
new BeatmapStatistic
{
Name = @"Juice Stream Count",
Content = juiceStreams.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
},
new BeatmapStatistic
{
Name = @"Banana Shower Count",
Content = bananaShowers.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
}
};
}
diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
index ed00ed0b4c..892f27d27f 100644
--- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
+++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs
index dc24a344e9..d1d5adea75 100644
--- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs
+++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.UI;
@@ -41,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
new BeatmapStatistic
{
Name = @"Note Count",
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
Content = notes.ToString(),
- Icon = FontAwesome.Regular.Circle
},
new BeatmapStatistic
{
Name = @"Hold Note Count",
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
Content = holdnotes.ToString(),
- Icon = FontAwesome.Regular.Circle
},
};
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
index a69646507a..3d100e4b1c 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSnaking.cs
@@ -22,7 +22,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Storyboards;
using osuTK;
-using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
namespace osu.Game.Rulesets.Osu.Tests
{
@@ -32,8 +31,6 @@ namespace osu.Game.Rulesets.Osu.Tests
[Resolved]
private AudioManager audioManager { get; set; }
- private TrackVirtualManual track;
-
protected override bool Autoplay => autoplay;
private bool autoplay;
@@ -44,11 +41,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private const double fade_in_modifier = -1200;
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
- {
- var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
- track = (TrackVirtualManual)working.Track;
- return working;
- }
+ => new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
@@ -72,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
AddStep("enable autoplay", () => autoplay = true);
base.SetUpSteps();
- AddUntilStep("wait for track to start running", () => track.IsRunning);
+ AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
double startTime = hitObjects[sliderIndex].StartTime;
retrieveDrawableSlider(sliderIndex);
@@ -97,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
AddStep("have autoplay", () => autoplay = true);
base.SetUpSteps();
- AddUntilStep("wait for track to start running", () => track.IsRunning);
+ AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
double startTime = hitObjects[sliderIndex].StartTime;
retrieveDrawableSlider(sliderIndex);
@@ -201,7 +194,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private void addSeekStep(double time)
{
- AddStep($"seek to {time}", () => track.Seek(time));
+ AddStep($"seek to {time}", () => MusicController.SeekTo(time));
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
index 69857f8ef9..f7909071ea 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
+++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs
@@ -25,7 +25,6 @@ using osu.Game.Scoring;
using osu.Game.Storyboards;
using osu.Game.Tests.Visual;
using osuTK;
-using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
namespace osu.Game.Rulesets.Osu.Tests
{
@@ -34,18 +33,12 @@ namespace osu.Game.Rulesets.Osu.Tests
[Resolved]
private AudioManager audioManager { get; set; }
- private TrackVirtualManual track;
-
protected override bool Autoplay => true;
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new ScoreExposedPlayer();
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
- {
- var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
- track = (TrackVirtualManual)working.Track;
- return working;
- }
+ => new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
private DrawableSpinner drawableSpinner;
private SpriteIcon spinnerSymbol => drawableSpinner.ChildrenOfType().Single();
@@ -55,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
base.SetUpSteps();
- AddUntilStep("wait for track to start running", () => track.IsRunning);
+ AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
AddStep("retrieve spinner", () => drawableSpinner = (DrawableSpinner)Player.DrawableRuleset.Playfield.AllHitObjects.First());
}
@@ -201,7 +194,7 @@ namespace osu.Game.Rulesets.Osu.Tests
addSeekStep(0);
- AddStep("adjust track rate", () => track.AddAdjustment(AdjustableProperty.Tempo, new BindableDouble(rate)));
+ AddStep("adjust track rate", () => MusicController.CurrentTrack.AddAdjustment(AdjustableProperty.Tempo, new BindableDouble(rate)));
// autoplay replay frames use track time;
// if a spin takes 1000ms in track time and we're playing with a 2x rate adjustment, the spin will take 500ms of *real* time.
// therefore we need to apply the rate adjustment to the replay itself to change from track time to real time,
@@ -230,7 +223,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private void addSeekStep(double time)
{
- AddStep($"seek to {time}", () => track.Seek(time));
+ AddStep($"seek to {time}", () => MusicController.SeekTo(time));
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
}
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 f3837ea6b1..3639c3616f 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
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs
index 491d82b89e..2d3cc3c103 100644
--- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs
+++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmap.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
@@ -23,19 +22,19 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
{
Name = @"Circle Count",
Content = circles.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
},
new BeatmapStatistic
{
Name = @"Slider Count",
Content = sliders.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
},
new BeatmapStatistic
{
Name = @"Spinner Count",
Content = spinners.ToString(),
- Icon = FontAwesome.Regular.Circle
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
}
};
}
diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
index e896606ee8..b59f3a4344 100644
--- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
+++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj
@@ -2,7 +2,7 @@
-
+
diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs
index b595f43fbb..16a0726c8c 100644
--- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs
+++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmap.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Linq;
-using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects;
@@ -22,20 +21,20 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
new BeatmapStatistic
{
Name = @"Hit Count",
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
Content = hits.ToString(),
- Icon = FontAwesome.Regular.Circle
},
new BeatmapStatistic
{
Name = @"Drumroll Count",
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
Content = drumrolls.ToString(),
- Icon = FontAwesome.Regular.Circle
},
new BeatmapStatistic
{
Name = @"Swell Count",
+ CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
Content = swells.ToString(),
- Icon = FontAwesome.Regular.Circle
}
};
}
diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs
index 17d910036f..8b22309033 100644
--- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs
+++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapEncoderTest.cs
@@ -136,7 +136,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
protected override Texture GetBackground() => throw new NotImplementedException();
- protected override Track GetTrack() => throw new NotImplementedException();
+ protected override Track GetBeatmapTrack() => throw new NotImplementedException();
}
}
}
diff --git a/osu.Game.Tests/Gameplay/TestSceneGameplayClockContainer.cs b/osu.Game.Tests/Gameplay/TestSceneGameplayClockContainer.cs
index cd3669f160..891537c4ad 100644
--- a/osu.Game.Tests/Gameplay/TestSceneGameplayClockContainer.cs
+++ b/osu.Game.Tests/Gameplay/TestSceneGameplayClockContainer.cs
@@ -1,10 +1,8 @@
// 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 NUnit.Framework;
using osu.Framework.Testing;
-using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
@@ -19,7 +17,14 @@ namespace osu.Game.Tests.Gameplay
{
GameplayClockContainer gcc = null;
- AddStep("create container", () => Add(gcc = new GameplayClockContainer(CreateWorkingBeatmap(new OsuRuleset().RulesetInfo), Array.Empty(), 0)));
+ AddStep("create container", () =>
+ {
+ var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
+ working.LoadTrack();
+
+ Add(gcc = new GameplayClockContainer(working, 0));
+ });
+
AddStep("start track", () => gcc.Start());
AddUntilStep("elapsed greater than zero", () => gcc.GameplayClock.ElapsedFrameTime > 0);
}
diff --git a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs
index b30870d057..a690eb3b59 100644
--- a/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs
+++ b/osu.Game.Tests/Gameplay/TestSceneStoryboardSamples.cs
@@ -59,7 +59,10 @@ namespace osu.Game.Tests.Gameplay
AddStep("create container", () =>
{
- Add(gameplayContainer = new GameplayClockContainer(CreateWorkingBeatmap(new OsuRuleset().RulesetInfo), Array.Empty(), 0));
+ var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
+ working.LoadTrack();
+
+ Add(gameplayContainer = new GameplayClockContainer(working, 0));
gameplayContainer.Add(sample = new DrawableStoryboardSample(new StoryboardSampleInfo(string.Empty, 0, 1))
{
@@ -103,7 +106,7 @@ namespace osu.Game.Tests.Gameplay
Beatmap.Value = new TestCustomSkinWorkingBeatmap(new OsuRuleset().RulesetInfo, Audio);
SelectedMods.Value = new[] { testedMod };
- Add(gameplayContainer = new GameplayClockContainer(Beatmap.Value, SelectedMods.Value, 0));
+ Add(gameplayContainer = new GameplayClockContainer(Beatmap.Value, 0));
gameplayContainer.Add(sample = new TestDrawableStoryboardSample(new StoryboardSampleInfo("test-sample", 1, 1))
{
diff --git a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs
index 4d3b73fb32..eff430ac25 100644
--- a/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs
+++ b/osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs
@@ -26,6 +26,7 @@ namespace osu.Game.Tests.Skins
{
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result;
beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
+ beatmap.LoadTrack();
}
[Test]
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs
index 79275d70a7..6fd5511e5a 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneCompletionCancellation.cs
@@ -4,7 +4,6 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
-using osu.Framework.Audio.Track;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Framework.Timing;
@@ -18,8 +17,6 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneCompletionCancellation : OsuPlayerTestScene
{
- private Track track;
-
[Resolved]
private AudioManager audio { get; set; }
@@ -34,7 +31,7 @@ namespace osu.Game.Tests.Visual.Gameplay
base.SetUpSteps();
// Ensure track has actually running before attempting to seek
- AddUntilStep("wait for track to start running", () => track.IsRunning);
+ AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
}
[Test]
@@ -73,13 +70,13 @@ namespace osu.Game.Tests.Visual.Gameplay
private void complete()
{
- AddStep("seek to completion", () => track.Seek(5000));
+ AddStep("seek to completion", () => Beatmap.Value.Track.Seek(5000));
AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value);
}
private void cancel()
{
- AddStep("rewind to cancel", () => track.Seek(4000));
+ AddStep("rewind to cancel", () => Beatmap.Value.Track.Seek(4000));
AddUntilStep("completion cleared by processor", () => !Player.ScoreProcessor.HasCompleted.Value);
}
@@ -91,11 +88,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
- {
- var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audio);
- track = working.Track;
- return working;
- }
+ => new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audio);
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs
index 2a119f5199..73c6970482 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayRewinding.cs
@@ -5,7 +5,6 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
-using osu.Framework.Audio.Track;
using osu.Framework.Utils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
@@ -21,19 +20,13 @@ namespace osu.Game.Tests.Visual.Gameplay
[Resolved]
private AudioManager audioManager { get; set; }
- private Track track;
-
- protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
- {
- var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
- track = working.Track;
- return working;
- }
+ protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) =>
+ new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
[Test]
public void TestNoJudgementsOnRewind()
{
- AddUntilStep("wait for track to start running", () => track.IsRunning);
+ AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
addSeekStep(3000);
AddAssert("all judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged));
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses >= 7));
@@ -46,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private void addSeekStep(double time)
{
- AddStep($"seek to {time}", () => track.Seek(time));
+ AddStep($"seek to {time}", () => Beatmap.Value.Track.Seek(time));
// Allow a few frames of lenience
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs
index 7ed7a116b4..841722a8f1 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkipOverlay.cs
@@ -1,11 +1,9 @@
// 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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
-using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Play;
using osuTK;
@@ -32,7 +30,10 @@ namespace osu.Game.Tests.Visual.Gameplay
requestCount = 0;
increment = skip_time;
- Child = gameplayClockContainer = new GameplayClockContainer(CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)), Array.Empty(), 0)
+ var working = CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
+ working.LoadTrack();
+
+ Child = gameplayClockContainer = new GameplayClockContainer(working, 0)
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs
index 9f1492a25f..5a2b8d22fd 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneStoryboard.cs
@@ -22,19 +22,32 @@ namespace osu.Game.Tests.Visual.Gameplay
[TestFixture]
public class TestSceneStoryboard : OsuTestScene
{
- private readonly Container storyboardContainer;
+ private Container storyboardContainer;
private DrawableStoryboard storyboard;
- [Cached]
- private MusicController musicController = new MusicController();
+ [Test]
+ public void TestStoryboard()
+ {
+ AddStep("Restart", restart);
+ AddToggleStep("Passing", passing =>
+ {
+ if (storyboard != null) storyboard.Passing = passing;
+ });
+ }
- public TestSceneStoryboard()
+ [Test]
+ public void TestStoryboardMissingVideo()
+ {
+ AddStep("Load storyboard with missing video", loadStoryboardNoVideo);
+ }
+
+ [BackgroundDependencyLoader]
+ private void load()
{
Clock = new FramedClock();
AddRange(new Drawable[]
{
- musicController,
new Container
{
RelativeSizeAxes = Axes.Both,
@@ -58,32 +71,11 @@ namespace osu.Game.Tests.Visual.Gameplay
State = { Value = Visibility.Visible },
}
});
+
+ Beatmap.BindValueChanged(beatmapChanged, true);
}
- [Test]
- public void TestStoryboard()
- {
- AddStep("Restart", restart);
- AddToggleStep("Passing", passing =>
- {
- if (storyboard != null) storyboard.Passing = passing;
- });
- }
-
- [Test]
- public void TestStoryboardMissingVideo()
- {
- AddStep("Load storyboard with missing video", loadStoryboardNoVideo);
- }
-
- [BackgroundDependencyLoader]
- private void load()
- {
- Beatmap.ValueChanged += beatmapChanged;
- }
-
- private void beatmapChanged(ValueChangedEvent e)
- => loadStoryboard(e.NewValue);
+ private void beatmapChanged(ValueChangedEvent e) => loadStoryboard(e.NewValue);
private void restart()
{
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs
index 8f20e38494..5f135febf4 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs
@@ -2,8 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
-using osu.Framework.Audio.Track;
using osu.Framework.Screens;
+using osu.Framework.Utils;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
@@ -15,11 +15,9 @@ namespace osu.Game.Tests.Visual.Menus
public TestSceneIntroWelcome()
{
- AddUntilStep("wait for load", () => getTrack() != null);
-
- AddAssert("check if menu music loops", () => getTrack().Looping);
+ AddUntilStep("wait for load", () => MusicController.TrackLoaded);
+ AddAssert("correct track", () => Precision.AlmostEquals(MusicController.CurrentTrack.Length, 48000, 1));
+ AddAssert("check if menu music loops", () => MusicController.CurrentTrack.Looping);
}
-
- private Track getTrack() => (IntroStack?.CurrentScreen as MainMenu)?.Track;
}
}
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs b/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs
index d7f23f5cc0..4b22af38c5 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneSongTicker.cs
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays;
@@ -11,14 +10,10 @@ namespace osu.Game.Tests.Visual.Menus
{
public class TestSceneSongTicker : OsuTestScene
{
- [Cached]
- private MusicController musicController = new MusicController();
-
public TestSceneSongTicker()
{
AddRange(new Drawable[]
{
- musicController,
new SongTicker
{
Anchor = Anchor.Centre,
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs
index f819ae4682..2a4486812c 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs
@@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Menus
public class TestToolbar : Toolbar
{
- public new Bindable OverlayActivationMode => base.OverlayActivationMode;
+ public new Bindable OverlayActivationMode => base.OverlayActivationMode as Bindable;
}
}
}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
index 3d225aa0a9..faea32f90f 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchSongSelect.cs
@@ -162,6 +162,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddAssert("item 2 has rate 2", () => Precision.AlmostEquals(2, ((OsuModDoubleTime)Room.Playlist.Last().RequiredMods[0]).SpeedChange.Value));
}
+ ///
+ /// Tests that the global mod instances are not retained by the rooms, as global mod instances are retained and re-used by the mod select overlay.
+ ///
+ [Test]
+ public void TestGlobalModInstancesNotRetained()
+ {
+ OsuModDoubleTime mod = null;
+
+ AddStep("set dt mod and store", () =>
+ {
+ SelectedMods.Value = new[] { new OsuModDoubleTime() };
+
+ // Mod select overlay replaces our mod.
+ mod = (OsuModDoubleTime)SelectedMods.Value[0];
+ });
+
+ AddStep("create item", () => songSelect.BeatmapDetails.CreateNewItem());
+
+ AddStep("change stored mod rate", () => mod.SpeedChange.Value = 2);
+ AddAssert("item has rate 1.5", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)Room.Playlist.First().RequiredMods[0]).SpeedChange.Value));
+ }
+
private class TestMatchSongSelect : MatchSongSelect
{
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
index 8ccaca8630..73a833c15d 100644
--- a/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
+++ b/osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
@@ -4,7 +4,6 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
-using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
@@ -46,7 +45,6 @@ namespace osu.Game.Tests.Visual.Navigation
Player player = null;
WorkingBeatmap beatmap() => Game.Beatmap.Value;
- Track track() => beatmap().Track;
PushAndConfirm(() => new TestSongSelect());
@@ -62,30 +60,27 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
AddUntilStep("wait for fail", () => player.HasFailed);
- AddUntilStep("wait for track stop", () => !track().IsRunning);
- AddAssert("Ensure time before preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
+ AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying);
+ AddAssert("Ensure time before preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);
pushEscape();
- AddUntilStep("wait for track playing", () => track().IsRunning);
- AddAssert("Ensure time wasn't reset to preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
+ AddUntilStep("wait for track playing", () => Game.MusicController.IsPlaying);
+ AddAssert("Ensure time wasn't reset to preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);
}
[Test]
public void TestMenuMakesMusic()
{
- WorkingBeatmap beatmap() => Game.Beatmap.Value;
- Track track() => beatmap().Track;
-
TestSongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestSongSelect());
- AddUntilStep("wait for no track", () => track() is TrackVirtual);
+ AddUntilStep("wait for no track", () => Game.MusicController.CurrentTrack.IsDummyDevice);
AddStep("return to menu", () => songSelect.Exit());
- AddUntilStep("wait for track", () => !(track() is TrackVirtual) && track().IsRunning);
+ AddUntilStep("wait for track", () => !Game.MusicController.CurrentTrack.IsDummyDevice && Game.MusicController.IsPlaying);
}
[Test]
@@ -140,12 +135,12 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("Wait for music controller", () => Game.MusicController.IsLoaded);
AddStep("Seek close to end", () =>
{
- Game.MusicController.SeekTo(Game.Beatmap.Value.Track.Length - 1000);
- Game.Beatmap.Value.Track.Completed += () => trackCompleted = true;
+ Game.MusicController.SeekTo(Game.MusicController.CurrentTrack.Length - 1000);
+ Game.MusicController.CurrentTrack.Completed += () => trackCompleted = true;
});
AddUntilStep("Track was completed", () => trackCompleted);
- AddUntilStep("Track was restarted", () => Game.Beatmap.Value.Track.IsRunning);
+ AddUntilStep("Track was restarted", () => Game.MusicController.IsPlaying);
}
private void pushEscape() =>
diff --git a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs
index e60adcee34..8f20bcdcc1 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneFullscreenOverlay.cs
@@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneFullscreenOverlay : OsuTestScene
{
- private FullscreenOverlay overlay;
+ private FullscreenOverlay overlay;
protected override void LoadComplete()
{
@@ -38,10 +38,10 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("fire count 3", () => fireCount == 3);
}
- private class TestFullscreenOverlay : FullscreenOverlay
+ private class TestFullscreenOverlay : FullscreenOverlay
{
public TestFullscreenOverlay()
- : base(OverlayColourScheme.Pink)
+ : base(OverlayColourScheme.Pink, null)
{
Children = new Drawable[]
{
diff --git a/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs b/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs
index 103308d34d..9662bd65b4 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneNowPlayingCommand.cs
@@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online
{
AddStep("Set activity", () => API.Activity.Value = new UserActivity.InLobby());
- AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(null, null)
+ AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
{
BeatmapInfo = { OnlineBeatmapID = hasOnlineId ? 1234 : (int?)null }
});
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs
index 48b718c04d..67cd720260 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs
@@ -5,9 +5,9 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
-using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
+using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards;
@@ -53,53 +53,46 @@ namespace osu.Game.Tests.Visual.SongSelect
private void showPersonalBestWithNullPosition()
{
- leaderboard.TopScore = new APILegacyUserTopScoreInfo
+ leaderboard.TopScore = new ScoreInfo
{
- Position = null,
- Score = new APILegacyScoreInfo
+ Rank = ScoreRank.XH,
+ Accuracy = 1,
+ MaxCombo = 244,
+ TotalScore = 1707827,
+ Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock() },
+ User = new User
{
- Rank = ScoreRank.XH,
- Accuracy = 1,
- MaxCombo = 244,
- TotalScore = 1707827,
- Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
- User = new User
+ Id = 6602580,
+ Username = @"waaiiru",
+ Country = new Country
{
- Id = 6602580,
- Username = @"waaiiru",
- Country = new Country
- {
- FullName = @"Spain",
- FlagName = @"ES",
- },
+ FullName = @"Spain",
+ FlagName = @"ES",
},
- }
+ },
};
}
private void showPersonalBest()
{
- leaderboard.TopScore = new APILegacyUserTopScoreInfo
+ leaderboard.TopScore = new ScoreInfo
{
Position = 999,
- Score = new APILegacyScoreInfo
+ Rank = ScoreRank.XH,
+ Accuracy = 1,
+ MaxCombo = 244,
+ TotalScore = 1707827,
+ Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
+ User = new User
{
- Rank = ScoreRank.XH,
- Accuracy = 1,
- MaxCombo = 244,
- TotalScore = 1707827,
- Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
- User = new User
+ Id = 6602580,
+ Username = @"waaiiru",
+ Country = new Country
{
- Id = 6602580,
- Username = @"waaiiru",
- Country = new Country
- {
- FullName = @"Spain",
- FlagName = @"ES",
- },
+ FullName = @"Spain",
+ FlagName = @"ES",
},
- }
+ },
};
}
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs
index 0598324110..b8b8792b9b 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs
@@ -6,11 +6,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
-using osu.Game.Online.API.Requests.Responses;
+using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
+using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Rulesets.Osu.Mods;
-using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.SongSelect
@@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.SongSelect
public TestSceneUserTopScoreContainer()
{
- UserTopScoreContainer topScoreContainer;
+ UserTopScoreContainer topScoreContainer;
Add(dialogOverlay = new DialogOverlay
{
@@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.SongSelect
RelativeSizeAxes = Axes.Both,
Colour = Color4.DarkGreen,
},
- topScoreContainer = new UserTopScoreContainer
+ topScoreContainer = new UserTopScoreContainer(s => new LeaderboardScore(s, s.Position, false))
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
@@ -52,69 +52,60 @@ namespace osu.Game.Tests.Visual.SongSelect
var scores = new[]
{
- new APILegacyUserTopScoreInfo
+ new ScoreInfo
{
Position = 999,
- Score = new APILegacyScoreInfo
+ Rank = ScoreRank.XH,
+ Accuracy = 1,
+ MaxCombo = 244,
+ TotalScore = 1707827,
+ Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
+ User = new User
{
- Rank = ScoreRank.XH,
- Accuracy = 1,
- MaxCombo = 244,
- TotalScore = 1707827,
- Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
- User = new User
+ Id = 6602580,
+ Username = @"waaiiru",
+ Country = new Country
{
- Id = 6602580,
- Username = @"waaiiru",
- Country = new Country
- {
- FullName = @"Spain",
- FlagName = @"ES",
- },
+ FullName = @"Spain",
+ FlagName = @"ES",
},
- }
+ },
},
- new APILegacyUserTopScoreInfo
+ new ScoreInfo
{
Position = 110000,
- Score = new APILegacyScoreInfo
+ Rank = ScoreRank.X,
+ Accuracy = 1,
+ MaxCombo = 244,
+ TotalScore = 1707827,
+ User = new User
{
- Rank = ScoreRank.X,
- Accuracy = 1,
- MaxCombo = 244,
- TotalScore = 1707827,
- User = new User
+ Id = 4608074,
+ Username = @"Skycries",
+ Country = new Country
{
- Id = 4608074,
- Username = @"Skycries",
- Country = new Country
- {
- FullName = @"Brazil",
- FlagName = @"BR",
- },
+ FullName = @"Brazil",
+ FlagName = @"BR",
},
- }
+ },
},
- new APILegacyUserTopScoreInfo
+ new ScoreInfo
{
Position = 22333,
- Score = new APILegacyScoreInfo
+ Rank = ScoreRank.S,
+ Accuracy = 1,
+ MaxCombo = 244,
+ TotalScore = 1707827,
+ User = new User
{
- Rank = ScoreRank.S,
- Accuracy = 1,
- MaxCombo = 244,
- TotalScore = 1707827,
- User = new User
+ Id = 1541390,
+ Username = @"Toukai",
+ Country = new Country
{
- Id = 1541390,
- Username = @"Toukai",
- Country = new Country
- {
- FullName = @"Canada",
- FlagName = @"CA",
- },
+ FullName = @"Canada",
+ FlagName = @"CA",
},
- }
+ },
}
};
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
index dd5ceec739..82b7e65c4f 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
@@ -26,9 +26,6 @@ namespace osu.Game.Tests.Visual.UserInterface
{
private readonly NowPlayingOverlay np;
- [Cached]
- private MusicController musicController = new MusicController();
-
public TestSceneBeatSyncedContainer()
{
Clock = new FramedClock();
@@ -36,7 +33,6 @@ namespace osu.Game.Tests.Visual.UserInterface
AddRange(new Drawable[]
{
- musicController,
new BeatContainer
{
Anchor = Anchor.BottomCentre,
@@ -71,6 +67,9 @@ namespace osu.Game.Tests.Visual.UserInterface
private readonly Box flashLayer;
+ [Resolved]
+ private MusicController musicController { get; set; }
+
public BeatContainer()
{
RelativeSizeAxes = Axes.X;
@@ -165,7 +164,7 @@ namespace osu.Game.Tests.Visual.UserInterface
if (timingPoints.Count == 0) return 0;
if (timingPoints[^1] == current)
- return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength);
+ return (int)Math.Ceiling((musicController.CurrentTrack.Length - current.Time) / current.BeatLength);
return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength);
}
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs
index eb4750a597..e54292f7cc 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs
@@ -6,6 +6,7 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Allocation;
+using osu.Framework.Audio;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Platform;
using osu.Framework.Testing;
@@ -79,7 +80,7 @@ namespace osu.Game.Tests.Visual.UserInterface
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
- dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, Audio, dependencies.Get(), Beatmap.Default));
+ dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get(), dependencies.Get(), Beatmap.Default));
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, null, ContextFactory));
beatmap = beatmapManager.Import(TestResources.GetTestBeatmapForImport()).Result.Beatmaps[0];
diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs
index 532744a0fc..c14a1ddbf2 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@@ -11,6 +12,7 @@ using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
+using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.UserInterface
{
@@ -20,8 +22,6 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private MusicController musicController = new MusicController();
- private WorkingBeatmap currentBeatmap;
-
private NowPlayingOverlay nowPlayingOverlay;
private RulesetStore rulesets;
@@ -76,16 +76,21 @@ namespace osu.Game.Tests.Visual.UserInterface
}
}).Wait(), 5);
- AddStep(@"Next track", () => musicController.NextTrack());
- AddStep("Store track", () => currentBeatmap = Beatmap.Value);
+ WorkingBeatmap currentBeatmap = null;
+
+ AddStep("import beatmap with track", () =>
+ {
+ var setWithTrack = manager.Import(TestResources.GetTestBeatmapForImport()).Result;
+ Beatmap.Value = currentBeatmap = manager.GetWorkingBeatmap(setWithTrack.Beatmaps.First());
+ });
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
- AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000);
+ AddUntilStep(@"Wait for current time to update", () => musicController.CurrentTrack.CurrentTime > 5000);
AddStep(@"Set previous", () => musicController.PreviousTrack());
AddAssert(@"Check beatmap didn't change", () => currentBeatmap == Beatmap.Value);
- AddUntilStep("Wait for current time to update", () => currentBeatmap.Track.CurrentTime < 5000);
+ AddUntilStep("Wait for current time to update", () => musicController.CurrentTrack.CurrentTime < 5000);
AddStep(@"Set previous", () => musicController.PreviousTrack());
AddAssert(@"Check beatmap did change", () => currentBeatmap != Beatmap.Value);
diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs
index 90c91eb007..7dc5ce1d7f 100644
--- a/osu.Game.Tests/WaveformTestBeatmap.cs
+++ b/osu.Game.Tests/WaveformTestBeatmap.cs
@@ -52,7 +52,7 @@ namespace osu.Game.Tests
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
- protected override Track GetTrack() => trackStore.Get(firstAudioFile);
+ protected override Track GetBeatmapTrack() => trackStore.Get(firstAudioFile);
private string firstAudioFile
{
diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj
index d767973528..c692bcd5e4 100644
--- a/osu.Game.Tests/osu.Game.Tests.csproj
+++ b/osu.Game.Tests/osu.Game.Tests.csproj
@@ -3,7 +3,7 @@
-
+
diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs b/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs
new file mode 100644
index 0000000000..33165d385a
--- /dev/null
+++ b/osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs
@@ -0,0 +1,41 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using NUnit.Framework;
+using osu.Game.Tests.Visual;
+using osu.Game.Tournament.Components;
+using osuTK;
+using osuTK.Input;
+
+namespace osu.Game.Tournament.Tests.Components
+{
+ public class TestSceneDateTextBox : OsuManualInputManagerTestScene
+ {
+ private DateTextBox textBox;
+
+ [SetUp]
+ public void Setup() => Schedule(() =>
+ {
+ Child = textBox = new DateTextBox
+ {
+ Width = 0.3f
+ };
+ });
+
+ [Test]
+ public void TestCommitWithoutSettingBindable()
+ {
+ AddStep("click textbox", () =>
+ {
+ InputManager.MoveMouseTo(textBox);
+ InputManager.Click(MouseButton.Left);
+ });
+
+ AddStep("unfocus", () =>
+ {
+ InputManager.MoveMouseTo(Vector2.Zero);
+ InputManager.Click(MouseButton.Left);
+ });
+ }
+ }
+}
diff --git a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
index 95f5deb2cc..5d55196dcf 100644
--- a/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
+++ b/osu.Game.Tournament.Tests/osu.Game.Tournament.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/osu.Game.Tournament/Components/DateTextBox.cs b/osu.Game.Tournament/Components/DateTextBox.cs
index ee7e350970..aee5241e35 100644
--- a/osu.Game.Tournament/Components/DateTextBox.cs
+++ b/osu.Game.Tournament/Components/DateTextBox.cs
@@ -22,11 +22,12 @@ namespace osu.Game.Tournament.Components
}
// hold a reference to the provided bindable so we don't have to in every settings section.
- private Bindable bindable;
+ private Bindable bindable = new Bindable();
public DateTextBox()
{
base.Bindable = new Bindable();
+
((OsuTextBox)Control).OnCommit = (sender, newText) =>
{
try
diff --git a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs
index f3eecf8afe..efec4cffdd 100644
--- a/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs
+++ b/osu.Game.Tournament/Screens/Editors/LadderEditorScreen.cs
@@ -26,6 +26,8 @@ namespace osu.Game.Tournament.Screens.Editors
[Cached]
private LadderEditorInfo editorInfo = new LadderEditorInfo();
+ private WarningBox rightClickMessage;
+
protected override bool DrawLoserPaths => true;
[BackgroundDependencyLoader]
@@ -37,6 +39,16 @@ namespace osu.Game.Tournament.Screens.Editors
Origin = Anchor.TopRight,
Margin = new MarginPadding(5)
});
+
+ AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
+
+ LadderInfo.Matches.CollectionChanged += (_, __) => updateMessage();
+ updateMessage();
+ }
+
+ private void updateMessage()
+ {
+ rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
}
public void BeginJoin(TournamentMatch match, bool losers)
diff --git a/osu.Game.Tournament/TournamentGame.cs b/osu.Game.Tournament/TournamentGame.cs
index 307ee1c773..bbe4a53d8f 100644
--- a/osu.Game.Tournament/TournamentGame.cs
+++ b/osu.Game.Tournament/TournamentGame.cs
@@ -87,30 +87,7 @@ namespace osu.Game.Tournament
},
}
},
- heightWarning = new Container
- {
- Masking = true,
- CornerRadius = 5,
- Depth = float.MinValue,
- Anchor = Anchor.Centre,
- Origin = Anchor.Centre,
- AutoSizeAxes = Axes.Both,
- Children = new Drawable[]
- {
- new Box
- {
- Colour = Color4.Red,
- RelativeSizeAxes = Axes.Both,
- },
- new TournamentSpriteText
- {
- Text = "Please make the window wider",
- Font = OsuFont.Torus.With(weight: FontWeight.Bold),
- Colour = Color4.White,
- Padding = new MarginPadding(20)
- }
- }
- },
+ heightWarning = new WarningBox("Please make the window wider"),
new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
diff --git a/osu.Game.Tournament/WarningBox.cs b/osu.Game.Tournament/WarningBox.cs
new file mode 100644
index 0000000000..814482aea4
--- /dev/null
+++ b/osu.Game.Tournament/WarningBox.cs
@@ -0,0 +1,40 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Graphics;
+using osuTK.Graphics;
+
+namespace osu.Game.Tournament
+{
+ internal class WarningBox : Container
+ {
+ public WarningBox(string text)
+ {
+ Masking = true;
+ CornerRadius = 5;
+ Depth = float.MinValue;
+ Anchor = Anchor.Centre;
+ Origin = Anchor.Centre;
+ AutoSizeAxes = Axes.Both;
+
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.Red,
+ RelativeSizeAxes = Axes.Both,
+ },
+ new TournamentSpriteText
+ {
+ Text = text,
+ Font = OsuFont.Torus.With(weight: FontWeight.Bold),
+ Colour = Color4.White,
+ Padding = new MarginPadding(20)
+ }
+ };
+ }
+ }
+}
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index a96af68714..35b9b90ce7 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -9,6 +9,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
@@ -64,16 +65,16 @@ namespace osu.Game.Beatmaps
private readonly RulesetStore rulesets;
private readonly BeatmapStore beatmaps;
private readonly AudioManager audioManager;
- private readonly GameHost host;
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
+ private readonly TextureStore textureStore;
+ private readonly ITrackStore trackStore;
- public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null,
+ public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, GameHost host = null,
WorkingBeatmap defaultBeatmap = null)
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
{
this.rulesets = rulesets;
this.audioManager = audioManager;
- this.host = host;
DefaultBeatmap = defaultBeatmap;
@@ -84,6 +85,9 @@ namespace osu.Game.Beatmaps
beatmaps.ItemUpdated += removeWorkingCache;
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
+
+ textureStore = new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store));
+ trackStore = audioManager.GetTrackStore(Files.Store);
}
protected override ArchiveDownloadRequest CreateDownloadRequest(BeatmapSetInfo set, bool minimiseDownloadSize) =>
@@ -220,7 +224,7 @@ namespace osu.Game.Beatmaps
removeWorkingCache(info);
}
- private readonly WeakList workingCache = new WeakList();
+ private readonly WeakList workingCache = new WeakList();
///
/// Retrieve a instance for the provided
@@ -248,16 +252,13 @@ namespace osu.Game.Beatmaps
lock (workingCache)
{
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
+ if (working != null)
+ return working;
- if (working == null)
- {
- beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
+ beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
- workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store,
- new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager));
- }
+ workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store, textureStore, trackStore, beatmapInfo, audioManager));
- previous?.TransferTo(working);
return working;
}
}
@@ -461,7 +462,7 @@ namespace osu.Game.Beatmaps
protected override IBeatmap GetBeatmap() => beatmap;
protected override Texture GetBackground() => null;
- protected override Track GetTrack() => null;
+ protected override Track GetBeatmapTrack() => null;
}
}
diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs
index 39c5ccab27..92199789ec 100644
--- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs
@@ -17,15 +17,18 @@ namespace osu.Game.Beatmaps
{
public partial class BeatmapManager
{
- protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap
+ private class BeatmapManagerWorkingBeatmap : WorkingBeatmap
{
private readonly IResourceStore store;
+ private readonly TextureStore textureStore;
+ private readonly ITrackStore trackStore;
- public BeatmapManagerWorkingBeatmap(IResourceStore store, TextureStore textureStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
+ public BeatmapManagerWorkingBeatmap(IResourceStore store, TextureStore textureStore, ITrackStore trackStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
: base(beatmapInfo, audioManager)
{
this.store = store;
this.textureStore = textureStore;
+ this.trackStore = trackStore;
}
protected override IBeatmap GetBeatmap()
@@ -44,10 +47,6 @@ namespace osu.Game.Beatmaps
private string getPathForFile(string filename) => BeatmapSetInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, filename, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
- private TextureStore textureStore;
-
- private ITrackStore trackStore;
-
protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes.
protected override Texture GetBackground()
@@ -66,11 +65,11 @@ namespace osu.Game.Beatmaps
}
}
- protected override Track GetTrack()
+ protected override Track GetBeatmapTrack()
{
try
{
- return (trackStore ??= AudioManager.GetTrackStore(store)).Get(getPathForFile(Metadata.AudioFile));
+ return trackStore.Get(getPathForFile(Metadata.AudioFile));
}
catch (Exception e)
{
@@ -79,22 +78,6 @@ namespace osu.Game.Beatmaps
}
}
- public override void RecycleTrack()
- {
- base.RecycleTrack();
-
- trackStore?.Dispose();
- trackStore = null;
- }
-
- public override void TransferTo(WorkingBeatmap other)
- {
- base.TransferTo(other);
-
- if (other is BeatmapManagerWorkingBeatmap owb && textureStore != null && BeatmapInfo.BackgroundEquals(other.BeatmapInfo))
- owb.textureStore = textureStore;
- }
-
protected override Waveform GetWaveform()
{
try
diff --git a/osu.Game/Beatmaps/BeatmapStatistic.cs b/osu.Game/Beatmaps/BeatmapStatistic.cs
index 0745ec5222..9d87a20d60 100644
--- a/osu.Game/Beatmaps/BeatmapStatistic.cs
+++ b/osu.Game/Beatmaps/BeatmapStatistic.cs
@@ -1,14 +1,31 @@
// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
+using osuTK;
namespace osu.Game.Beatmaps
{
public class BeatmapStatistic
{
- public IconUsage Icon;
+ [Obsolete("Use CreateIcon instead")] // can be removed 20210203
+ public IconUsage Icon = FontAwesome.Regular.QuestionCircle;
+
+ ///
+ /// A function to create the icon for display purposes. Use default icons available via whenever possible for conformity.
+ ///
+ public Func CreateIcon;
+
public string Content;
public string Name;
+
+ public BeatmapStatistic()
+ {
+#pragma warning disable 618
+ CreateIcon = () => new SpriteIcon { Icon = Icon, Scale = new Vector2(0.7f) };
+#pragma warning restore 618
+ }
}
}
diff --git a/osu.Game/Beatmaps/BeatmapStatisticIcon.cs b/osu.Game/Beatmaps/BeatmapStatisticIcon.cs
new file mode 100644
index 0000000000..181fb540df
--- /dev/null
+++ b/osu.Game/Beatmaps/BeatmapStatisticIcon.cs
@@ -0,0 +1,43 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using Humanizer;
+using osu.Framework.Allocation;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.Textures;
+
+namespace osu.Game.Beatmaps
+{
+ ///
+ /// A default implementation of an icon used to represent beatmap statistics.
+ ///
+ public class BeatmapStatisticIcon : Sprite
+ {
+ private readonly BeatmapStatisticsIconType iconType;
+
+ public BeatmapStatisticIcon(BeatmapStatisticsIconType iconType)
+ {
+ this.iconType = iconType;
+ }
+
+ [BackgroundDependencyLoader]
+ private void load(TextureStore textures)
+ {
+ Texture = textures.Get($"Icons/BeatmapDetails/{iconType.ToString().Kebaberize()}");
+ }
+ }
+
+ public enum BeatmapStatisticsIconType
+ {
+ Accuracy,
+ ApproachRate,
+ Bpm,
+ Circles,
+ HpDrain,
+ Length,
+ OverallDifficulty,
+ Size,
+ Sliders,
+ Spinners,
+ }
+}
diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs
index 8080e94075..af2a2ac250 100644
--- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using JetBrains.Annotations;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.IEnumerableExtensions;
@@ -19,7 +20,7 @@ namespace osu.Game.Beatmaps
{
private readonly TextureStore textures;
- public DummyWorkingBeatmap(AudioManager audio, TextureStore textures)
+ public DummyWorkingBeatmap([NotNull] AudioManager audio, TextureStore textures)
: base(new BeatmapInfo
{
Metadata = new BeatmapMetadata
@@ -44,7 +45,7 @@ namespace osu.Game.Beatmaps
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
- protected override Track GetTrack() => GetVirtualTrack();
+ protected override Track GetBeatmapTrack() => GetVirtualTrack();
private class DummyRulesetInfo : RulesetInfo
{
diff --git a/osu.Game/Beatmaps/IWorkingBeatmap.cs b/osu.Game/Beatmaps/IWorkingBeatmap.cs
index 31975157a0..bcd94d76fd 100644
--- a/osu.Game/Beatmaps/IWorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/IWorkingBeatmap.cs
@@ -26,11 +26,6 @@ namespace osu.Game.Beatmaps
///
Texture Background { get; }
- ///
- /// Retrieves the audio track for this .
- ///
- Track Track { get; }
-
///
/// Retrieves the for the of this .
///
@@ -59,5 +54,18 @@ namespace osu.Game.Beatmaps
/// The converted .
/// If could not be converted to .
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList mods = null, TimeSpan? timeout = null);
+
+ ///
+ /// Load a new audio track instance for this beatmap. This should be called once before accessing .
+ /// The caller of this method is responsible for the lifetime of the track.
+ ///
+ ///
+ /// In a standard game context, the loading of the track is managed solely by MusicController, which will
+ /// automatically load the track of the current global IBindable WorkingBeatmap.
+ /// As such, this method should only be called in very special scenarios, such as external tests or apps which are
+ /// outside of the game context.
+ ///
+ /// A fresh track instance, which will also be available via .
+ Track LoadTrack();
}
}
diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs
index b4bcf285b9..6a161e6e04 100644
--- a/osu.Game/Beatmaps/WorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/WorkingBeatmap.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
@@ -40,7 +41,6 @@ namespace osu.Game.Beatmaps
BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
- track = new RecyclableLazy
-
-
+
+
@@ -80,7 +80,7 @@
-
+