Rename Target lookup to Component

This commit is contained in:
Dean Herbert 2024-08-22 19:00:15 +09:00
parent 9a21174582
commit b57b8168a6
No known key found for this signature in database
12 changed files with 22 additions and 22 deletions

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
return null;
// Our own ruleset components default.
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
// todo: remove CatchSkinComponents.CatchComboCounter and refactor LegacyCatchComboCounter to be added here instead.

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer d)
return d;
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container =>

View File

@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
if (!IsProvidingLegacyResources)
return null;
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container =>

View File

@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
return null;
// Our own ruleset components default.
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container =>

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected bool AssertComponentsFromExpectedSource(GlobalSkinnableContainers target, ISkin expectedSource)
{
var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Target == target);
var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Component == target);
var actualComponentsContainer = targetContainer.ChildrenOfType<Container>().SingleOrDefault(c => c.Parent == targetContainer);
if (actualComponentsContainer == null)

View File

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

View File

@ -101,7 +101,7 @@ namespace osu.Game.Skinning
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.SongSelect:
var songSelectComponents = new DefaultSkinComponentsContainer(_ =>

View File

@ -15,7 +15,7 @@ namespace osu.Game.Skinning
/// <summary>
/// The target area / layer of the game for which skin components will be returned.
/// </summary>
public readonly GlobalSkinnableContainers Target;
public readonly GlobalSkinnableContainers Component;
/// <summary>
/// The ruleset for which skin components should be returned.
@ -23,17 +23,17 @@ namespace osu.Game.Skinning
/// </summary>
public readonly RulesetInfo? Ruleset;
public GlobalSkinnableContainerLookup(GlobalSkinnableContainers target, RulesetInfo? ruleset = null)
public GlobalSkinnableContainerLookup(GlobalSkinnableContainers component, RulesetInfo? ruleset = null)
{
Target = target;
Component = component;
Ruleset = ruleset;
}
public override string ToString()
{
if (Ruleset == null) return Target.GetDescription();
if (Ruleset == null) return Component.GetDescription();
return $"{Target.GetDescription()} (\"{Ruleset.Name}\" only)";
return $"{Component.GetDescription()} (\"{Ruleset.Name}\" only)";
}
public bool Equals(GlobalSkinnableContainerLookup? other)
@ -41,7 +41,7 @@ namespace osu.Game.Skinning
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Target == other.Target && (ReferenceEquals(Ruleset, other.Ruleset) || Ruleset?.Equals(other.Ruleset) == true);
return Component == other.Component && (ReferenceEquals(Ruleset, other.Ruleset) || Ruleset?.Equals(other.Ruleset) == true);
}
public override bool Equals(object? obj)
@ -55,7 +55,7 @@ namespace osu.Game.Skinning
public override int GetHashCode()
{
return HashCode.Combine((int)Target, Ruleset);
return HashCode.Combine((int)Component, Ruleset);
}
}
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Skinning
{
if (lookup is GlobalSkinnableContainerLookup containerLookup)
{
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
// this should exist in LegacySkin instead, but there isn't a fallback skin for LegacySkins yet.

View File

@ -362,7 +362,7 @@ namespace osu.Game.Skinning
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.MainHUDComponents:
if (containerLookup.Ruleset != null)

View File

@ -164,7 +164,7 @@ namespace osu.Game.Skinning
/// <param name="targetContainer">The target container to reset.</param>
public void ResetDrawableTarget(SkinnableContainer targetContainer)
{
LayoutInfos.Remove(targetContainer.Lookup.Target);
LayoutInfos.Remove(targetContainer.Lookup.Component);
}
/// <summary>
@ -173,8 +173,8 @@ namespace osu.Game.Skinning
/// <param name="targetContainer">The target container to serialise to this skin.</param>
public void UpdateDrawableTarget(SkinnableContainer targetContainer)
{
if (!LayoutInfos.TryGetValue(targetContainer.Lookup.Target, out var layoutInfo))
layoutInfos[targetContainer.Lookup.Target] = layoutInfo = new SkinLayoutInfo();
if (!LayoutInfos.TryGetValue(targetContainer.Lookup.Component, out var layoutInfo))
layoutInfos[targetContainer.Lookup.Component] = layoutInfo = new SkinLayoutInfo();
layoutInfo.Update(targetContainer.Lookup.Ruleset, ((ISerialisableDrawableContainer)targetContainer).CreateSerialisedInfo().ToArray());
}
@ -191,7 +191,7 @@ namespace osu.Game.Skinning
// It is important to return null if the user has not configured this yet.
// This allows skin transformers the opportunity to provide default components.
if (!LayoutInfos.TryGetValue(containerLookup.Target, out var layoutInfo)) return null;
if (!LayoutInfos.TryGetValue(containerLookup.Component, out var layoutInfo)) return null;
if (!layoutInfo.TryGetDrawableInfo(containerLookup.Ruleset, out var drawableInfos)) return null;
return new UserConfiguredLayoutContainer

View File

@ -74,7 +74,7 @@ namespace osu.Game.Skinning
if (containerLookup.Ruleset != null)
return null;
switch (containerLookup.Target)
switch (containerLookup.Component)
{
case GlobalSkinnableContainers.SongSelect:
var songSelectComponents = new DefaultSkinComponentsContainer(_ =>