mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09: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),
|
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)
|
typeof(ManiaSettingsSubsection)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
|
|
||||||
|
|
||||||
protected ManiaSkinnableTestScene()
|
protected ManiaSkinnableTestScene()
|
||||||
{
|
{
|
||||||
scrollingInfo.Direction.Value = ScrollingDirection.Down;
|
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);
|
AddStep("change direction to up", () => scrollingInfo.Direction.Value = ScrollingDirection.Up);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Ruleset CreateRuleset() => new ManiaRuleset();
|
||||||
|
|
||||||
private class TestScrollingInfo : IScrollingInfo
|
private class TestScrollingInfo : IScrollingInfo
|
||||||
{
|
{
|
||||||
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||||
|
@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
typeof(OsuLegacySkinTransformer),
|
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),
|
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.Framework.IO.Stores;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -30,11 +29,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected SkinnableTestScene()
|
protected SkinnableTestScene()
|
||||||
: base(2, 3)
|
: 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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SkinManager skinManager)
|
private void load(AudioManager audio, SkinManager skinManager)
|
||||||
{
|
{
|
||||||
@ -107,7 +110,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
new OutlineBox { Alpha = autoSize ? 1 : 0 },
|
new OutlineBox { Alpha = autoSize ? 1 : 0 },
|
||||||
mainProvider.WithChild(
|
mainProvider.WithChild(
|
||||||
new SkinProvidingContainer(CreateRulesetForSkinProvider().CreateLegacySkinProvider(mainProvider, beatmap))
|
new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
|
||||||
{
|
{
|
||||||
Child = created,
|
Child = created,
|
||||||
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
|
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user