1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:43:19 +08:00

Merge branch 'master' into realm-beatmap-file-relation

This commit is contained in:
Dean Herbert 2021-11-23 10:20:22 +09:00 committed by GitHub
commit 119ac19f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 67 deletions

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
new Drawable[] new Drawable[]
{ {
recordingManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) recordingManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
Recorder = recorder = new TestReplayRecorder(new Score Recorder = recorder = new TestReplayRecorder(new Score
{ {
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}, },
new Drawable[] new Drawable[]
{ {
playbackManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) playbackManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
ReplayInputHandler = new TestFramedReplayInputHandler(replay) ReplayInputHandler = new TestFramedReplayInputHandler(replay)
{ {

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
new Drawable[] new Drawable[]
{ {
recordingManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) recordingManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
Recorder = new TestReplayRecorder(new Score Recorder = new TestReplayRecorder(new Score
{ {
@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}, },
new Drawable[] new Drawable[]
{ {
playbackManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) playbackManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
ReplayInputHandler = new TestFramedReplayInputHandler(replay) ReplayInputHandler = new TestFramedReplayInputHandler(replay)
{ {

View File

@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
new Drawable[] new Drawable[]
{ {
recordingManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) recordingManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
Recorder = recorder = new TestReplayRecorder Recorder = recorder = new TestReplayRecorder
{ {
@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}, },
new Drawable[] new Drawable[]
{ {
playbackManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique) playbackManager = new TestRulesetInputManager(TestSceneModSettings.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
{ {
Clock = new FramedClock(manualClock), Clock = new FramedClock(manualClock),
ReplayInputHandler = replayHandler = new TestFramedReplayInputHandler(replay) ReplayInputHandler = replayHandler = new TestFramedReplayInputHandler(replay)

View File

@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.UserInterface
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
{ {
SelectedMods.Value = Array.Empty<Mod>(); SelectedMods.Value = Array.Empty<Mod>();
Ruleset.Value = new TestRulesetInfo(); Ruleset.Value = CreateTestRulesetInfo();
}); });
[Test] [Test]
@ -170,14 +170,7 @@ namespace osu.Game.Tests.Visual.UserInterface
ModSettingsContainer.Parent.Width = newWidth; ModSettingsContainer.Parent.Width = newWidth;
} }
public class TestRulesetInfo : RulesetInfo public static RulesetInfo CreateTestRulesetInfo() => new TestCustomisableModRuleset().RulesetInfo;
{
public override Ruleset CreateInstance() => new TestCustomisableModRuleset();
public TestRulesetInfo()
{
Available = true;
}
public class TestCustomisableModRuleset : Ruleset public class TestCustomisableModRuleset : Ruleset
{ {
@ -204,7 +197,6 @@ namespace osu.Game.Tests.Visual.UserInterface
public override string Description { get; } = "test"; public override string Description { get; } = "test";
public override string ShortName { get; } = "tst"; public override string ShortName { get; } = "tst";
} }
}
private class TestModCustomisable1 : TestModCustomisable private class TestModCustomisable1 : TestModCustomisable
{ {

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps
CircleSize = 0, CircleSize = 0,
OverallDifficulty = 0, OverallDifficulty = 0,
}, },
Ruleset = new DummyRulesetInfo() Ruleset = new DummyRuleset().RulesetInfo
}, audio) }, audio)
{ {
this.textures = textures; this.textures = textures;
@ -54,10 +54,6 @@ namespace osu.Game.Beatmaps
public override Stream GetStream(string storagePath) => null; public override Stream GetStream(string storagePath) => null;
private class DummyRulesetInfo : RulesetInfo
{
public override Ruleset CreateInstance() => new DummyRuleset();
private class DummyRuleset : Ruleset private class DummyRuleset : Ruleset
{ {
public override IEnumerable<Mod> GetModsFor(ModType type) => Array.Empty<Mod>(); public override IEnumerable<Mod> GetModsFor(ModType type) => Array.Empty<Mod>();
@ -94,4 +90,3 @@ namespace osu.Game.Beatmaps
} }
} }
} }
}

View File

@ -10,7 +10,7 @@ using osu.Framework.Testing;
namespace osu.Game.Rulesets namespace osu.Game.Rulesets
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
public class RulesetInfo : IEquatable<RulesetInfo>, IRulesetInfo public sealed class RulesetInfo : IEquatable<RulesetInfo>, IRulesetInfo
{ {
public int? ID { get; set; } public int? ID { get; set; }
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets
public bool Available { get; set; } public bool Available { get; set; }
// TODO: this should probably be moved to RulesetStore. // TODO: this should probably be moved to RulesetStore.
public virtual Ruleset CreateInstance() public Ruleset CreateInstance()
{ {
if (!Available) return null; if (!Available) return null;