1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +08:00

Rename SkinComponentsContainerLookup to GlobalSkinnableContainerLookup

This commit is contained in:
Dean Herbert 2024-08-22 18:39:36 +09:00
parent 41756520b1
commit f37cab0c6e
No known key found for this signature in database
18 changed files with 59 additions and 59 deletions

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
// Only handle per ruleset defaults here. // Only handle per ruleset defaults here.
if (containerLookup.Ruleset == null) if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup); return base.GetDrawableComponent(lookup);
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
// Our own ruleset components default. // Our own ruleset components default.
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
// todo: remove CatchSkinComponents.CatchComboCounter and refactor LegacyCatchComboCounter to be added here instead. // todo: remove CatchSkinComponents.CatchComboCounter and refactor LegacyCatchComboCounter to be added here instead.
return new DefaultSkinComponentsContainer(container => return new DefaultSkinComponentsContainer(container =>
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
{ {
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
// Only handle per ruleset defaults here. // Only handle per ruleset defaults here.
if (containerLookup.Ruleset == null) if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup); return base.GetDrawableComponent(lookup);
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container => return new DefaultSkinComponentsContainer(container =>
{ {
var combo = container.ChildrenOfType<ArgonManiaComboCounter>().FirstOrDefault(); var combo = container.ChildrenOfType<ArgonManiaComboCounter>().FirstOrDefault();

View File

@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
{ {
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
// Modifications for global components. // Modifications for global components.
if (containerLookup.Ruleset == null) if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup); return base.GetDrawableComponent(lookup);
@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container => return new DefaultSkinComponentsContainer(container =>
{ {
var combo = container.ChildrenOfType<LegacyManiaComboCounter>().FirstOrDefault(); var combo = container.ChildrenOfType<LegacyManiaComboCounter>().FirstOrDefault();

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
// Only handle per ruleset defaults here. // Only handle per ruleset defaults here.
if (containerLookup.Ruleset == null) if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup); return base.GetDrawableComponent(lookup);
@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
// Our own ruleset components default. // Our own ruleset components default.
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container => return new DefaultSkinComponentsContainer(container =>
{ {
var keyCounter = container.OfType<LegacyKeyCounterDisplay>().FirstOrDefault(); var keyCounter = container.OfType<LegacyKeyCounterDisplay>().FirstOrDefault();

View File

@ -107,7 +107,7 @@ namespace osu.Game.Tests.Skins
var skin = new TestSkin(new SkinInfo(), null, storage); var skin = new TestSkin(new SkinInfo(), null, storage);
Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2)); Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(9)); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(9));
} }
} }
@ -120,8 +120,8 @@ namespace osu.Game.Tests.Skins
var skin = new TestSkin(new SkinInfo(), null, storage); var skin = new TestSkin(new SkinInfo(), null, storage);
Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2)); Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(10)); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(10));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(PlayerName))); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(PlayerName)));
} }
} }
@ -134,10 +134,10 @@ namespace osu.Game.Tests.Skins
var skin = new TestSkin(new SkinInfo(), null, storage); var skin = new TestSkin(new SkinInfo(), null, storage);
Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2)); Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(6)); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(6));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.SongSelect].AllDrawables.ToArray(), Has.Length.EqualTo(1)); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect].AllDrawables.ToArray(), Has.Length.EqualTo(1));
var skinnableInfo = skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.SongSelect].AllDrawables.First(); var skinnableInfo = skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect].AllDrawables.First();
Assert.That(skinnableInfo.Type, Is.EqualTo(typeof(SkinnableSprite))); Assert.That(skinnableInfo.Type, Is.EqualTo(typeof(SkinnableSprite)));
Assert.That(skinnableInfo.Settings.First().Key, Is.EqualTo("sprite_name")); Assert.That(skinnableInfo.Settings.First().Key, Is.EqualTo("sprite_name"));
@ -148,10 +148,10 @@ namespace osu.Game.Tests.Skins
using (var storage = new ZipArchiveReader(stream)) using (var storage = new ZipArchiveReader(stream))
{ {
var skin = new TestSkin(new SkinInfo(), null, storage); var skin = new TestSkin(new SkinInfo(), null, storage);
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(8)); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(8));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(UnstableRateCounter))); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(UnstableRateCounter)));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(ColourHitErrorMeter))); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(ColourHitErrorMeter)));
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(LegacySongProgress))); Assert.That(skin.LayoutInfos[GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(LegacySongProgress)));
} }
} }

View File

@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
CreateSkinTest(TrianglesSkin.CreateInfo(), () => new LegacyBeatmapSkin(new BeatmapInfo(), null)); CreateSkinTest(TrianglesSkin.CreateInfo(), () => new LegacyBeatmapSkin(new BeatmapInfo(), null));
AddUntilStep("wait for hud load", () => Player.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded)); AddUntilStep("wait for hud load", () => Player.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded));
AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(SkinComponentsContainerLookup.TargetArea.MainHUDComponents, skinManager.CurrentSkin.Value)); AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents, skinManager.CurrentSkin.Value));
} }
protected void CreateSkinTest(SkinInfo gameCurrentSkin, Func<ISkin> getBeatmapSkin) protected void CreateSkinTest(SkinInfo gameCurrentSkin, Func<ISkin> getBeatmapSkin)
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}); });
} }
protected bool AssertComponentsFromExpectedSource(SkinComponentsContainerLookup.TargetArea target, ISkin expectedSource) protected bool AssertComponentsFromExpectedSource(GlobalSkinnableContainerLookup.GlobalSkinnableContainers target, ISkin expectedSource)
{ {
var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Target == target); var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Target == target);
var actualComponentsContainer = targetContainer.ChildrenOfType<Container>().SingleOrDefault(c => c.Parent == targetContainer); var actualComponentsContainer = targetContainer.ChildrenOfType<Container>().SingleOrDefault(c => c.Parent == targetContainer);
@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var actualInfo = actualComponentsContainer.CreateSerialisedInfo(); var actualInfo = actualComponentsContainer.CreateSerialisedInfo();
var expectedComponentsContainer = expectedSource.GetDrawableComponent(new SkinComponentsContainerLookup(target)) as Container; var expectedComponentsContainer = expectedSource.GetDrawableComponent(new GlobalSkinnableContainerLookup(target)) as Container;
if (expectedComponentsContainer == null) if (expectedComponentsContainer == null)
return false; return false;

View File

@ -378,10 +378,10 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
private SkinnableContainer globalHUDTarget => Player.ChildrenOfType<SkinnableContainer>() private SkinnableContainer globalHUDTarget => Player.ChildrenOfType<SkinnableContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset == null); .Single(c => c.Lookup.Target == GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset == null);
private SkinnableContainer rulesetHUDTarget => Player.ChildrenOfType<SkinnableContainer>() private SkinnableContainer rulesetHUDTarget => Player.ChildrenOfType<SkinnableContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset != null); .Single(c => c.Lookup.Target == GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset != null);
[Test] [Test]
public void TestMigrationArgon() public void TestMigrationArgon()

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestToggleEditor() public void TestToggleEditor()
{ {
var skinComponentsContainer = new SkinnableContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.SongSelect)); var skinComponentsContainer = new SkinnableContainer(new GlobalSkinnableContainerLookup(GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect));
AddStep("show available components", () => SetContents(_ => new SkinComponentToolbox(skinComponentsContainer, null) AddStep("show available components", () => SetContents(_ => new SkinComponentToolbox(skinComponentsContainer, null)
{ {

View File

@ -72,7 +72,7 @@ namespace osu.Game.Overlays.SkinEditor
[Cached] [Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
private readonly Bindable<SkinComponentsContainerLookup?> selectedTarget = new Bindable<SkinComponentsContainerLookup?>(); private readonly Bindable<GlobalSkinnableContainerLookup?> selectedTarget = new Bindable<GlobalSkinnableContainerLookup?>();
private bool hasBegunMutating; private bool hasBegunMutating;
@ -330,7 +330,7 @@ namespace osu.Game.Overlays.SkinEditor
} }
} }
private void targetChanged(ValueChangedEvent<SkinComponentsContainerLookup?> target) private void targetChanged(ValueChangedEvent<GlobalSkinnableContainerLookup?> target)
{ {
foreach (var toolbox in componentsSidebar.OfType<SkinComponentToolbox>()) foreach (var toolbox in componentsSidebar.OfType<SkinComponentToolbox>())
toolbox.Expire(); toolbox.Expire();
@ -360,7 +360,7 @@ namespace osu.Game.Overlays.SkinEditor
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsDropdown<SkinComponentsContainerLookup?> new SettingsDropdown<GlobalSkinnableContainerLookup?>
{ {
Items = availableTargets.Select(t => t.Lookup).Distinct(), Items = availableTargets.Select(t => t.Lookup).Distinct(),
Current = selectedTarget, Current = selectedTarget,
@ -476,7 +476,7 @@ namespace osu.Game.Overlays.SkinEditor
private SkinnableContainer? getFirstTarget() => availableTargets.FirstOrDefault(); private SkinnableContainer? getFirstTarget() => availableTargets.FirstOrDefault();
private SkinnableContainer? getTarget(SkinComponentsContainerLookup? target) private SkinnableContainer? getTarget(GlobalSkinnableContainerLookup? target)
{ {
return availableTargets.FirstOrDefault(c => c.Lookup.Equals(target)); return availableTargets.FirstOrDefault(c => c.Lookup.Equals(target));
} }

View File

@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play
private readonly List<Drawable> hideTargets; private readonly List<Drawable> hideTargets;
/// <summary> /// <summary>
/// The container for skin components attached to <see cref="SkinComponentsContainerLookup.TargetArea.Playfield"/> /// The container for skin components attached to <see cref="GlobalSkinnableContainerLookup.GlobalSkinnableContainers.Playfield"/>
/// </summary> /// </summary>
internal readonly Drawable PlayfieldSkinLayer; internal readonly Drawable PlayfieldSkinLayer;
@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
? (rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, }) ? (rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, })
: Empty(), : Empty(),
PlayfieldSkinLayer = drawableRuleset != null PlayfieldSkinLayer = drawableRuleset != null
? new SkinnableContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, } ? new SkinnableContainer(new GlobalSkinnableContainerLookup(GlobalSkinnableContainerLookup.GlobalSkinnableContainers.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, }
: Empty(), : Empty(),
topRightElements = new FillFlowContainer topRightElements = new FillFlowContainer
{ {
@ -448,7 +448,7 @@ namespace osu.Game.Screens.Play
private OsuConfigManager config { get; set; } private OsuConfigManager config { get; set; }
public HUDComponentsContainer([CanBeNull] RulesetInfo ruleset = null) public HUDComponentsContainer([CanBeNull] RulesetInfo ruleset = null)
: base(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.MainHUDComponents, ruleset)) : base(new GlobalSkinnableContainerLookup(GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents, ruleset))
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -321,7 +321,7 @@ namespace osu.Game.Screens.Select
} }
} }
}, },
new SkinnableContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.SongSelect)) new SkinnableContainer(new GlobalSkinnableContainerLookup(GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },

View File

@ -96,14 +96,14 @@ namespace osu.Game.Skinning
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c) if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c; return c;
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.SongSelect: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect:
var songSelectComponents = new DefaultSkinComponentsContainer(_ => var songSelectComponents = new DefaultSkinComponentsContainer(_ =>
{ {
// do stuff when we need to. // do stuff when we need to.
@ -111,7 +111,7 @@ namespace osu.Game.Skinning
return songSelectComponents; return songSelectComponents;
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
if (containerLookup.Ruleset != null) if (containerLookup.Ruleset != null)
{ {
return new Container return new Container

View File

@ -9,14 +9,14 @@ using osu.Game.Rulesets;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
/// <summary> /// <summary>
/// Represents a lookup of a collection of elements that make up a particular skinnable <see cref="TargetArea"/> of the game. /// Represents a lookup of a collection of elements that make up a particular skinnable <see cref="GlobalSkinnableContainers"/> of the game.
/// </summary> /// </summary>
public class SkinComponentsContainerLookup : ISkinComponentLookup, IEquatable<SkinComponentsContainerLookup> public class GlobalSkinnableContainerLookup : ISkinComponentLookup, IEquatable<GlobalSkinnableContainerLookup>
{ {
/// <summary> /// <summary>
/// The target area / layer of the game for which skin components will be returned. /// The target area / layer of the game for which skin components will be returned.
/// </summary> /// </summary>
public readonly TargetArea Target; public readonly GlobalSkinnableContainers Target;
/// <summary> /// <summary>
/// The ruleset for which skin components should be returned. /// The ruleset for which skin components should be returned.
@ -24,7 +24,7 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
public readonly RulesetInfo? Ruleset; public readonly RulesetInfo? Ruleset;
public SkinComponentsContainerLookup(TargetArea target, RulesetInfo? ruleset = null) public GlobalSkinnableContainerLookup(GlobalSkinnableContainers target, RulesetInfo? ruleset = null)
{ {
Target = target; Target = target;
Ruleset = ruleset; Ruleset = ruleset;
@ -37,7 +37,7 @@ namespace osu.Game.Skinning
return $"{Target.GetDescription()} (\"{Ruleset.Name}\" only)"; return $"{Target.GetDescription()} (\"{Ruleset.Name}\" only)";
} }
public bool Equals(SkinComponentsContainerLookup? other) public bool Equals(GlobalSkinnableContainerLookup? other)
{ {
if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true; if (ReferenceEquals(this, other)) return true;
@ -51,7 +51,7 @@ namespace osu.Game.Skinning
if (ReferenceEquals(this, obj)) return true; if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false; if (obj.GetType() != GetType()) return false;
return Equals((SkinComponentsContainerLookup)obj); return Equals((GlobalSkinnableContainerLookup)obj);
} }
public override int GetHashCode() public override int GetHashCode()
@ -62,7 +62,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// Represents a particular area or part of a game screen whose layout can be customised using the skin editor. /// Represents a particular area or part of a game screen whose layout can be customised using the skin editor.
/// </summary> /// </summary>
public enum TargetArea public enum GlobalSkinnableContainers
{ {
[Description("HUD")] [Description("HUD")]
MainHUDComponents, MainHUDComponents,

View File

@ -50,11 +50,11 @@ namespace osu.Game.Skinning
public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (lookup is SkinComponentsContainerLookup containerLookup) if (lookup is GlobalSkinnableContainerLookup containerLookup)
{ {
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
// this should exist in LegacySkin instead, but there isn't a fallback skin for LegacySkins yet. // this should exist in LegacySkin instead, but there isn't a fallback skin for LegacySkins yet.
// therefore keep the check here until fallback default legacy skin is supported. // therefore keep the check here until fallback default legacy skin is supported.
if (!this.HasFont(LegacyFont.Score)) if (!this.HasFont(LegacyFont.Score))

View File

@ -358,13 +358,13 @@ namespace osu.Game.Skinning
{ {
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c) if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c; return c;
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
if (containerLookup.Ruleset != null) if (containerLookup.Ruleset != null)
{ {
return new DefaultSkinComponentsContainer(container => return new DefaultSkinComponentsContainer(container =>

View File

@ -43,10 +43,10 @@ namespace osu.Game.Skinning
public SkinConfiguration Configuration { get; set; } public SkinConfiguration Configuration { get; set; }
public IDictionary<SkinComponentsContainerLookup.TargetArea, SkinLayoutInfo> LayoutInfos => layoutInfos; public IDictionary<GlobalSkinnableContainerLookup.GlobalSkinnableContainers, SkinLayoutInfo> LayoutInfos => layoutInfos;
private readonly Dictionary<SkinComponentsContainerLookup.TargetArea, SkinLayoutInfo> layoutInfos = private readonly Dictionary<GlobalSkinnableContainerLookup.GlobalSkinnableContainers, SkinLayoutInfo> layoutInfos =
new Dictionary<SkinComponentsContainerLookup.TargetArea, SkinLayoutInfo>(); new Dictionary<GlobalSkinnableContainerLookup.GlobalSkinnableContainers, SkinLayoutInfo>();
public abstract ISample? GetSample(ISampleInfo sampleInfo); public abstract ISample? GetSample(ISampleInfo sampleInfo);
@ -123,7 +123,7 @@ namespace osu.Game.Skinning
} }
// skininfo files may be null for default skin. // skininfo files may be null for default skin.
foreach (SkinComponentsContainerLookup.TargetArea skinnableTarget in Enum.GetValues<SkinComponentsContainerLookup.TargetArea>()) foreach (GlobalSkinnableContainerLookup.GlobalSkinnableContainers skinnableTarget in Enum.GetValues<GlobalSkinnableContainerLookup.GlobalSkinnableContainers>())
{ {
string filename = $"{skinnableTarget}.json"; string filename = $"{skinnableTarget}.json";
@ -187,7 +187,7 @@ namespace osu.Game.Skinning
case SkinnableSprite.SpriteComponentLookup sprite: case SkinnableSprite.SpriteComponentLookup sprite:
return this.GetAnimation(sprite.LookupName, false, false, maxSize: sprite.MaxSize); return this.GetAnimation(sprite.LookupName, false, false, maxSize: sprite.MaxSize);
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
// It is important to return null if the user has not configured this yet. // It is important to return null if the user has not configured this yet.
// This allows skin transformers the opportunity to provide default components. // This allows skin transformers the opportunity to provide default components.
@ -206,7 +206,7 @@ namespace osu.Game.Skinning
#region Deserialisation & Migration #region Deserialisation & Migration
private SkinLayoutInfo? parseLayoutInfo(string jsonContent, SkinComponentsContainerLookup.TargetArea target) private SkinLayoutInfo? parseLayoutInfo(string jsonContent, GlobalSkinnableContainerLookup.GlobalSkinnableContainers target)
{ {
SkinLayoutInfo? layout = null; SkinLayoutInfo? layout = null;
@ -245,7 +245,7 @@ namespace osu.Game.Skinning
return layout; return layout;
} }
private void applyMigration(SkinLayoutInfo layout, SkinComponentsContainerLookup.TargetArea target, int version) private void applyMigration(SkinLayoutInfo layout, GlobalSkinnableContainerLookup.GlobalSkinnableContainers target, int version)
{ {
switch (version) switch (version)
{ {
@ -253,7 +253,7 @@ namespace osu.Game.Skinning
{ {
// Combo counters were moved out of the global HUD components into per-ruleset. // Combo counters were moved out of the global HUD components into per-ruleset.
// This is to allow some rulesets to customise further (ie. mania and catch moving the combo to within their play area). // This is to allow some rulesets to customise further (ie. mania and catch moving the combo to within their play area).
if (target != SkinComponentsContainerLookup.TargetArea.MainHUDComponents || if (target != GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents ||
!layout.TryGetDrawableInfo(null, out var globalHUDComponents) || !layout.TryGetDrawableInfo(null, out var globalHUDComponents) ||
resources == null) resources == null)
break; break;

View File

@ -26,7 +26,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// The lookup criteria which will be used to retrieve components from the active skin. /// The lookup criteria which will be used to retrieve components from the active skin.
/// </summary> /// </summary>
public SkinComponentsContainerLookup Lookup { get; } public GlobalSkinnableContainerLookup Lookup { get; }
public IBindableList<ISerialisableDrawable> Components => components; public IBindableList<ISerialisableDrawable> Components => components;
@ -38,7 +38,7 @@ namespace osu.Game.Skinning
private CancellationTokenSource? cancellationSource; private CancellationTokenSource? cancellationSource;
public SkinnableContainer(SkinComponentsContainerLookup lookup) public SkinnableContainer(GlobalSkinnableContainerLookup lookup)
{ {
Lookup = lookup; Lookup = lookup;
} }

View File

@ -66,7 +66,7 @@ namespace osu.Game.Skinning
switch (lookup) switch (lookup)
{ {
case SkinComponentsContainerLookup containerLookup: case GlobalSkinnableContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c) if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c; return c;
@ -76,7 +76,7 @@ namespace osu.Game.Skinning
switch (containerLookup.Target) switch (containerLookup.Target)
{ {
case SkinComponentsContainerLookup.TargetArea.SongSelect: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.SongSelect:
var songSelectComponents = new DefaultSkinComponentsContainer(_ => var songSelectComponents = new DefaultSkinComponentsContainer(_ =>
{ {
// do stuff when we need to. // do stuff when we need to.
@ -84,7 +84,7 @@ namespace osu.Game.Skinning
return songSelectComponents; return songSelectComponents;
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: case GlobalSkinnableContainerLookup.GlobalSkinnableContainers.MainHUDComponents:
var skinnableTargetWrapper = new DefaultSkinComponentsContainer(container => var skinnableTargetWrapper = new DefaultSkinComponentsContainer(container =>
{ {
var score = container.OfType<DefaultScoreCounter>().FirstOrDefault(); var score = container.OfType<DefaultScoreCounter>().FirstOrDefault();