1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Component -> Lookup

This commit is contained in:
Dean Herbert 2024-08-23 14:48:50 +09:00
parent 46d55d5e61
commit 48cfd77ee8
No known key found for this signature in database
12 changed files with 22 additions and 22 deletions

View File

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

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup);
switch (containerLookup.Component)
switch (containerLookup.Lookup)
{
case GlobalSkinnableContainers.MainHUDComponents:
return new DefaultSkinComponentsContainer(container =>

View File

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

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
return null;
// Our own ruleset components default.
switch (containerLookup.Component)
switch (containerLookup.Lookup)
{
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.Component == target);
var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Lookup == 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.Component == GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset == null);
.Single(c => c.Lookup.Lookup == GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset == null);
private SkinnableContainer rulesetHUDTarget => Player.ChildrenOfType<SkinnableContainer>()
.Single(c => c.Lookup.Component == GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset != null);
.Single(c => c.Lookup.Lookup == GlobalSkinnableContainers.MainHUDComponents && c.Lookup.Ruleset != null);
[Test]
public void TestMigrationArgon()

View File

@ -97,7 +97,7 @@ namespace osu.Game.Skinning
switch (lookup)
{
case GlobalSkinnableContainerLookup containerLookup:
switch (containerLookup.Component)
switch (containerLookup.Lookup)
{
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 Component;
public readonly GlobalSkinnableContainers Lookup;
/// <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 component, RulesetInfo? ruleset = null)
public GlobalSkinnableContainerLookup(GlobalSkinnableContainers lookup, RulesetInfo? ruleset = null)
{
Component = component;
Lookup = lookup;
Ruleset = ruleset;
}
public override string ToString()
{
if (Ruleset == null) return Component.GetDescription();
if (Ruleset == null) return Lookup.GetDescription();
return $"{Component.GetDescription()} (\"{Ruleset.Name}\" only)";
return $"{Lookup.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 Component == other.Component && (ReferenceEquals(Ruleset, other.Ruleset) || Ruleset?.Equals(other.Ruleset) == true);
return Lookup == other.Lookup && (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)Component, Ruleset);
return HashCode.Combine((int)Lookup, Ruleset);
}
}
}

View File

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

View File

@ -359,7 +359,7 @@ namespace osu.Game.Skinning
switch (lookup)
{
case GlobalSkinnableContainerLookup containerLookup:
switch (containerLookup.Component)
switch (containerLookup.Lookup)
{
case GlobalSkinnableContainers.MainHUDComponents:
if (containerLookup.Ruleset != null)

View File

@ -165,7 +165,7 @@ namespace osu.Game.Skinning
/// <param name="targetContainer">The target container to reset.</param>
public void ResetDrawableTarget(SkinnableContainer targetContainer)
{
LayoutInfos.Remove(targetContainer.Lookup.Component);
LayoutInfos.Remove(targetContainer.Lookup.Lookup);
}
/// <summary>
@ -174,8 +174,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.Component, out var layoutInfo))
layoutInfos[targetContainer.Lookup.Component] = layoutInfo = new SkinLayoutInfo();
if (!LayoutInfos.TryGetValue(targetContainer.Lookup.Lookup, out var layoutInfo))
layoutInfos[targetContainer.Lookup.Lookup] = layoutInfo = new SkinLayoutInfo();
layoutInfo.Update(targetContainer.Lookup.Ruleset, ((ISerialisableDrawableContainer)targetContainer).CreateSerialisedInfo().ToArray());
}
@ -194,7 +194,7 @@ namespace osu.Game.Skinning
case GlobalSkinnableContainerLookup containerLookup:
// 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.Component, out var layoutInfo)) return null;
if (!LayoutInfos.TryGetValue(containerLookup.Lookup, out var layoutInfo)) return null;
if (!layoutInfo.TryGetDrawableInfo(containerLookup.Ruleset, out var drawableInfos)) return null;
return new Container

View File

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