mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Allow some serialised components to not be mutable by the user
This commit is contained in:
parent
81902ad6a6
commit
bf65547eec
@ -14,7 +14,7 @@ using osuTK;
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinnableComponent"/>.
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinSerialisable"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableInfo : IJsonSerializable
|
||||
@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
if (component is Container container)
|
||||
{
|
||||
foreach (var child in container.Children.OfType<ISkinnableComponent>().OfType<Drawable>())
|
||||
foreach (var child in container.Children.OfType<ISkinSerialisable>().OfType<Drawable>())
|
||||
Children.Add(child.CreateSerialisedInformation());
|
||||
}
|
||||
}
|
||||
|
15
osu.Game/Skinning/IImmutableSkinnableComponent.cs
Normal file
15
osu.Game/Skinning/IImmutableSkinnableComponent.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Denotes a drawable component which should be serialised as part of a skin.
|
||||
/// Use <see cref="ISkinnableComponent"/> for components which should be mutable by the user / editor.
|
||||
/// </summary>
|
||||
public interface ISkinSerialisable : IDrawable
|
||||
{
|
||||
}
|
||||
}
|
@ -1,14 +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 osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications.
|
||||
/// </summary>
|
||||
public interface ISkinnableComponent : IDrawable
|
||||
public interface ISkinnableComponent : ISkinSerialisable
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
public readonly SkinInfo SkinInfo;
|
||||
|
||||
private readonly IStorageResourceProvider resources;
|
||||
|
||||
public SkinConfiguration Configuration { get; protected set; }
|
||||
|
||||
public IDictionary<SkinnableTarget, SkinnableInfo[]> DrawableComponentInfo => drawableComponentInfo;
|
||||
@ -43,7 +41,6 @@ namespace osu.Game.Skinning
|
||||
SkinInfo = skin;
|
||||
|
||||
// may be null for default skin.
|
||||
this.resources = resources;
|
||||
|
||||
// we may want to move this to some kind of async operation in the future.
|
||||
foreach (SkinnableTarget skinnableTarget in Enum.GetValues(typeof(SkinnableTarget)))
|
||||
@ -124,7 +121,7 @@ namespace osu.Game.Skinning
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class SkinnableTargetWrapper : Container, ISkinnableComponent
|
||||
public class SkinnableTargetWrapper : Container, ISkinSerialisable
|
||||
{
|
||||
public SkinnableTargetWrapper()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user