mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:02:55 +08:00
Standardise naming of methods related to SkinnableInfo
This commit is contained in:
parent
581e7940c7
commit
3b862798e9
@ -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;
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
if (component is Container<Drawable> container)
|
||||
{
|
||||
foreach (var child in container.OfType<ISkinSerialisable>().OfType<Drawable>())
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Skinning
|
||||
/// <param name="targetContainer">The target container to serialise to this skin.</param>
|
||||
public void UpdateDrawableTarget(SkinnableElementTargetContainer targetContainer)
|
||||
{
|
||||
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSerialisedChildren().ToArray();
|
||||
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
|
||||
}
|
||||
|
||||
public virtual Drawable GetDrawableComponent(ISkinComponent component)
|
||||
|
@ -64,8 +64,11 @@ namespace osu.Game.Skinning
|
||||
components.Add(component);
|
||||
}
|
||||
|
||||
public IEnumerable<SkinnableInfo> CreateSerialisedChildren() =>
|
||||
components.Select(d => ((Drawable)d).CreateSerialisedInformation());
|
||||
/// <summary>
|
||||
/// Serialise all children as <see cref="SkinnableInfo"/>.
|
||||
/// </summary>
|
||||
/// <returns>The serialised content.</returns>
|
||||
public IEnumerable<SkinnableInfo> CreateSkinnableInfo() => components.Select(d => ((Drawable)d).CreateSkinnableInfo());
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user