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

Add "Component" prefix to lookup naming

This commit is contained in:
Dean Herbert 2022-11-09 16:04:56 +09:00
parent e75c3b3f94
commit 1aa0e40f2f
94 changed files with 186 additions and 186 deletions

View File

@ -5,9 +5,9 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch namespace osu.Game.Rulesets.Catch
{ {
public class CatchSkinLookup : GameplaySkinLookup<CatchSkinComponents> public class CatchSkinComponentLookup : GameplaySkinComponentLookup<CatchSkinComponents>
{ {
public CatchSkinLookup(CatchSkinComponents component) public CatchSkinComponentLookup(CatchSkinComponents component)
: base(component) : base(component)
{ {
} }

View File

@ -37,8 +37,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public override bool RemoveWhenNotAlive => true; public override bool RemoveWhenNotAlive => true;
protected CaughtObject(CatchSkinComponents skinComponent, Func<ISkinLookup, Drawable> defaultImplementation) protected CaughtObject(CatchSkinComponents skinComponent, Func<ISkinComponentLookup, Drawable> defaultImplementation)
: base(new CatchSkinLookup(skinComponent), defaultImplementation) : base(new CatchSkinComponentLookup(skinComponent), defaultImplementation)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
private void load() private void load()
{ {
ScalingContainer.Child = new SkinnableDrawable( ScalingContainer.Child = new SkinnableDrawable(
new CatchSkinLookup(CatchSkinComponents.Banana), new CatchSkinComponentLookup(CatchSkinComponents.Banana),
_ => new BananaPiece()); _ => new BananaPiece());
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
private void load() private void load()
{ {
ScalingContainer.Child = new SkinnableDrawable( ScalingContainer.Child = new SkinnableDrawable(
new CatchSkinLookup(CatchSkinComponents.Droplet), new CatchSkinComponentLookup(CatchSkinComponents.Droplet),
_ => new DropletPiece()); _ => new DropletPiece());
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
private void load() private void load()
{ {
ScalingContainer.Child = new SkinnableDrawable( ScalingContainer.Child = new SkinnableDrawable(
new CatchSkinLookup(CatchSkinComponents.Fruit), new CatchSkinComponentLookup(CatchSkinComponents.Fruit),
_ => new FruitPiece()); _ => new FruitPiece());
} }

View File

@ -13,11 +13,11 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
{ {
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
switch (lookup) switch (lookup)
{ {
case CatchSkinLookup catchComponent: case CatchSkinComponentLookup catchComponent:
// TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries. // TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries.
switch (catchComponent.Component) switch (catchComponent.Component)
{ {

View File

@ -25,13 +25,13 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (lookup is GlobalSkinLookup targetComponent) if (lookup is GlobalSkinComponentLookup targetComponent)
{ {
switch (targetComponent.Lookup) switch (targetComponent.Lookup)
{ {
case GlobalSkinLookup.LookupType.MainHUDComponents: case GlobalSkinComponentLookup.LookupType.MainHUDComponents:
var components = base.GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer; var components = base.GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer;
if (providesComboCounter && components != null) if (providesComboCounter && components != null)
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
} }
} }
if (lookup is CatchSkinLookup catchSkinComponent) if (lookup is CatchSkinComponentLookup catchSkinComponent)
{ {
switch (catchSkinComponent.Component) switch (catchSkinComponent.Component)
{ {
@ -127,7 +127,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{ {
case CatchSkinConfiguration.FlipCatcherPlate: case CatchSkinConfiguration.FlipCatcherPlate:
// Don't flip catcher plate contents if the catcher is provided by this legacy skin. // Don't flip catcher plate contents if the catcher is provided by this legacy skin.
if (GetDrawableComponent(new CatchSkinLookup(CatchSkinComponents.Catcher)) != null) if (GetDrawableComponent(new CatchSkinComponentLookup(CatchSkinComponents.Catcher)) != null)
return (IBindable<TValue>)new Bindable<bool>(); return (IBindable<TValue>)new Bindable<bool>();
break; break;

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI
private readonly IBindable<bool> showCombo = new BindableBool(true); private readonly IBindable<bool> showCombo = new BindableBool(true);
public CatchComboDisplay() public CatchComboDisplay()
: base(new CatchSkinLookup(CatchSkinComponents.CatchComboCounter), _ => Empty()) : base(new CatchSkinComponentLookup(CatchSkinComponents.CatchComboCounter), _ => Empty())
{ {
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.UI
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre; Origin = Anchor.BottomCentre;
InternalChild = skinnableExplosion = new SkinnableDrawable(new CatchSkinLookup(CatchSkinComponents.HitExplosion), _ => new DefaultHitExplosion()) InternalChild = skinnableExplosion = new SkinnableDrawable(new CatchSkinComponentLookup(CatchSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{ {
CentreComponent = false, CentreComponent = false,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI
public readonly Bindable<CatcherAnimationState> AnimationState = new Bindable<CatcherAnimationState>(); public readonly Bindable<CatcherAnimationState> AnimationState = new Bindable<CatcherAnimationState>();
public SkinnableCatcher() public SkinnableCatcher()
: base(new CatchSkinLookup(CatchSkinComponents.Catcher), _ => new DefaultCatcher()) : base(new CatchSkinComponentLookup(CatchSkinComponents.Catcher), _ => new DefaultCatcher())
{ {
Anchor = Anchor.TopCentre; Anchor = Anchor.TopCentre;
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. // Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Child = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground()) Child = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Child = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground()) Child = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(_ => new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.StageBackground), SetContents(_ => new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.StageBackground),
_ => new DefaultStageBackground()) _ => new DefaultStageBackground())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(_ => new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.StageForeground), _ => null) SetContents(_ => new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.StageForeground), _ => null)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -5,13 +5,13 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania namespace osu.Game.Rulesets.Mania
{ {
public class ManiaSkinLookup : GameplaySkinLookup<ManiaSkinComponents> public class ManiaSkinComponentLookup : GameplaySkinComponentLookup<ManiaSkinComponents>
{ {
/// <summary> /// <summary>
/// Creates a new <see cref="ManiaSkinLookup"/>. /// Creates a new <see cref="ManiaSkinComponentLookup"/>.
/// </summary> /// </summary>
/// <param name="component">The component.</param> /// <param name="component">The component.</param>
public ManiaSkinLookup(ManiaSkinComponents component) public ManiaSkinComponentLookup(ManiaSkinComponents component)
: base(component) : base(component)
{ {
} }

View File

@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
headContainer = new Container<DrawableHoldNoteHead> { RelativeSizeAxes = Axes.Both } headContainer = new Container<DrawableHoldNoteHead> { RelativeSizeAxes = Axes.Both }
} }
}, },
bodyPiece = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.HoldNoteBody), _ => new DefaultBodyPiece bodyPiece = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.HoldNoteBody), _ => new DefaultBodyPiece
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}) })

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
rulesetConfig?.BindWith(ManiaRulesetSetting.TimingBasedNoteColouring, configTimingBasedNoteColouring); rulesetConfig?.BindWith(ManiaRulesetSetting.TimingBasedNoteColouring, configTimingBasedNoteColouring);
AddInternal(headPiece = new SkinnableDrawable(new ManiaSkinLookup(Component), _ => new DefaultNotePiece()) AddInternal(headPiece = new SkinnableDrawable(new ManiaSkinComponentLookup(Component), _ => new DefaultNotePiece())
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y

View File

@ -22,14 +22,14 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
this.beatmap = (ManiaBeatmap)beatmap; this.beatmap = (ManiaBeatmap)beatmap;
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
switch (lookup) switch (lookup)
{ {
case GameplaySkinLookup<HitResult> resultComponent: case GameplaySkinComponentLookup<HitResult> resultComponent:
return new ArgonJudgementPiece(resultComponent.Component); return new ArgonJudgementPiece(resultComponent.Component);
case ManiaSkinLookup maniaComponent: case ManiaSkinComponentLookup maniaComponent:
// TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries. // TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries.
switch (maniaComponent.Component) switch (maniaComponent.Component)
{ {

View File

@ -74,14 +74,14 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
}); });
} }
public override Drawable GetDrawableComponent(ISkinLookup lookup) public override Drawable GetDrawableComponent(ISkinComponentLookup lookup)
{ {
switch (lookup) switch (lookup)
{ {
case GameplaySkinLookup<HitResult> resultComponent: case GameplaySkinComponentLookup<HitResult> resultComponent:
return getResult(resultComponent.Component); return getResult(resultComponent.Component);
case ManiaSkinLookup maniaComponent: case ManiaSkinComponentLookup maniaComponent:
if (!isLegacySkin.Value || !hasKeyTexture.Value) if (!isLegacySkin.Value || !hasKeyTexture.Value)
return null; return null;

View File

@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.UI
skin.SourceChanged += onSourceChanged; skin.SourceChanged += onSourceChanged;
onSourceChanged(); onSourceChanged();
Drawable background = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground()) Drawable background = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground())
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Mania.UI
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements // For input purposes, the background is added at the highest depth, but is then proxied back below all other elements
background.CreateProxy(), background.CreateProxy(),
HitObjectArea, HitObjectArea,
keyArea = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea()) keyArea = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea())
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = 2, Depth = 2,
}, },
hitTarget = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.HitTarget), _ => new DefaultHitTarget()) hitTarget = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.HitTarget), _ => new DefaultHitTarget())
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Depth = 1 Depth = 1

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.HitExplosion), _ => new DefaultHitExplosion()) InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}; };

View File

@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Children = new Drawable[] Children = new Drawable[]
{ {
new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.StageBackground), _ => new DefaultStageBackground()) new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.StageBackground), _ => new DefaultStageBackground())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },
@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Mania.UI
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
} }
}, },
new SkinnableDrawable(new ManiaSkinLookup(ManiaSkinComponents.StageForeground), _ => null) new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.StageForeground), _ => null)
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },

View File

@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.Tests
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => null; public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => null;
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
{ {

View File

@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private class TopLeftCursorSkin : ISkin private class TopLeftCursorSkin : ISkin
{ {
public Drawable GetDrawableComponent(ISkinLookup lookup) => null; public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => null;
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null; public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
public ISample GetSample(ISampleInfo sampleInfo) => null; public ISample GetSample(ISampleInfo sampleInfo) => null;

View File

@ -149,11 +149,11 @@ namespace osu.Game.Rulesets.Osu.Tests
this.identifier = identifier; this.identifier = identifier;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) public Drawable GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (!enabled) return null; if (!enabled) return null;
if (lookup is OsuSkinLookup osuComponent && osuComponent.Component == OsuSkinComponents.SliderBody) if (lookup is OsuSkinComponentLookup osuComponent && osuComponent.Component == OsuSkinComponents.SliderBody)
return null; return null;
return new OsuSpriteText return new OsuSpriteText

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
InternalChild = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.FollowPoint), _ => new CircularContainer InternalChild = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.FollowPoint), _ => new CircularContainer
{ {
Masking = true, Masking = true,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,

View File

@ -81,12 +81,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
CirclePiece = new SkinnableDrawable(new OsuSkinLookup(CirclePieceComponent), _ => new MainCirclePiece()) CirclePiece = new SkinnableDrawable(new OsuSkinComponentLookup(CirclePieceComponent), _ => new MainCirclePiece())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
ApproachCircle = new ProxyableSkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.ApproachCircle), _ => new DefaultApproachCircle()) ApproachCircle = new ProxyableSkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.ApproachCircle), _ => new DefaultApproachCircle())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -278,7 +278,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
public ProxyableSkinnableDrawable(ISkinLookup lookup, Func<ISkinLookup, Drawable> defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling) public ProxyableSkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinComponentLookup, Drawable> defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling)
: base(lookup, defaultImplementation, confineMode) : base(lookup, defaultImplementation, confineMode)
{ {
} }

View File

@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
Body = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderBody), _ => new DefaultSliderBody(), confineMode: ConfineMode.NoScaling), Body = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderBody), _ => new DefaultSliderBody(), confineMode: ConfineMode.NoScaling),
tailContainer = new Container<DrawableSliderTail> { RelativeSizeAxes = Axes.Both }, tailContainer = new Container<DrawableSliderTail> { RelativeSizeAxes = Axes.Both },
tickContainer = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both }, tickContainer = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
repeatContainer = new Container<DrawableSliderRepeat> { RelativeSizeAxes = Axes.Both }, repeatContainer = new Container<DrawableSliderRepeat> { RelativeSizeAxes = Axes.Both },

View File

@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Children = new[] Children = new[]
{ {
new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()) new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle())
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true Masking = true
}, },
ball = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall()) ball = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Children = new Drawable[] Children = new Drawable[]
{ {
// no default for this; only visible in legacy skins. // no default for this; only visible in legacy skins.
CirclePiece = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderTailHitCircle), _ => Empty()) CirclePiece = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderTailHitCircle), _ => Empty())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Children = new Drawable[] Children = new Drawable[]
{ {
// no default for this; only visible in legacy skins. // no default for this; only visible in legacy skins.
CirclePiece = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderTailHitCircle), _ => Empty()) CirclePiece = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderTailHitCircle), _ => Empty())
} }
}, },
}); });

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Origin = Anchor.Centre; Origin = Anchor.Centre;
AddInternal(scaleContainer = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SliderScorePoint), _ => new CircularContainer AddInternal(scaleContainer = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderScorePoint), _ => new CircularContainer
{ {
Masking = true, Masking = true,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
Body = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinner()), Body = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinner()),
RotationTracker = new SpinnerRotationTracker(this) RotationTracker = new SpinnerRotationTracker(this)
} }
}, },

View File

@ -5,9 +5,9 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu namespace osu.Game.Rulesets.Osu
{ {
public class OsuSkinLookup : GameplaySkinLookup<OsuSkinComponents> public class OsuSkinComponentLookup : GameplaySkinComponentLookup<OsuSkinComponents>
{ {
public OsuSkinLookup(OsuSkinComponents component) public OsuSkinComponentLookup(OsuSkinComponents component)
: base(component) : base(component)
{ {
} }

View File

@ -14,14 +14,14 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
{ {
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
switch (lookup) switch (lookup)
{ {
case GameplaySkinLookup<HitResult> resultComponent: case GameplaySkinComponentLookup<HitResult> resultComponent:
return new ArgonJudgementPiece(resultComponent.Component); return new ArgonJudgementPiece(resultComponent.Component);
case OsuSkinLookup osuComponent: case OsuSkinComponentLookup osuComponent:
// TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries. // TODO: Once everything is finalised, consider throwing UnsupportedSkinComponentException on missing entries.
switch (osuComponent.Component) switch (osuComponent.Component)
{ {

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
accentColour.BindValueChanged(colour => Colour = colour.NewValue, true); accentColour.BindValueChanged(colour => Colour = colour.NewValue, true);
} }
protected override Drawable CreateDefault(ISkinLookup lookup) protected override Drawable CreateDefault(ISkinComponentLookup lookup)
{ {
var drawable = base.CreateDefault(lookup); var drawable = base.CreateDefault(lookup);

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
Colour = Color4.White.Opacity(0.5f), Colour = Color4.White.Opacity(0.5f),
}, },
}, },
number = new SkinnableSpriteText(new OsuSkinLookup(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText number = new SkinnableSpriteText(new OsuSkinComponentLookup(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
{ {
Font = OsuFont.Numeric.With(size: 40), Font = OsuFont.Numeric.With(size: 40),
UseFullGlyphHeight = false, UseFullGlyphHeight = false,

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Child = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon Child = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
accentColour.BindValueChanged(colour => Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); accentColour.BindValueChanged(colour => Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true);
} }
protected override Drawable CreateDefault(ISkinLookup lookup) protected override Drawable CreateDefault(ISkinComponentLookup lookup)
{ {
var drawable = base.CreateDefault(lookup); var drawable = base.CreateDefault(lookup);

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
if (hasNumber) if (hasNumber)
{ {
OverlayLayer.Add(hitCircleText = new SkinnableSpriteText(new OsuSkinLookup(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText OverlayLayer.Add(hitCircleText = new SkinnableSpriteText(new OsuSkinComponentLookup(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
{ {
Font = OsuFont.Numeric.With(size: 40), Font = OsuFont.Numeric.With(size: 40),
UseFullGlyphHeight = false, UseFullGlyphHeight = false,

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
string lookupName = new OsuSkinLookup(OsuSkinComponents.ReverseArrow).LookupName; string lookupName = new OsuSkinComponentLookup(OsuSkinComponents.ReverseArrow).LookupName;
var skin = skinSource.FindProvider(s => s.GetTexture(lookupName) != null); var skin = skinSource.FindProvider(s => s.GetTexture(lookupName) != null);
InternalChild = skin?.GetAnimation(lookupName, true, true) ?? Empty(); InternalChild = skin?.GetAnimation(lookupName, true, true) ?? Empty();

View File

@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
hasHitCircle = new Lazy<bool>(() => GetTexture("hitcircle") != null); hasHitCircle = new Lazy<bool>(() => GetTexture("hitcircle") != null);
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (lookup is OsuSkinLookup osuComponent) if (lookup is OsuSkinComponentLookup osuComponent)
{ {
switch (osuComponent.Component) switch (osuComponent.Component)
{ {

View File

@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Child = cursorSprite = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling) Child = cursorSprite = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -47,8 +47,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
cursorTrail = new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.CursorTrail), _ => new DefaultCursorTrail(), confineMode: ConfineMode.NoScaling), cursorTrail = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorTrail), _ => new DefaultCursorTrail(), confineMode: ConfineMode.NoScaling),
new SkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.CursorParticles), confineMode: ConfineMode.NoScaling), new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorParticles), confineMode: ConfineMode.NoScaling),
} }
}; };
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.UI
{ {
if (e.Action == OsuAction.Smoke) if (e.Action == OsuAction.Smoke)
{ {
AddInternal(currentSegmentSkinnable = new SmokeSkinnableDrawable(new OsuSkinLookup(OsuSkinComponents.CursorSmoke), _ => new DefaultSmokeSegment())); AddInternal(currentSegmentSkinnable = new SmokeSkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.CursorSmoke), _ => new DefaultSmokeSegment()));
// Add initial position immediately. // Add initial position immediately.
addPosition(); addPosition();
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.UI
public override double LifetimeStart => Drawable.LifetimeStart; public override double LifetimeStart => Drawable.LifetimeStart;
public override double LifetimeEnd => Drawable.LifetimeEnd; public override double LifetimeEnd => Drawable.LifetimeEnd;
public SmokeSkinnableDrawable(ISkinLookup lookup, Func<ISkinLookup, Drawable>? defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling) public SmokeSkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinComponentLookup, Drawable>? defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling)
: base(lookup, defaultImplementation, confineMode) : base(lookup, defaultImplementation, confineMode)
{ {
} }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
public TestSceneTaikoScroller() public TestSceneTaikoScroller()
{ {
AddStep("Load scroller", () => SetContents(_ => AddStep("Load scroller", () => SetContents(_ =>
new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.Scroller), _ => Empty()) new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Scroller), _ => Empty())
{ {
Clock = new FramedClock(clock), Clock = new FramedClock(clock),
Height = 0.4f, Height = 0.4f,

View File

@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
line = new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.BarLine), _ => new Box line = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.BarLine), _ => new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0), EdgeSmoothness = new Vector2(0.5f, 0),

View File

@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return base.CreateNestedHitObject(hitObject); return base.CreateNestedHitObject(hitObject);
} }
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.DrumRollBody), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollBody),
_ => new ElongatedCirclePiece()); _ => new ElongatedCirclePiece());
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
FillMode = FillMode.Fit; FillMode = FillMode.Fit;
} }
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.DrumRollTick), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece _ => new TickPiece
{ {
Filled = HitObject.FirstTick Filled = HitObject.FirstTick

View File

@ -90,8 +90,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
protected override SkinnableDrawable CreateMainPiece() => HitObject.Type == HitType.Centre protected override SkinnableDrawable CreateMainPiece() => HitObject.Type == HitType.Centre
? new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.CentreHit), _ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit) ? new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.CentreHit), _ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit)
: new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.RimHit), _ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit); : new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.RimHit), _ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
public override IEnumerable<HitSampleInfo> GetSamples() public override IEnumerable<HitSampleInfo> GetSamples()
{ {

View File

@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); targetRing.BorderColour = colours.YellowDark.Opacity(0.25f);
} }
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.Swell), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Swell),
_ => new SwellCirclePiece _ => new SwellCirclePiece
{ {
// to allow for rotation transform // to allow for rotation transform

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.DrumRollTick), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece()); _ => new TickPiece());
} }
} }

View File

@ -27,16 +27,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
hasExplosion = new Lazy<bool>(() => GetTexture(getHitName(TaikoSkinComponents.TaikoExplosionGreat)) != null); hasExplosion = new Lazy<bool>(() => GetTexture(getHitName(TaikoSkinComponents.TaikoExplosionGreat)) != null);
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (lookup is GameplaySkinLookup<HitResult>) if (lookup is GameplaySkinComponentLookup<HitResult>)
{ {
// if a taiko skin is providing explosion sprites, hide the judgements completely // if a taiko skin is providing explosion sprites, hide the judgements completely
if (hasExplosion.Value) if (hasExplosion.Value)
return Drawable.Empty().With(d => d.Expire()); return Drawable.Empty().With(d => d.Expire());
} }
if (lookup is TaikoSkinLookup taikoComponent) if (lookup is TaikoSkinComponentLookup taikoComponent)
{ {
switch (taikoComponent.Component) switch (taikoComponent.Component)
{ {

View File

@ -5,9 +5,9 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko namespace osu.Game.Rulesets.Taiko
{ {
public class TaikoSkinLookup : GameplaySkinLookup<TaikoSkinComponents> public class TaikoSkinComponentLookup : GameplaySkinComponentLookup<TaikoSkinComponents>
{ {
public TaikoSkinLookup(TaikoSkinComponents component) public TaikoSkinComponentLookup(TaikoSkinComponents component)
: base(component) : base(component)
{ {
} }

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
new BarLineGenerator<BarLine>(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar)); new BarLineGenerator<BarLine>(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar));
FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.Scroller), _ => Empty()) FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Scroller), _ => Empty())
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Depth = float.MaxValue Depth = float.MaxValue

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
InternalChild = skinnable = new SkinnableDrawable(new TaikoSkinLookup(getComponentName(result)), _ => new DefaultHitExplosion(result)); InternalChild = skinnable = new SkinnableDrawable(new TaikoSkinComponentLookup(getComponentName(result)), _ => new DefaultHitExplosion(result));
skinnable.OnSkinChanged += runAnimation; skinnable.OnSkinChanged += runAnimation;
} }

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.InputDrum), _ => new DefaultInputDrum()) new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.InputDrum), _ => new DefaultInputDrum())
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Child = skinnable = new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.TaikoExplosionKiai), _ => new DefaultKiaiHitExplosion(hitType)); Child = skinnable = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.TaikoExplosionKiai), _ => new DefaultKiaiHitExplosion(hitType));
} }
} }
} }

View File

@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Taiko.UI
InternalChildren = new[] InternalChildren = new[]
{ {
new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
new Container new Container
{ {
Name = "Left overlay", Name = "Left overlay",
@ -86,11 +86,11 @@ namespace osu.Game.Rulesets.Taiko.UI
BorderColour = colours.Gray0, BorderColour = colours.Gray0,
Children = new[] Children = new[]
{ {
new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
inputDrum.CreateProxy(), inputDrum.CreateProxy(),
} }
}, },
mascot = new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.Mascot), _ => Empty()) mascot = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.Mascot), _ => Empty())
{ {
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
HitTarget = new SkinnableDrawable(new TaikoSkinLookup(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget()) HitTarget = new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget())
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
} }

View File

@ -126,7 +126,7 @@ namespace osu.Game.Tests.Gameplay
Color4.Green Color4.Green
}; };
public Drawable GetDrawableComponent(ISkinLookup lookup) => throw new NotImplementedException(); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => throw new NotImplementedException();
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException(); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();

View File

@ -73,7 +73,7 @@ namespace osu.Game.Tests.NonVisual.Skinning
return lookup_names.Contains(componentName) ? renderer.WhitePixel : null; return lookup_names.Contains(componentName) ? renderer.WhitePixel : null;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => throw new NotSupportedException(); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => throw new NotSupportedException();
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException(); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException();
} }

View File

@ -78,7 +78,7 @@ namespace osu.Game.Tests.Rulesets
OnLoadAsync?.Invoke(); OnLoadAsync?.Invoke();
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => skin.GetDrawableComponent(lookup); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => skin.GetDrawableComponent(lookup);
public Texture GetTexture(string componentName, WrapMode wrapModeS = default, WrapMode wrapModeT = default) => skin.GetTexture(componentName); public Texture GetTexture(string componentName, WrapMode wrapModeS = default, WrapMode wrapModeT = default) => skin.GetTexture(componentName);

View File

@ -80,7 +80,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.DrawableComponentInfo, Has.Count.EqualTo(2)); Assert.That(skin.DrawableComponentInfo, Has.Count.EqualTo(2));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(9)); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(9));
} }
} }
@ -93,10 +93,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.DrawableComponentInfo, Has.Count.EqualTo(2)); Assert.That(skin.DrawableComponentInfo, Has.Count.EqualTo(2));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(6)); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(6));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.SongSelect], Has.Length.EqualTo(1)); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.SongSelect], Has.Length.EqualTo(1));
var skinnableInfo = skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.SongSelect].First(); var skinnableInfo = skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.SongSelect].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"));
@ -107,10 +107,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.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(8)); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents], Has.Length.EqualTo(8));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(UnstableRateCounter))); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(UnstableRateCounter)));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(ColourHitErrorMeter))); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(ColourHitErrorMeter)));
Assert.That(skin.DrawableComponentInfo[GlobalSkinLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(LegacySongProgress))); Assert.That(skin.DrawableComponentInfo[GlobalSkinComponentLookup.LookupType.MainHUDComponents].Select(i => i.Type), Contains.Item(typeof(LegacySongProgress)));
} }
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Skins
string expected = allowBeatmapLookups ? "beatmap" : "user"; string expected = allowBeatmapLookups ? "beatmap" : "user";
AddAssert($"Check lookup is from {expected}", () => requester.GetDrawableComponent(new TestSkinLookup())?.Name == expected); AddAssert($"Check lookup is from {expected}", () => requester.GetDrawableComponent(new TestSkinComponentLookup())?.Name == expected);
} }
[TestCase(false)] [TestCase(false)]
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Skins
ISkin expected() => allowBeatmapLookups ? beatmapSource : userSource; ISkin expected() => allowBeatmapLookups ? beatmapSource : userSource;
AddAssert("Check lookup is from correct source", () => requester.FindProvider(s => s.GetDrawableComponent(new TestSkinLookup()) != null) == expected()); AddAssert("Check lookup is from correct source", () => requester.FindProvider(s => s.GetDrawableComponent(new TestSkinComponentLookup()) != null) == expected());
} }
public class UserSkinSource : LegacySkin public class UserSkinSource : LegacySkin
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Skins
{ {
} }
public override Drawable GetDrawableComponent(ISkinLookup lookup) public override Drawable GetDrawableComponent(ISkinComponentLookup lookup)
{ {
return new Container { Name = "user" }; return new Container { Name = "user" };
} }
@ -82,7 +82,7 @@ namespace osu.Game.Tests.Skins
{ {
} }
public override Drawable GetDrawableComponent(ISkinLookup lookup) public override Drawable GetDrawableComponent(ISkinComponentLookup lookup)
{ {
return new Container { Name = "beatmap" }; return new Container { Name = "beatmap" };
} }
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Skins
this.skin = skin; this.skin = skin;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => skin.GetDrawableComponent(lookup); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => skin.GetDrawableComponent(lookup);
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT);
@ -109,7 +109,7 @@ namespace osu.Game.Tests.Skins
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => skin.FindProvider(lookupFunction); public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => skin.FindProvider(lookupFunction);
} }
private class TestSkinLookup : ISkinLookup private class TestSkinComponentLookup : ISkinComponentLookup
{ {
public string LookupName => string.Empty; public string LookupName => string.Empty;
} }

View File

@ -221,7 +221,7 @@ namespace osu.Game.Tests.Skins
this.skin = skin; this.skin = skin;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => skin.GetDrawableComponent(lookup); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => skin.GetDrawableComponent(lookup);
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT);

View File

@ -87,7 +87,7 @@ namespace osu.Game.Tests.Skins
this.renderer = renderer; this.renderer = renderer;
} }
public Drawable GetDrawableComponent(ISkinLookup lookup) => throw new System.NotImplementedException(); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => throw new System.NotImplementedException();
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
{ {

View File

@ -40,7 +40,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<SkinnableTargetContainer>().All(c => c.ComponentsLoaded)); AddUntilStep("wait for hud load", () => Player.ChildrenOfType<SkinnableTargetContainer>().All(c => c.ComponentsLoaded));
AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(GlobalSkinLookup.LookupType.MainHUDComponents, skinManager.CurrentSkin.Value)); AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(GlobalSkinComponentLookup.LookupType.MainHUDComponents, skinManager.CurrentSkin.Value));
} }
protected void CreateSkinTest(SkinInfo gameCurrentSkin, Func<ISkin> getBeatmapSkin) protected void CreateSkinTest(SkinInfo gameCurrentSkin, Func<ISkin> getBeatmapSkin)
@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}); });
} }
protected bool AssertComponentsFromExpectedSource(GlobalSkinLookup.LookupType target, ISkin expectedSource) protected bool AssertComponentsFromExpectedSource(GlobalSkinComponentLookup.LookupType target, ISkin expectedSource)
{ {
var actualComponentsContainer = Player.ChildrenOfType<SkinnableTargetContainer>().First(s => s.Target == target) var actualComponentsContainer = Player.ChildrenOfType<SkinnableTargetContainer>().First(s => s.Target == target)
.ChildrenOfType<SkinnableTargetComponentsContainer>().SingleOrDefault(); .ChildrenOfType<SkinnableTargetComponentsContainer>().SingleOrDefault();
@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var actualInfo = actualComponentsContainer.CreateSkinnableInfo(); var actualInfo = actualComponentsContainer.CreateSkinnableInfo();
var expectedComponentsContainer = (SkinnableTargetComponentsContainer)expectedSource.GetDrawableComponent(new GlobalSkinLookup(target)); var expectedComponentsContainer = (SkinnableTargetComponentsContainer)expectedSource.GetDrawableComponent(new GlobalSkinComponentLookup(target));
if (expectedComponentsContainer == null) if (expectedComponentsContainer == null)
return false; return false;

View File

@ -164,7 +164,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
private bool allow = true; private bool allow = true;
protected override bool AllowDrawableLookup(ISkinLookup lookup) => allow; protected override bool AllowDrawableLookup(ISkinComponentLookup lookup) => allow;
public void Disable() public void Disable()
{ {
@ -182,8 +182,8 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
public new Drawable Drawable => base.Drawable; public new Drawable Drawable => base.Drawable;
public ExposedSkinnableDrawable(string name, Func<ISkinLookup, Drawable> defaultImplementation, ConfineMode confineMode = ConfineMode.ScaleToFit) public ExposedSkinnableDrawable(string name, Func<ISkinComponentLookup, Drawable> defaultImplementation, ConfineMode confineMode = ConfineMode.ScaleToFit)
: base(new TestSkinLookup(name), defaultImplementation, confineMode) : base(new TestSkinComponentLookup(name), defaultImplementation, confineMode)
{ {
} }
} }
@ -251,8 +251,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public new Drawable Drawable => base.Drawable; public new Drawable Drawable => base.Drawable;
public int SkinChangedCount { get; private set; } public int SkinChangedCount { get; private set; }
public SkinConsumer(string name, Func<ISkinLookup, Drawable> defaultImplementation) public SkinConsumer(string name, Func<ISkinComponentLookup, Drawable> defaultImplementation)
: base(new TestSkinLookup(name), defaultImplementation) : base(new TestSkinComponentLookup(name), defaultImplementation)
{ {
} }
@ -288,8 +288,8 @@ namespace osu.Game.Tests.Visual.Gameplay
this.size = size; this.size = size;
} }
public Drawable GetDrawableComponent(ISkinLookup lookupName) => public Drawable GetDrawableComponent(ISkinComponentLookup componentLookupName) =>
lookupName.LookupName == "available" componentLookupName.LookupName == "available"
? new DrawWidthBox ? new DrawWidthBox
{ {
Colour = Color4.Yellow, Colour = Color4.Yellow,
@ -306,7 +306,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private class SecondarySource : ISkin private class SecondarySource : ISkin
{ {
public Drawable GetDrawableComponent(ISkinLookup lookupName) => new SecondarySourceBox(); public Drawable GetDrawableComponent(ISkinComponentLookup componentLookupName) => new SecondarySourceBox();
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException(); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
@ -318,7 +318,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Cached(typeof(ISkinSource))] [Cached(typeof(ISkinSource))]
private class SkinSourceContainer : Container, ISkinSource private class SkinSourceContainer : Container, ISkinSource
{ {
public Drawable GetDrawableComponent(ISkinLookup lookupName) => new BaseSourceBox(); public Drawable GetDrawableComponent(ISkinComponentLookup componentLookupName) => new BaseSourceBox();
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException(); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => throw new NotImplementedException();
@ -337,9 +337,9 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
} }
private class TestSkinLookup : ISkinLookup private class TestSkinComponentLookup : ISkinComponentLookup
{ {
public TestSkinLookup(string name) public TestSkinComponentLookup(string name)
{ {
LookupName = name; LookupName = name;
} }

View File

@ -142,7 +142,7 @@ namespace osu.Game.Tests.Visual.Gameplay
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => SamplePlaybackDisabled; IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => SamplePlaybackDisabled;
public Drawable GetDrawableComponent(ISkinLookup lookup) => source?.GetDrawableComponent(lookup); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => source?.GetDrawableComponent(lookup);
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
public ISample GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo); public ISample GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source?.GetConfig<TLookup, TValue>(lookup); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => source?.GetConfig<TLookup, TValue>(lookup);

View File

@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Judgements
if (JudgementBody != null) if (JudgementBody != null)
RemoveInternal(JudgementBody, true); RemoveInternal(JudgementBody, true);
AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinLookup<HitResult>(type), _ => AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponentLookup<HitResult>(type), _ =>
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling) CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit
#region Delegated ISkin implementation #region Delegated ISkin implementation
public Drawable GetDrawableComponent(ISkinLookup lookup) => Skin.GetDrawableComponent(lookup); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => Skin.GetDrawableComponent(lookup);
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Skin.GetTexture(componentName, wrapModeS, wrapModeT); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Skin.GetTexture(componentName, wrapModeS, wrapModeT);
public ISample GetSample(ISampleInfo sampleInfo) => Skin.GetSample(sampleInfo); public ISample GetSample(ISampleInfo sampleInfo) => Skin.GetSample(sampleInfo);
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => Skin.GetConfig<TLookup, TValue>(lookup); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => Skin.GetConfig<TLookup, TValue>(lookup);

View File

@ -391,7 +391,7 @@ namespace osu.Game.Screens.Play
private OsuConfigManager config { get; set; } private OsuConfigManager config { get; set; }
public MainComponentsContainer() public MainComponentsContainer()
: base(GlobalSkinLookup.LookupType.MainHUDComponents) : base(GlobalSkinComponentLookup.LookupType.MainHUDComponents)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -250,7 +250,7 @@ namespace osu.Game.Screens.Select
} }
} }
}, },
new SkinnableTargetContainer(GlobalSkinLookup.LookupType.SongSelect) new SkinnableTargetContainer(GlobalSkinComponentLookup.LookupType.SongSelect)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },

View File

@ -81,17 +81,17 @@ namespace osu.Game.Skinning
return null; return null;
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (base.GetDrawableComponent(lookup) is Drawable c) if (base.GetDrawableComponent(lookup) is Drawable c)
return c; return c;
switch (lookup) switch (lookup)
{ {
case GlobalSkinLookup globalLookup: case GlobalSkinComponentLookup globalLookup:
switch (globalLookup.Lookup) switch (globalLookup.Lookup)
{ {
case GlobalSkinLookup.LookupType.SongSelect: case GlobalSkinComponentLookup.LookupType.SongSelect:
var songSelectComponents = new SkinnableTargetComponentsContainer(_ => var songSelectComponents = new SkinnableTargetComponentsContainer(_ =>
{ {
// do stuff when we need to. // do stuff when we need to.
@ -99,7 +99,7 @@ namespace osu.Game.Skinning
return songSelectComponents; return songSelectComponents;
case GlobalSkinLookup.LookupType.MainHUDComponents: case GlobalSkinComponentLookup.LookupType.MainHUDComponents:
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container => var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
{ {
var score = container.OfType<DefaultScoreCounter>().FirstOrDefault(); var score = container.OfType<DefaultScoreCounter>().FirstOrDefault();

View File

@ -43,7 +43,7 @@ namespace osu.Game.Skinning
} }
} }
protected override bool AllowDrawableLookup(ISkinLookup lookup) protected override bool AllowDrawableLookup(ISkinComponentLookup lookup)
{ {
if (beatmapSkins == null) if (beatmapSkins == null)
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed."); throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");

View File

@ -314,7 +314,7 @@ namespace osu.Game.Skinning.Editor
private ISkinnableTarget getFirstTarget() => availableTargets.FirstOrDefault(); private ISkinnableTarget getFirstTarget() => availableTargets.FirstOrDefault();
private ISkinnableTarget getTarget(GlobalSkinLookup.LookupType target) private ISkinnableTarget getTarget(GlobalSkinComponentLookup.LookupType target)
{ {
return availableTargets.FirstOrDefault(c => c.Target == target); return availableTargets.FirstOrDefault(c => c.Target == target);
} }

View File

@ -5,12 +5,12 @@ using System.Linq;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class GameplaySkinLookup<T> : ISkinLookup public class GameplaySkinComponentLookup<T> : ISkinComponentLookup
where T : notnull where T : notnull
{ {
public readonly T Component; public readonly T Component;
public GameplaySkinLookup(T component) public GameplaySkinComponentLookup(T component)
{ {
Component = component; Component = component;
} }

View File

@ -3,13 +3,13 @@
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class GlobalSkinLookup : ISkinLookup public class GlobalSkinComponentLookup : ISkinComponentLookup
{ {
public readonly LookupType Lookup; public readonly LookupType Lookup;
public string LookupName => Lookup.ToString(); public string LookupName => Lookup.ToString();
public GlobalSkinLookup(LookupType lookup) public GlobalSkinComponentLookup(LookupType lookup)
{ {
Lookup = lookup; Lookup = lookup;
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
/// <param name="lookup">The requested component.</param> /// <param name="lookup">The requested component.</param>
/// <returns>A drawable representation for the requested component, or null if unavailable.</returns> /// <returns>A drawable representation for the requested component, or null if unavailable.</returns>
Drawable? GetDrawableComponent(ISkinLookup lookup); Drawable? GetDrawableComponent(ISkinComponentLookup lookup);
/// <summary> /// <summary>
/// Retrieve a <see cref="Texture"/>. /// Retrieve a <see cref="Texture"/>.

View File

@ -11,10 +11,10 @@ namespace osu.Game.Skinning
/// to scope particular lookup variations. Using this, a ruleset or skin implementation could make its own lookup /// to scope particular lookup variations. Using this, a ruleset or skin implementation could make its own lookup
/// type to scope away from more global contexts. /// type to scope away from more global contexts.
/// ///
/// More commonly, a ruleset could make use of <see cref="GameplaySkinLookup{T}"/> to do a simple lookup based on /// More commonly, a ruleset could make use of <see cref="GameplaySkinComponentLookup{T}"/> to do a simple lookup based on
/// a provided enum. /// a provided enum.
/// </remarks> /// </remarks>
public interface ISkinLookup public interface ISkinComponentLookup
{ {
string LookupName { get; } string LookupName { get; }
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// The definition of this target. /// The definition of this target.
/// </summary> /// </summary>
GlobalSkinLookup.LookupType Target { get; } GlobalSkinComponentLookup.LookupType Target { get; }
/// <summary> /// <summary>
/// A bindable list of components which are being tracked by this skinnable target. /// A bindable list of components which are being tracked by this skinnable target.

View File

@ -43,13 +43,13 @@ namespace osu.Game.Skinning
return new RealmBackedResourceStore<BeatmapSetInfo>(beatmapInfo.BeatmapSet.ToLive(resources.RealmAccess), resources.Files, resources.RealmAccess); return new RealmBackedResourceStore<BeatmapSetInfo>(beatmapInfo.BeatmapSet.ToLive(resources.RealmAccess), resources.Files, resources.RealmAccess);
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (lookup is GlobalSkinLookup targetComponent) if (lookup is GlobalSkinComponentLookup targetComponent)
{ {
switch (targetComponent.Lookup) switch (targetComponent.Lookup)
{ {
case GlobalSkinLookup.LookupType.MainHUDComponents: case GlobalSkinComponentLookup.LookupType.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

@ -322,17 +322,17 @@ namespace osu.Game.Skinning
return null; return null;
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (base.GetDrawableComponent(lookup) is Drawable c) if (base.GetDrawableComponent(lookup) is Drawable c)
return c; return c;
switch (lookup) switch (lookup)
{ {
case GlobalSkinLookup target: case GlobalSkinComponentLookup target:
switch (target.Lookup) switch (target.Lookup)
{ {
case GlobalSkinLookup.LookupType.MainHUDComponents: case GlobalSkinComponentLookup.LookupType.MainHUDComponents:
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container => var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
{ {
var score = container.OfType<LegacyScoreCounter>().FirstOrDefault(); var score = container.OfType<LegacyScoreCounter>().FirstOrDefault();
@ -379,7 +379,7 @@ namespace osu.Game.Skinning
return null; return null;
case GameplaySkinLookup<HitResult> resultComponent: case GameplaySkinComponentLookup<HitResult> resultComponent:
// kind of wasteful that we throw this away, but should do for now. // kind of wasteful that we throw this away, but should do for now.
if (getJudgementAnimation(resultComponent.Component) != null) if (getJudgementAnimation(resultComponent.Component) != null)
@ -397,7 +397,7 @@ namespace osu.Game.Skinning
return null; return null;
case SkinnableSprite.SpriteLookup sprite: case SkinnableSprite.SpriteComponentLookup sprite:
return this.GetAnimation(sprite.LookupName, false, false); return this.GetAnimation(sprite.LookupName, false, false);
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Skinning
samples = audio.GetSampleStore(new NamespacedResourceStore<byte[]>(resources, @"Samples")); samples = audio.GetSampleStore(new NamespacedResourceStore<byte[]>(resources, @"Samples"));
} }
public Drawable? GetDrawableComponent(ISkinLookup lookup) => null; public Drawable? GetDrawableComponent(ISkinComponentLookup lookup) => null;
public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => textures.Get(componentName, wrapModeS, wrapModeT); public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => textures.Get(componentName, wrapModeS, wrapModeT);

View File

@ -37,9 +37,9 @@ namespace osu.Game.Skinning
public SkinConfiguration Configuration { get; set; } public SkinConfiguration Configuration { get; set; }
public IDictionary<GlobalSkinLookup.LookupType, SkinnableInfo[]> DrawableComponentInfo => drawableComponentInfo; public IDictionary<GlobalSkinComponentLookup.LookupType, SkinnableInfo[]> DrawableComponentInfo => drawableComponentInfo;
private readonly Dictionary<GlobalSkinLookup.LookupType, SkinnableInfo[]> drawableComponentInfo = new Dictionary<GlobalSkinLookup.LookupType, SkinnableInfo[]>(); private readonly Dictionary<GlobalSkinComponentLookup.LookupType, SkinnableInfo[]> drawableComponentInfo = new Dictionary<GlobalSkinComponentLookup.LookupType, SkinnableInfo[]>();
public abstract ISample? GetSample(ISampleInfo sampleInfo); public abstract ISample? GetSample(ISampleInfo sampleInfo);
@ -97,7 +97,7 @@ namespace osu.Game.Skinning
Configuration = new SkinConfiguration(); Configuration = new SkinConfiguration();
// skininfo files may be null for default skin. // skininfo files may be null for default skin.
foreach (GlobalSkinLookup.LookupType skinnableTarget in Enum.GetValues(typeof(GlobalSkinLookup.LookupType))) foreach (GlobalSkinComponentLookup.LookupType skinnableTarget in Enum.GetValues(typeof(GlobalSkinComponentLookup.LookupType)))
{ {
string filename = $"{skinnableTarget}.json"; string filename = $"{skinnableTarget}.json";
@ -154,11 +154,11 @@ namespace osu.Game.Skinning
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray(); DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
} }
public virtual Drawable? GetDrawableComponent(ISkinLookup lookup) public virtual Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
switch (lookup) switch (lookup)
{ {
case GlobalSkinLookup target: case GlobalSkinComponentLookup target:
if (!DrawableComponentInfo.TryGetValue(target.Lookup, out var skinnableInfo)) if (!DrawableComponentInfo.TryGetValue(target.Lookup, out var skinnableInfo))
return null; return null;

View File

@ -201,7 +201,7 @@ namespace osu.Game.Skinning
public event Action SourceChanged; public event Action SourceChanged;
public Drawable GetDrawableComponent(ISkinLookup lookup) => lookupWithFallback(s => s.GetDrawableComponent(lookup)); public Drawable GetDrawableComponent(ISkinComponentLookup lookup) => lookupWithFallback(s => s.GetDrawableComponent(lookup));
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => lookupWithFallback(s => s.GetTexture(componentName, wrapModeS, wrapModeT)); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => lookupWithFallback(s => s.GetTexture(componentName, wrapModeS, wrapModeT));

View File

@ -28,7 +28,7 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
protected virtual bool AllowFallingBackToParent => true; protected virtual bool AllowFallingBackToParent => true;
protected virtual bool AllowDrawableLookup(ISkinLookup lookup) => true; protected virtual bool AllowDrawableLookup(ISkinComponentLookup lookup) => true;
protected virtual bool AllowTextureLookup(string componentName) => true; protected virtual bool AllowTextureLookup(string componentName) => true;
@ -107,7 +107,7 @@ namespace osu.Game.Skinning
} }
} }
public Drawable? GetDrawableComponent(ISkinLookup lookup) public Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
foreach (var (_, lookupWrapper) in skinSources) foreach (var (_, lookupWrapper) in skinSources)
{ {
@ -238,7 +238,7 @@ namespace osu.Game.Skinning
this.provider = provider; this.provider = provider;
} }
public Drawable? GetDrawableComponent(ISkinLookup lookup) public Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (provider.AllowDrawableLookup(lookup)) if (provider.AllowDrawableLookup(lookup))
return skin.GetDrawableComponent(lookup); return skin.GetDrawableComponent(lookup);

View File

@ -19,7 +19,7 @@ namespace osu.Game.Skinning
Skin = skin ?? throw new ArgumentNullException(nameof(skin)); Skin = skin ?? throw new ArgumentNullException(nameof(skin));
} }
public virtual Drawable? GetDrawableComponent(ISkinLookup lookup) => Skin.GetDrawableComponent(lookup); public virtual Drawable? GetDrawableComponent(ISkinComponentLookup lookup) => Skin.GetDrawableComponent(lookup);
public virtual Texture? GetTexture(string componentName) => GetTexture(componentName, default, default); public virtual Texture? GetTexture(string componentName) => GetTexture(componentName, default, default);

View File

@ -31,7 +31,7 @@ namespace osu.Game.Skinning
set => base.AutoSizeAxes = value; set => base.AutoSizeAxes = value;
} }
protected readonly ISkinLookup Lookup; protected readonly ISkinComponentLookup ComponentLookup;
private readonly ConfineMode confineMode; private readonly ConfineMode confineMode;
@ -41,15 +41,15 @@ namespace osu.Game.Skinning
/// <param name="lookup">The namespace-complete resource name for this skinnable element.</param> /// <param name="lookup">The namespace-complete resource name for this skinnable element.</param>
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param> /// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
/// <param name="confineMode">How (if at all) the <see cref="Drawable"/> should be resize to fit within our own bounds.</param> /// <param name="confineMode">How (if at all) the <see cref="Drawable"/> should be resize to fit within our own bounds.</param>
public SkinnableDrawable(ISkinLookup lookup, Func<ISkinLookup, Drawable>? defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling) public SkinnableDrawable(ISkinComponentLookup lookup, Func<ISkinComponentLookup, Drawable>? defaultImplementation = null, ConfineMode confineMode = ConfineMode.NoScaling)
: this(lookup, confineMode) : this(lookup, confineMode)
{ {
createDefault = defaultImplementation; createDefault = defaultImplementation;
} }
protected SkinnableDrawable(ISkinLookup lookup, ConfineMode confineMode = ConfineMode.NoScaling) protected SkinnableDrawable(ISkinComponentLookup lookup, ConfineMode confineMode = ConfineMode.NoScaling)
{ {
Lookup = lookup; ComponentLookup = lookup;
this.confineMode = confineMode; this.confineMode = confineMode;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -60,13 +60,13 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
public void ResetAnimation() => (Drawable as IFramedAnimation)?.GotoFrame(0); public void ResetAnimation() => (Drawable as IFramedAnimation)?.GotoFrame(0);
private readonly Func<ISkinLookup, Drawable>? createDefault; private readonly Func<ISkinComponentLookup, Drawable>? createDefault;
private readonly Cached scaling = new Cached(); private readonly Cached scaling = new Cached();
private bool isDefault; private bool isDefault;
protected virtual Drawable CreateDefault(ISkinLookup lookup) => createDefault?.Invoke(lookup) ?? Empty(); protected virtual Drawable CreateDefault(ISkinComponentLookup lookup) => createDefault?.Invoke(lookup) ?? Empty();
/// <summary> /// <summary>
/// Whether to apply size restrictions (specified via <see cref="confineMode"/>) to the default implementation. /// Whether to apply size restrictions (specified via <see cref="confineMode"/>) to the default implementation.
@ -75,11 +75,11 @@ namespace osu.Game.Skinning
protected override void SkinChanged(ISkinSource skin) protected override void SkinChanged(ISkinSource skin)
{ {
var retrieved = skin.GetDrawableComponent(Lookup); var retrieved = skin.GetDrawableComponent(ComponentLookup);
if (retrieved == null) if (retrieved == null)
{ {
Drawable = CreateDefault(Lookup); Drawable = CreateDefault(ComponentLookup);
isDefault = true; isDefault = true;
} }
else else

View File

@ -34,26 +34,26 @@ namespace osu.Game.Skinning
private ISkinSource source { get; set; } = null!; private ISkinSource source { get; set; } = null!;
public SkinnableSprite(string textureName, ConfineMode confineMode = ConfineMode.NoScaling) public SkinnableSprite(string textureName, ConfineMode confineMode = ConfineMode.NoScaling)
: base(new SpriteLookup(textureName), confineMode) : base(new SpriteComponentLookup(textureName), confineMode)
{ {
SpriteName.Value = textureName; SpriteName.Value = textureName;
} }
public SkinnableSprite() public SkinnableSprite()
: base(new SpriteLookup(string.Empty), ConfineMode.NoScaling) : base(new SpriteComponentLookup(string.Empty), ConfineMode.NoScaling)
{ {
RelativeSizeAxes = Axes.None; RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
SpriteName.BindValueChanged(name => SpriteName.BindValueChanged(name =>
{ {
((SpriteLookup)Lookup).LookupName = name.NewValue ?? string.Empty; ((SpriteComponentLookup)ComponentLookup).LookupName = name.NewValue ?? string.Empty;
if (IsLoaded) if (IsLoaded)
SkinChanged(CurrentSkin); SkinChanged(CurrentSkin);
}); });
} }
protected override Drawable CreateDefault(ISkinLookup lookup) protected override Drawable CreateDefault(ISkinComponentLookup lookup)
{ {
var texture = textures.Get(lookup.LookupName); var texture = textures.Get(lookup.LookupName);
@ -65,11 +65,11 @@ namespace osu.Game.Skinning
public bool UsesFixedAnchor { get; set; } public bool UsesFixedAnchor { get; set; }
internal class SpriteLookup : ISkinLookup internal class SpriteComponentLookup : ISkinComponentLookup
{ {
public string LookupName { get; set; } public string LookupName { get; set; }
public SpriteLookup(string textureName) public SpriteComponentLookup(string textureName)
{ {
LookupName = textureName; LookupName = textureName;
} }

View File

@ -9,7 +9,7 @@ namespace osu.Game.Skinning
{ {
public class SkinnableSpriteText : SkinnableDrawable, IHasText public class SkinnableSpriteText : SkinnableDrawable, IHasText
{ {
public SkinnableSpriteText(ISkinLookup lookup, Func<ISkinLookup, SpriteText> defaultImplementation, ConfineMode confineMode = ConfineMode.NoScaling) public SkinnableSpriteText(ISkinComponentLookup lookup, Func<ISkinComponentLookup, SpriteText> defaultImplementation, ConfineMode confineMode = ConfineMode.NoScaling)
: base(lookup, defaultImplementation, confineMode) : base(lookup, defaultImplementation, confineMode)
{ {
} }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Skinning
{ {
private SkinnableTargetComponentsContainer? content; private SkinnableTargetComponentsContainer? content;
public GlobalSkinLookup.LookupType Target { get; } public GlobalSkinComponentLookup.LookupType Target { get; }
public IBindableList<ISkinnableDrawable> Components => components; public IBindableList<ISkinnableDrawable> Components => components;
@ -25,7 +25,7 @@ namespace osu.Game.Skinning
private CancellationTokenSource? cancellationSource; private CancellationTokenSource? cancellationSource;
public SkinnableTargetContainer(GlobalSkinLookup.LookupType target) public SkinnableTargetContainer(GlobalSkinComponentLookup.LookupType target)
{ {
Target = target; Target = target;
} }
@ -39,7 +39,7 @@ namespace osu.Game.Skinning
components.Clear(); components.Clear();
ComponentsLoaded = false; ComponentsLoaded = false;
content = CurrentSkin.GetDrawableComponent(new GlobalSkinLookup(Target)) as SkinnableTargetComponentsContainer; content = CurrentSkin.GetDrawableComponent(new GlobalSkinComponentLookup(Target)) as SkinnableTargetComponentsContainer;
cancellationSource?.Cancel(); cancellationSource?.Cancel();
cancellationSource = null; cancellationSource = null;

View File

@ -59,17 +59,17 @@ namespace osu.Game.Skinning
return null; return null;
} }
public override Drawable? GetDrawableComponent(ISkinLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
if (base.GetDrawableComponent(lookup) is Drawable c) if (base.GetDrawableComponent(lookup) is Drawable c)
return c; return c;
switch (lookup) switch (lookup)
{ {
case GlobalSkinLookup target: case GlobalSkinComponentLookup target:
switch (target.Lookup) switch (target.Lookup)
{ {
case GlobalSkinLookup.LookupType.SongSelect: case GlobalSkinComponentLookup.LookupType.SongSelect:
var songSelectComponents = new SkinnableTargetComponentsContainer(_ => var songSelectComponents = new SkinnableTargetComponentsContainer(_ =>
{ {
// do stuff when we need to. // do stuff when we need to.
@ -77,7 +77,7 @@ namespace osu.Game.Skinning
return songSelectComponents; return songSelectComponents;
case GlobalSkinLookup.LookupType.MainHUDComponents: case GlobalSkinComponentLookup.LookupType.MainHUDComponents:
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container => var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
{ {
var score = container.OfType<DefaultScoreCounter>().FirstOrDefault(); var score = container.OfType<DefaultScoreCounter>().FirstOrDefault();

View File

@ -7,7 +7,7 @@ namespace osu.Game.Skinning
{ {
public class UnsupportedSkinComponentException : Exception public class UnsupportedSkinComponentException : Exception
{ {
public UnsupportedSkinComponentException(ISkinLookup lookup) public UnsupportedSkinComponentException(ISkinComponentLookup lookup)
: base($@"Unsupported component type: {lookup.GetType()} (lookup: ""{lookup.LookupName}"").") : base($@"Unsupported component type: {lookup.GetType()} (lookup: ""{lookup.LookupName}"").")
{ {
} }