1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +08:00
osu-lazer/osu.Game/Skinning/ISerialisableDrawableContainer.cs

52 lines
1.9 KiB
C#

// 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;
namespace osu.Game.Skinning
{
/// <summary>
/// A container which can house <see cref="ISerialisableDrawable"/>s.
/// Contains functionality for new drawables to be added, removed, and reloaded from provided <see cref="SerialisedDrawableInfo"/>.
/// </summary>
public interface ISerialisableDrawableContainer : IDrawable
{
/// <summary>
/// A bindable list of components which are being tracked by this skinnable target.
/// </summary>
IBindableList<ISerialisableDrawable> Components { get; }
/// <summary>
/// Serialise all children as <see cref="SerialisedDrawableInfo"/>.
/// </summary>
/// <returns>The serialised content.</returns>
IEnumerable<SerialisedDrawableInfo> CreateSerialisedInfo() => Components.Select(d => ((Drawable)d).CreateSerialisedInfo());
/// <summary>
/// Reload this target from the current skin.
/// </summary>
void Reload();
/// <summary>
/// Reload this target from the provided skinnable information.
/// </summary>
void Reload(SerialisedDrawableInfo[] skinnableInfo);
/// <summary>
/// Add a new skinnable component to this target.
/// </summary>
/// <param name="drawable">The component to add.</param>
void Add(ISerialisableDrawable drawable);
/// <summary>
/// Remove an existing skinnable component from this target.
/// </summary>
/// <param name="component">The component to remove.</param>
void Remove(ISerialisableDrawable component);
}
}