2021-04-30 03:41:18 +00:00
|
|
|
// 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.
|
|
|
|
|
2021-05-13 08:25:51 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2021-05-12 06:58:21 +00:00
|
|
|
using osu.Framework.Bindables;
|
2021-05-12 05:11:40 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
2021-04-30 03:42:32 +00:00
|
|
|
namespace osu.Game.Skinning
|
2021-04-30 03:41:18 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
2023-02-15 07:28:42 +00:00
|
|
|
/// 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"/>.
|
2021-04-30 03:41:18 +00:00
|
|
|
/// </summary>
|
2023-02-15 07:28:42 +00:00
|
|
|
public interface ISerialisableDrawableContainer : IDrawable
|
2021-04-30 03:41:18 +00:00
|
|
|
{
|
2021-05-12 06:58:21 +00:00
|
|
|
/// <summary>
|
|
|
|
/// A bindable list of components which are being tracked by this skinnable target.
|
|
|
|
/// </summary>
|
2023-02-15 07:01:26 +00:00
|
|
|
IBindableList<ISerialisableDrawable> Components { get; }
|
2021-05-11 02:56:14 +00:00
|
|
|
|
2021-05-13 08:25:51 +00:00
|
|
|
/// <summary>
|
2023-02-15 06:47:41 +00:00
|
|
|
/// Serialise all children as <see cref="SerialisedDrawableInfo"/>.
|
2021-05-13 08:25:51 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <returns>The serialised content.</returns>
|
2023-02-15 06:47:41 +00:00
|
|
|
IEnumerable<SerialisedDrawableInfo> CreateSerialisedInfo() => Components.Select(d => ((Drawable)d).CreateSerialisedInfo());
|
2021-05-11 02:56:14 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Reload this target from the current skin.
|
|
|
|
/// </summary>
|
2021-05-12 06:58:21 +00:00
|
|
|
void Reload();
|
2021-05-11 02:56:14 +00:00
|
|
|
|
2023-02-03 09:53:09 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Reload this target from the provided skinnable information.
|
|
|
|
/// </summary>
|
2023-02-15 06:47:41 +00:00
|
|
|
void Reload(SerialisedDrawableInfo[] skinnableInfo);
|
2023-02-03 09:53:09 +00:00
|
|
|
|
2021-05-11 02:56:14 +00:00
|
|
|
/// <summary>
|
2021-05-14 07:03:22 +00:00
|
|
|
/// Add a new skinnable component to this target.
|
2021-05-11 02:56:14 +00:00
|
|
|
/// </summary>
|
2021-05-14 07:03:22 +00:00
|
|
|
/// <param name="drawable">The component to add.</param>
|
2023-02-15 07:01:26 +00:00
|
|
|
void Add(ISerialisableDrawable drawable);
|
2021-05-14 07:03:22 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2021-05-14 20:15:43 +00:00
|
|
|
/// Remove an existing skinnable component from this target.
|
2021-05-14 07:03:22 +00:00
|
|
|
/// </summary>
|
2021-05-14 20:15:43 +00:00
|
|
|
/// <param name="component">The component to remove.</param>
|
2023-02-22 08:45:38 +00:00
|
|
|
/// <param name="disposeImmediately">Whether removed items should be immediately disposed.</param>
|
|
|
|
void Remove(ISerialisableDrawable component, bool disposeImmediately);
|
2021-04-30 03:41:18 +00:00
|
|
|
}
|
|
|
|
}
|