mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Use interface in place of SkinnableTargetContainer
This commit is contained in:
parent
0959e7156a
commit
3ea469813c
@ -1,7 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -20,6 +25,12 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
IBindableList<ISkinnableDrawable> Components { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Serialise all children as <see cref="SkinnableInfo"/>.
|
||||
/// </summary>
|
||||
/// <returns>The serialised content.</returns>
|
||||
IEnumerable<SkinnableInfo> CreateSkinnableInfo() => Components.Select(d => ((Drawable)d).CreateSkinnableInfo());
|
||||
|
||||
/// <summary>
|
||||
/// Reload this target from the current skin.
|
||||
/// </summary>
|
||||
|
@ -65,7 +65,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(SkinnableTargetContainer targetContainer)
|
||||
public void ResetDrawableTarget(ISkinnableTarget targetContainer)
|
||||
{
|
||||
DrawableComponentInfo.Remove(targetContainer.Target);
|
||||
}
|
||||
@ -74,7 +74,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(SkinnableTargetContainer targetContainer)
|
||||
public void UpdateDrawableTarget(ISkinnableTarget targetContainer)
|
||||
{
|
||||
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
|
||||
}
|
||||
|
@ -2,12 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -64,12 +61,6 @@ namespace osu.Game.Skinning
|
||||
components.Add(component);
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
Loading…
Reference in New Issue
Block a user