mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:03:11 +08:00
Replace ISkinSerialisable
with IsEditable
property
This commit is contained in:
parent
dd6a06a302
commit
cdcd31b546
@ -15,7 +15,7 @@ using osuTK;
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinSerialisable"/>.
|
||||
/// Serialised information governing custom changes to an <see cref="ISkinnableComponent"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableInfo : IJsonSerializable
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
if (component is Container<Drawable> container)
|
||||
{
|
||||
foreach (var child in container.OfType<ISkinSerialisable>().OfType<Drawable>())
|
||||
foreach (var child in container.OfType<ISkinnableComponent>().OfType<Drawable>())
|
||||
Children.Add(child.CreateSkinnableInfo());
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +81,14 @@ namespace osu.Game.Skinning.Editor
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AddBlueprintFor(ISkinnableComponent item)
|
||||
{
|
||||
if (!item.IsEditable)
|
||||
return;
|
||||
|
||||
base.AddBlueprintFor(item);
|
||||
}
|
||||
|
||||
protected override SelectionHandler<ISkinnableComponent> CreateSelectionHandler() => new SkinSelectionHandler();
|
||||
|
||||
protected override SelectionBlueprint<ISkinnableComponent> CreateBlueprintFor(ISkinnableComponent component)
|
||||
|
@ -78,6 +78,9 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
Debug.Assert(instance != null);
|
||||
|
||||
if (!((ISkinnableComponent)instance).IsEditable)
|
||||
return null;
|
||||
|
||||
return new ToolboxComponentButton(instance);
|
||||
}
|
||||
catch
|
||||
|
@ -1,15 +0,0 @@
|
||||
// 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,12 +1,18 @@
|
||||
// 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 : ISkinSerialisable
|
||||
public interface ISkinnableComponent : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this component should be editable by an end user.
|
||||
/// </summary>
|
||||
bool IsEditable => true;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.OpenGL.Textures;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
|
@ -13,8 +13,10 @@ namespace osu.Game.Skinning
|
||||
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkinnableTargetWrapper : Container, ISkinSerialisable
|
||||
public class SkinnableTargetWrapper : Container, ISkinnableComponent
|
||||
{
|
||||
public bool IsEditable => false;
|
||||
|
||||
private readonly Action<Container> applyDefaults;
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user