mirror of
https://github.com/ppy/osu
synced 2025-01-30 01:42:54 +00:00
Rename Target
lookup to Component
This commit is contained in:
parent
9a21174582
commit
b57b8168a6
@ -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.
|
||||
|
@ -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 =>
|
||||
|
@ -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 =>
|
||||
|
@ -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 =>
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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(_ =>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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(_ =>
|
||||
|
Loading…
Reference in New Issue
Block a user