1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:13:34 +08:00

Rename SkinComponentsContainer to SkinnableContainer

This commit is contained in:
Dean Herbert 2024-08-22 17:14:35 +09:00
parent df94c22a29
commit 41756520b1
No known key found for this signature in database
16 changed files with 47 additions and 47 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.Tests
if (withModifiedSkin)
{
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
AddStep("update target", () => Player.ChildrenOfType<SkinComponentsContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("update target", () => Player.ChildrenOfType<SkinnableContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("exit player", () => Player.Exit());
CreateTest();
}

View File

@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestEmptyLegacyBeatmapSkinFallsBack()
{
CreateSkinTest(TrianglesSkin.CreateInfo(), () => new LegacyBeatmapSkin(new BeatmapInfo(), null));
AddUntilStep("wait for hud load", () => Player.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("wait for hud load", () => Player.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded));
AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(SkinComponentsContainerLookup.TargetArea.MainHUDComponents, skinManager.CurrentSkin.Value));
}
@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected bool AssertComponentsFromExpectedSource(SkinComponentsContainerLookup.TargetArea target, ISkin expectedSource)
{
var targetContainer = Player.ChildrenOfType<SkinComponentsContainer>().First(s => s.Lookup.Target == target);
var targetContainer = Player.ChildrenOfType<SkinnableContainer>().First(s => s.Lookup.Target == target);
var actualComponentsContainer = targetContainer.ChildrenOfType<Container>().SingleOrDefault(c => c.Parent == targetContainer);
if (actualComponentsContainer == null)

View File

@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private readonly IGameplayClock gameplayClock = new GameplayClockContainer(new TrackVirtual(60000), false, false);
// best way to check without exposing.
private Drawable hideTarget => hudOverlay.ChildrenOfType<SkinComponentsContainer>().First();
private Drawable hideTarget => hudOverlay.ChildrenOfType<SkinnableContainer>().First();
private Drawable keyCounterContent => hudOverlay.ChildrenOfType<KeyCounterDisplay>().First().ChildrenOfType<Drawable>().Skip(1).First();
public TestSceneHUDOverlay()
@ -242,8 +242,8 @@ namespace osu.Game.Tests.Visual.Gameplay
createNew();
AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType<SkinComponentsContainer>().Single().Alpha == 0);
AddUntilStep("wait for hud load", () => hudOverlay.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType<SkinnableContainer>().Single().Alpha == 0);
AddUntilStep("wait for hud load", () => hudOverlay.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded));
AddStep("bind on update", () =>
{
@ -260,10 +260,10 @@ namespace osu.Game.Tests.Visual.Gameplay
createNew();
AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType<SkinComponentsContainer>().Single().Alpha == 0);
AddUntilStep("wait for components to be hidden", () => hudOverlay.ChildrenOfType<SkinnableContainer>().Single().Alpha == 0);
AddStep("reload components", () => hudOverlay.ChildrenOfType<SkinComponentsContainer>().Single().Reload());
AddUntilStep("skinnable components loaded", () => hudOverlay.ChildrenOfType<SkinComponentsContainer>().Single().ComponentsLoaded);
AddStep("reload components", () => hudOverlay.ChildrenOfType<SkinnableContainer>().Single().Reload());
AddUntilStep("skinnable components loaded", () => hudOverlay.ChildrenOfType<SkinnableContainer>().Single().ComponentsLoaded);
}
private void createNew(Action<HUDOverlay>? action = null)

View File

@ -286,7 +286,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("set ruleset", () => currentRuleset = createRuleset());
AddStep("load player", LoadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
AddUntilStep("wait for hud", () => Player.HUDOverlay.ChildrenOfType<SkinComponentsContainer>().All(s => s.ComponentsLoaded));
AddUntilStep("wait for hud", () => Player.HUDOverlay.ChildrenOfType<SkinnableContainer>().All(s => s.ComponentsLoaded));
AddStep("seek to gameplay", () => Player.GameplayClockContainer.Seek(0));
AddUntilStep("wait for seek to finish", () => Player.DrawableRuleset.FrameStableClock.CurrentTime, () => Is.EqualTo(0).Within(500));

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Resolved]
private SkinManager skins { get; set; } = null!;
private SkinComponentsContainer targetContainer => Player.ChildrenOfType<SkinComponentsContainer>().First();
private SkinnableContainer targetContainer => Player.ChildrenOfType<SkinnableContainer>().First();
[SetUpSteps]
public override void SetUpSteps()
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("Add big black boxes", () =>
{
var target = Player.ChildrenOfType<SkinComponentsContainer>().First();
var target = Player.ChildrenOfType<SkinnableContainer>().First();
target.Add(box1 = new BigBlackBox
{
Position = new Vector2(-90),
@ -200,14 +200,14 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestUndoEditHistory()
{
SkinComponentsContainer firstTarget = null!;
SkinnableContainer firstTarget = null!;
TestSkinEditorChangeHandler changeHandler = null!;
byte[] defaultState = null!;
IEnumerable<ISerialisableDrawable> testComponents = null!;
AddStep("Load necessary things", () =>
{
firstTarget = Player.ChildrenOfType<SkinComponentsContainer>().First();
firstTarget = Player.ChildrenOfType<SkinnableContainer>().First();
changeHandler = new TestSkinEditorChangeHandler(firstTarget);
changeHandler.SaveState();
@ -377,11 +377,11 @@ namespace osu.Game.Tests.Visual.Gameplay
() => Is.EqualTo(3));
}
private SkinComponentsContainer globalHUDTarget => Player.ChildrenOfType<SkinComponentsContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset == null);
private SkinnableContainer globalHUDTarget => Player.ChildrenOfType<SkinnableContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset == null);
private SkinComponentsContainer rulesetHUDTarget => Player.ChildrenOfType<SkinComponentsContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset != null);
private SkinnableContainer rulesetHUDTarget => Player.ChildrenOfType<SkinnableContainer>()
.Single(c => c.Lookup.Target == SkinComponentsContainerLookup.TargetArea.MainHUDComponents && c.Lookup.Ruleset != null);
[Test]
public void TestMigrationArgon()

View File

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

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();
// best way to check without exposing.
private Drawable hideTarget => hudOverlay.ChildrenOfType<SkinComponentsContainer>().First();
private Drawable hideTarget => hudOverlay.ChildrenOfType<SkinnableContainer>().First();
private Drawable keyCounterFlow => hudOverlay.ChildrenOfType<KeyCounterDisplay>().First().ChildrenOfType<FillFlowContainer<KeyCounter>>().Single();
public TestSceneSkinnableHUDOverlay()
@ -101,7 +101,7 @@ namespace osu.Game.Tests.Visual.Gameplay
});
AddUntilStep("HUD overlay loaded", () => hudOverlay.IsAlive);
AddUntilStep("components container loaded",
() => hudOverlay.ChildrenOfType<SkinComponentsContainer>().Any(scc => scc.ComponentsLoaded));
() => hudOverlay.ChildrenOfType<SkinnableContainer>().Any(scc => scc.ComponentsLoaded));
}
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();

View File

@ -336,13 +336,13 @@ namespace osu.Game.Tests.Visual.Navigation
});
AddStep("change to triangles skin", () => Game.Dependencies.Get<SkinManager>().SetSkinFromConfiguration(SkinInfo.TRIANGLES_SKIN.ToString()));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded));
// sort of implicitly relies on song select not being skinnable.
// TODO: revisit if the above ever changes
AddUntilStep("skin changed", () => !skinEditor.ChildrenOfType<SkinBlueprint>().Any());
AddStep("change back to modified skin", () => Game.Dependencies.Get<SkinManager>().SetSkinFromConfiguration(editedSkinId.ToString()));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinComponentsContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("components loaded", () => Game.ChildrenOfType<SkinnableContainer>().All(c => c.ComponentsLoaded));
AddUntilStep("changes saved", () => skinEditor.ChildrenOfType<SkinBlueprint>().Any());
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.SkinEditor
{
public Action<Type>? RequestPlacement;
private readonly SkinComponentsContainer target;
private readonly SkinnableContainer target;
private readonly RulesetInfo? ruleset;
@ -35,7 +35,7 @@ namespace osu.Game.Overlays.SkinEditor
/// </summary>
/// <param name="target">The target. This is mainly used as a dependency source to find candidate components.</param>
/// <param name="ruleset">A ruleset to filter components by. If null, only components which are not ruleset-specific will be included.</param>
public SkinComponentToolbox(SkinComponentsContainer target, RulesetInfo? ruleset)
public SkinComponentToolbox(SkinnableContainer target, RulesetInfo? ruleset)
: base(ruleset == null ? SkinEditorStrings.Components : LocalisableString.Interpolate($"{SkinEditorStrings.Components} ({ruleset.Name})"))
{
this.target = target;

View File

@ -472,18 +472,18 @@ namespace osu.Game.Overlays.SkinEditor
settingsSidebar.Add(new SkinSettingsToolbox(component));
}
private IEnumerable<SkinComponentsContainer> availableTargets => targetScreen.ChildrenOfType<SkinComponentsContainer>();
private IEnumerable<SkinnableContainer> availableTargets => targetScreen.ChildrenOfType<SkinnableContainer>();
private SkinComponentsContainer? getFirstTarget() => availableTargets.FirstOrDefault();
private SkinnableContainer? getFirstTarget() => availableTargets.FirstOrDefault();
private SkinComponentsContainer? getTarget(SkinComponentsContainerLookup? target)
private SkinnableContainer? getTarget(SkinComponentsContainerLookup? target)
{
return availableTargets.FirstOrDefault(c => c.Lookup.Equals(target));
}
private void revert()
{
SkinComponentsContainer[] targetContainers = availableTargets.ToArray();
SkinnableContainer[] targetContainers = availableTargets.ToArray();
foreach (var t in targetContainers)
{
@ -555,7 +555,7 @@ namespace osu.Game.Overlays.SkinEditor
if (targetScreen?.IsLoaded != true)
return;
SkinComponentsContainer[] targetContainers = availableTargets.ToArray();
SkinnableContainer[] targetContainers = availableTargets.ToArray();
if (!targetContainers.All(c => c.ComponentsLoaded))
return;
@ -600,7 +600,7 @@ namespace osu.Game.Overlays.SkinEditor
public void BringSelectionToFront()
{
if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target)
if (getTarget(selectedTarget.Value) is not SkinnableContainer target)
return;
changeHandler?.BeginChange();
@ -624,7 +624,7 @@ namespace osu.Game.Overlays.SkinEditor
public void SendSelectionToBack()
{
if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target)
if (getTarget(selectedTarget.Value) is not SkinnableContainer target)
return;
changeHandler?.BeginChange();

View File

@ -95,10 +95,10 @@ namespace osu.Game.Screens.Play
private readonly BindableBool holdingForHUD = new BindableBool();
private readonly SkinComponentsContainer mainComponents;
private readonly SkinnableContainer mainComponents;
[CanBeNull]
private readonly SkinComponentsContainer rulesetComponents;
private readonly SkinnableContainer rulesetComponents;
/// <summary>
/// A flow which sits at the left side of the screen to house leaderboard (and related) components.
@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
? (rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, })
: Empty(),
PlayfieldSkinLayer = drawableRuleset != null
? new SkinComponentsContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, }
? new SkinnableContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, }
: Empty(),
topRightElements = new FillFlowContainer
{
@ -280,7 +280,7 @@ namespace osu.Game.Screens.Play
else
bottomRightElements.Y = 0;
void processDrawables(SkinComponentsContainer components)
void processDrawables(SkinnableContainer components)
{
// Avoid using foreach due to missing GetEnumerator implementation.
// See https://github.com/ppy/osu-framework/blob/e10051e6643731e393b09de40a3a3d209a545031/osu.Framework/Bindables/IBindableList.cs#L41-L44.
@ -440,7 +440,7 @@ namespace osu.Game.Screens.Play
}
}
private partial class HUDComponentsContainer : SkinComponentsContainer
private partial class HUDComponentsContainer : SkinnableContainer
{
private Bindable<ScoringMode> scoringMode;

View File

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

View File

@ -162,7 +162,7 @@ namespace osu.Game.Skinning
/// Remove all stored customisations for the provided target.
/// </summary>
/// <param name="targetContainer">The target container to reset.</param>
public void ResetDrawableTarget(SkinComponentsContainer targetContainer)
public void ResetDrawableTarget(SkinnableContainer targetContainer)
{
LayoutInfos.Remove(targetContainer.Lookup.Target);
}
@ -171,7 +171,7 @@ namespace osu.Game.Skinning
/// Update serialised information for the provided target.
/// </summary>
/// <param name="targetContainer">The target container to serialise to this skin.</param>
public void UpdateDrawableTarget(SkinComponentsContainer targetContainer)
public void UpdateDrawableTarget(SkinnableContainer targetContainer)
{
if (!LayoutInfos.TryGetValue(targetContainer.Lookup.Target, out var layoutInfo))
layoutInfos[targetContainer.Lookup.Target] = layoutInfo = new SkinLayoutInfo();

View File

@ -11,8 +11,8 @@ using osu.Game.Rulesets;
namespace osu.Game.Skinning
{
/// <summary>
/// A serialisable model describing layout of a <see cref="SkinComponentsContainer"/>.
/// May contain multiple configurations for different rulesets, each of which should manifest their own <see cref="SkinComponentsContainer"/> as required.
/// A serialisable model describing layout of a <see cref="SkinnableContainer"/>.
/// May contain multiple configurations for different rulesets, each of which should manifest their own <see cref="SkinnableContainer"/> as required.
/// </summary>
[Serializable]
public class SkinLayoutInfo

View File

@ -16,10 +16,10 @@ namespace osu.Game.Skinning
/// </summary>
/// <remarks>
/// This is currently used as a means of serialising skin layouts to files.
/// Currently, one json file in a skin will represent one <see cref="SkinComponentsContainer"/>, containing
/// Currently, one json file in a skin will represent one <see cref="SkinnableContainer"/>, containing
/// the output of <see cref="ISerialisableDrawableContainer.CreateSerialisedInfo"/>.
/// </remarks>
public partial class SkinComponentsContainer : SkinReloadableDrawable, ISerialisableDrawableContainer
public partial class SkinnableContainer : SkinReloadableDrawable, ISerialisableDrawableContainer
{
private Container? content;
@ -38,7 +38,7 @@ namespace osu.Game.Skinning
private CancellationTokenSource? cancellationSource;
public SkinComponentsContainer(SkinComponentsContainerLookup lookup)
public SkinnableContainer(SkinComponentsContainerLookup lookup)
{
Lookup = lookup;
}

View File

@ -45,13 +45,13 @@ namespace osu.Game.Tests.Visual
private void addResetTargetsStep()
{
AddStep("reset targets", () => this.ChildrenOfType<SkinComponentsContainer>().ForEach(t =>
AddStep("reset targets", () => this.ChildrenOfType<SkinnableContainer>().ForEach(t =>
{
LegacySkin.ResetDrawableTarget(t);
t.Reload();
}));
AddUntilStep("wait for components to load", () => this.ChildrenOfType<SkinComponentsContainer>().All(t => t.ComponentsLoaded));
AddUntilStep("wait for components to load", () => this.ChildrenOfType<SkinnableContainer>().All(t => t.ComponentsLoaded));
}
public partial class SkinProvidingPlayer : TestPlayer