From 3b862798e985edc8ff51ba99b4d2961ccdede31b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 May 2021 13:14:49 +0900 Subject: [PATCH] Standardise naming of methods related to SkinnableInfo --- osu.Game/Extensions/DrawableExtensions.cs | 4 ++-- osu.Game/Screens/Play/HUD/SkinnableInfo.cs | 4 ++-- osu.Game/Skinning/Skin.cs | 2 +- osu.Game/Skinning/SkinnableElementTargetContainer.cs | 7 +++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/Extensions/DrawableExtensions.cs b/osu.Game/Extensions/DrawableExtensions.cs index 0ec96a876e..2ac6e6ff22 100644 --- a/osu.Game/Extensions/DrawableExtensions.cs +++ b/osu.Game/Extensions/DrawableExtensions.cs @@ -46,9 +46,9 @@ namespace osu.Game.Extensions public static Vector2 ScreenSpaceDeltaToParentSpace(this Drawable drawable, Vector2 delta) => drawable.Parent.ToLocalSpace(drawable.Parent.ToScreenSpace(Vector2.Zero) + delta); - public static SkinnableInfo CreateSerialisedInformation(this Drawable component) => new SkinnableInfo(component); + public static SkinnableInfo CreateSkinnableInfo(this Drawable component) => new SkinnableInfo(component); - public static void ApplySerialisedInformation(this Drawable component, SkinnableInfo info) + public static void ApplySkinnableInfo(this Drawable component, SkinnableInfo info) { // todo: can probably make this better via deserialisation directly using a common interface. component.Position = info.Position; diff --git a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs index 2e9235df97..678885d096 100644 --- a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs +++ b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD if (component is Container container) { foreach (var child in container.OfType().OfType()) - Children.Add(child.CreateSerialisedInformation()); + Children.Add(child.CreateSkinnableInfo()); } } @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Play.HUD public Drawable CreateInstance() { Drawable d = (Drawable)Activator.CreateInstance(Type); - d.ApplySerialisedInformation(this); + d.ApplySkinnableInfo(this); return d; } } diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index 64c848fbfa..4890524b90 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -76,7 +76,7 @@ namespace osu.Game.Skinning /// The target container to serialise to this skin. public void UpdateDrawableTarget(SkinnableElementTargetContainer targetContainer) { - DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSerialisedChildren().ToArray(); + DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray(); } public virtual Drawable GetDrawableComponent(ISkinComponent component) diff --git a/osu.Game/Skinning/SkinnableElementTargetContainer.cs b/osu.Game/Skinning/SkinnableElementTargetContainer.cs index f447800a33..2aea8c0281 100644 --- a/osu.Game/Skinning/SkinnableElementTargetContainer.cs +++ b/osu.Game/Skinning/SkinnableElementTargetContainer.cs @@ -64,8 +64,11 @@ namespace osu.Game.Skinning components.Add(component); } - public IEnumerable CreateSerialisedChildren() => - components.Select(d => ((Drawable)d).CreateSerialisedInformation()); + /// + /// Serialise all children as . + /// + /// The serialised content. + public IEnumerable CreateSkinnableInfo() => components.Select(d => ((Drawable)d).CreateSkinnableInfo()); protected override void SkinChanged(ISkinSource skin, bool allowFallback) {