mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:25:04 +08:00
Move SkinnableTestScene
into using the global CreateRuleset
method
This commit is contained in:
parent
67bd7bfa39
commit
5fa6bcb5a3
@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
typeof(CatchLegacySkinTransformer),
|
||||
};
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new CatchRuleset();
|
||||
protected override Ruleset CreateRuleset() => new CatchRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -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>();
|
||||
|
@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
typeof(OsuLegacySkinTransformer),
|
||||
};
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||
protected override Ruleset CreateRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
typeof(TaikoLegacySkinTransformer),
|
||||
};
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new TaikoRuleset();
|
||||
protected override Ruleset CreateRuleset() => new TaikoRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -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,11 +29,15 @@ 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,
|
||||
|
Loading…
Reference in New Issue
Block a user