1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Add far too many fixes for ruleset non-nullable requirements

This commit is contained in:
Dean Herbert 2022-01-12 23:17:35 +09:00
parent 51251e3204
commit b5f670cc5b
15 changed files with 96 additions and 19 deletions

View File

@ -29,7 +29,13 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
protected CatchSelectionBlueprintTestScene() protected CatchSelectionBlueprintTestScene()
{ {
EditorBeatmap = new EditorBeatmap(new CatchBeatmap()) { Difficulty = { CircleSize = 0 } }; EditorBeatmap = new EditorBeatmap(new CatchBeatmap
{
BeatmapInfo =
{
Ruleset = new CatchRuleset().RulesetInfo,
}
}) { Difficulty = { CircleSize = 0 } };
EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint EditorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint
{ {
BeatLength = 100 BeatLength = 100

View File

@ -29,7 +29,13 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
private ScrollingTestContainer.TestScrollingInfo scrollingInfo = new ScrollingTestContainer.TestScrollingInfo(); private ScrollingTestContainer.TestScrollingInfo scrollingInfo = new ScrollingTestContainer.TestScrollingInfo();
[Cached(typeof(EditorBeatmap))] [Cached(typeof(EditorBeatmap))]
private EditorBeatmap editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition())); private EditorBeatmap editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition())
{
BeatmapInfo =
{
Ruleset = new ManiaRuleset().RulesetInfo
}
});
private readonly ManiaBeatSnapGrid beatSnapGrid; private readonly ManiaBeatSnapGrid beatSnapGrid;

View File

@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
{ {
AddStep("setup compose screen", () => AddStep("setup compose screen", () =>
{ {
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })) var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }, BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
}; });
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);

View File

@ -203,10 +203,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })) EditorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
{ {
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo } BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo }
}, }),
Composer = new ManiaHitObjectComposer(new ManiaRuleset()) Composer = new ManiaHitObjectComposer(new ManiaRuleset())
}; };

View File

@ -40,7 +40,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
public TestSceneOsuDistanceSnapGrid() public TestSceneOsuDistanceSnapGrid()
{ {
editorBeatmap = new EditorBeatmap(new OsuBeatmap()); editorBeatmap = new EditorBeatmap(new OsuBeatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
}
});
} }
[SetUp] [SetUp]

View File

@ -40,10 +40,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
EditorBeatmap = new EditorBeatmap(new TaikoBeatmap()) EditorBeatmap = new EditorBeatmap(new TaikoBeatmap
{ {
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo } BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo }
}, }),
new TaikoHitObjectComposer(new TaikoRuleset()) new TaikoHitObjectComposer(new TaikoRuleset())
}; };

View File

@ -2,7 +2,8 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
@ -158,7 +159,13 @@ namespace osu.Game.Tests.Editing
private (EditorChangeHandler, EditorBeatmap) createChangeHandler() private (EditorChangeHandler, EditorBeatmap) createChangeHandler()
{ {
var beatmap = new EditorBeatmap(new Beatmap()); var beatmap = new EditorBeatmap(new OsuBeatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo,
},
});
var changeHandler = new EditorChangeHandler(beatmap); var changeHandler = new EditorChangeHandler(beatmap);

View File

@ -35,7 +35,13 @@ namespace osu.Game.Tests.Editing
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
editorBeatmap = new EditorBeatmap(new OsuBeatmap()), editorBeatmap = new EditorBeatmap(new OsuBeatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo,
},
}),
Content = new Container Content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -9,9 +9,11 @@ using System.Threading.Tasks;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.IO.Archives; using osu.Game.IO.Archives;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
@ -39,6 +41,8 @@ namespace osu.Game.Tests.Scores.IO
User = new APIUser { Username = "Test user" }, User = new APIUser { Username = "Test user" },
Date = DateTimeOffset.Now, Date = DateTimeOffset.Now,
OnlineID = 12345, OnlineID = 12345,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = new BeatmapInfo()
}; };
var imported = await LoadScoreIntoOsu(osu, toImport); var imported = await LoadScoreIntoOsu(osu, toImport);
@ -70,6 +74,8 @@ namespace osu.Game.Tests.Scores.IO
var toImport = new ScoreInfo var toImport = new ScoreInfo
{ {
User = new APIUser { Username = "Test user" }, User = new APIUser { Username = "Test user" },
BeatmapInfo = new BeatmapInfo(),
Ruleset = new OsuRuleset().RulesetInfo,
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() }, Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
}; };
@ -97,6 +103,8 @@ namespace osu.Game.Tests.Scores.IO
var toImport = new ScoreInfo var toImport = new ScoreInfo
{ {
User = new APIUser { Username = "Test user" }, User = new APIUser { Username = "Test user" },
BeatmapInfo = new BeatmapInfo(),
Ruleset = new OsuRuleset().RulesetInfo,
Statistics = new Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>
{ {
{ HitResult.Perfect, 100 }, { HitResult.Perfect, 100 },
@ -128,6 +136,8 @@ namespace osu.Game.Tests.Scores.IO
await LoadScoreIntoOsu(osu, new ScoreInfo await LoadScoreIntoOsu(osu, new ScoreInfo
{ {
User = new APIUser { Username = "Test user" }, User = new APIUser { Username = "Test user" },
BeatmapInfo = new BeatmapInfo(),
Ruleset = new OsuRuleset().RulesetInfo,
OnlineID = 2 OnlineID = 2
}, new TestArchiveReader()); }, new TestArchiveReader());
@ -137,6 +147,7 @@ namespace osu.Game.Tests.Scores.IO
Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo
{ {
User = new APIUser { Username = "Test user" }, User = new APIUser { Username = "Test user" },
BeatmapInfo = new BeatmapInfo(),
OnlineID = 2 OnlineID = 2
})); }));
} }

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Edit.Setup;
using osuTK.Input; using osuTK.Input;
@ -25,7 +26,13 @@ namespace osu.Game.Tests.Visual.Editing
[SetUpSteps] [SetUpSteps]
public void SetUp() public void SetUp()
{ {
AddStep("create blank beatmap", () => editorBeatmap = new EditorBeatmap(new Beatmap())); AddStep("create blank beatmap", () => editorBeatmap = new EditorBeatmap(new Beatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
}
}));
AddStep("create section", () => Child = new DependencyProvidingContainer AddStep("create section", () => Child = new DependencyProvidingContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Screens.Edit.Compose.Components;
@ -29,7 +30,13 @@ namespace osu.Game.Tests.Visual.Editing
public TestSceneDistanceSnapGrid() public TestSceneDistanceSnapGrid()
{ {
editorBeatmap = new EditorBeatmap(new OsuBeatmap()); editorBeatmap = new EditorBeatmap(new OsuBeatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
}
});
editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length }); editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = beat_length });
} }

View File

@ -39,9 +39,16 @@ namespace osu.Game.Tests.Visual.Editing
{ {
Beatmap.Value = CreateWorkingBeatmap(new Beatmap Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{ {
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
},
HitObjects = new List<HitObject> HitObjects = new List<HitObject>
{ {
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f }, new HitCircle
{
Position = new Vector2(256, 192), Scale = 0.5f
},
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f }, new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
new Slider new Slider
{ {

View File

@ -5,6 +5,7 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Edit.Setup;
@ -13,7 +14,13 @@ namespace osu.Game.Tests.Visual.Editing
public class TestSceneMetadataSection : OsuTestScene public class TestSceneMetadataSection : OsuTestScene
{ {
[Cached] [Cached]
private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap()); private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
},
});
private TestMetadataSection metadataSection; private TestMetadataSection metadataSection;

View File

@ -29,7 +29,13 @@ namespace osu.Game.Tests.Visual.Editing
public TestSceneSetupScreen() public TestSceneSetupScreen()
{ {
editorBeatmap = new EditorBeatmap(new OsuBeatmap()); editorBeatmap = new EditorBeatmap(new OsuBeatmap
{
BeatmapInfo =
{
Ruleset = new OsuRuleset().RulesetInfo
}
});
} }
[Test] [Test]

View File

@ -81,8 +81,9 @@ namespace osu.Game.Tournament
ladder ??= new LadderInfo(); ladder ??= new LadderInfo();
ladder.Ruleset.Value = RulesetStore.GetRuleset(ladder.Ruleset.Value.ShortName) ladder.Ruleset.Value = ladder.Ruleset.Value != null
?? RulesetStore.AvailableRulesets.First(); ? RulesetStore.GetRuleset(ladder.Ruleset.Value.ShortName)
: RulesetStore.AvailableRulesets.First();
bool addedInfo = false; bool addedInfo = false;