1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 15:27:24 +08:00

Move SkinnableTestScene into using the global CreateRuleset method

This commit is contained in:
Salman Ahmed 2020-04-17 11:17:14 +03:00
parent 67bd7bfa39
commit 5fa6bcb5a3
5 changed files with 13 additions and 10 deletions

View File

@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Catch.Tests
typeof(CatchLegacySkinTransformer),
};
protected override Ruleset CreateRulesetForSkinProvider() => new CatchRuleset();
protected override Ruleset CreateRuleset() => new CatchRuleset();
}
}

View File

@ -34,8 +34,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
typeof(ManiaSettingsSubsection)
};
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
protected ManiaSkinnableTestScene()
{
scrollingInfo.Direction.Value = ScrollingDirection.Down;
@ -60,6 +58,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
AddStep("change direction to up", () => scrollingInfo.Direction.Value = ScrollingDirection.Up);
}
protected override Ruleset CreateRuleset() => new ManiaRuleset();
private class TestScrollingInfo : IScrollingInfo
{
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();

View File

@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Osu.Tests
typeof(OsuLegacySkinTransformer),
};
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
protected override Ruleset CreateRuleset() => new OsuRuleset();
}
}

View File

@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
typeof(TaikoLegacySkinTransformer),
};
protected override Ruleset CreateRulesetForSkinProvider() => new TaikoRuleset();
protected override Ruleset CreateRuleset() => new TaikoRuleset();
}
}

View File

@ -13,7 +13,6 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
@ -30,10 +29,14 @@ namespace osu.Game.Tests.Visual
protected SkinnableTestScene()
: base(2, 3)
{
// avoid running silently incorrectly.
if (CreateRuleset() == null)
{
throw new InvalidOperationException(
$"No ruleset provided, override {nameof(CreateRuleset)} to the ruleset belonging to the skinnable content."
+ "This is required to add the legacy skin transformer for the content to behave as expected.");
}
}
// Required to be part of the per-ruleset implementation to construct the newer version of the Ruleset.
protected abstract Ruleset CreateRulesetForSkinProvider();
[BackgroundDependencyLoader]
private void load(AudioManager audio, SkinManager skinManager)
@ -107,7 +110,7 @@ namespace osu.Game.Tests.Visual
{
new OutlineBox { Alpha = autoSize ? 1 : 0 },
mainProvider.WithChild(
new SkinProvidingContainer(CreateRulesetForSkinProvider().CreateLegacySkinProvider(mainProvider, beatmap))
new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
{
Child = created,
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,