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-05-13 08:25:51 +00:00
|
|
|
using osu.Game.Extensions;
|
2021-05-12 05:11:40 +00:00
|
|
|
|
2021-04-30 03:42:32 +00:00
|
|
|
namespace osu.Game.Skinning
|
2021-04-30 03:41:18 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
2021-05-13 08:06:00 +00:00
|
|
|
/// Denotes a container which can house <see cref="ISkinnableDrawable"/>s.
|
2021-04-30 03:41:18 +00:00
|
|
|
/// </summary>
|
2021-05-12 05:11:40 +00:00
|
|
|
public interface ISkinnableTarget : IDrawable
|
2021-04-30 03:41:18 +00:00
|
|
|
{
|
2021-05-12 06:58:21 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The definition of this target.
|
|
|
|
/// </summary>
|
2022-11-09 07:04:56 +00:00
|
|
|
GlobalSkinComponentLookup.LookupType Target { get; }
|
2021-05-12 06:58:21 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A bindable list of components which are being tracked by this skinnable target.
|
|
|
|
/// </summary>
|
2021-05-13 08:06:00 +00:00
|
|
|
IBindableList<ISkinnableDrawable> 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>
|
2021-05-13 08:06:00 +00:00
|
|
|
void Add(ISkinnableDrawable 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-06 05:19:25 +00:00
|
|
|
void Remove(ISkinnableDrawable component);
|
2021-04-30 03:41:18 +00:00
|
|
|
}
|
|
|
|
}
|