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