1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Add basic interfaces for skinnable target containers

This commit is contained in:
Dean Herbert 2021-04-30 12:41:18 +09:00
parent ae9d1dc40b
commit 5585a7d438
4 changed files with 30 additions and 3 deletions

View File

@ -0,0 +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.
namespace osu.Game.Screens.Play.HUD
{
/// <summary>
/// The default placement location for new <see cref="ISkinnableComponent"/>s.
/// </summary>
public interface IDefaultSkinnableTarget : ISkinnableTarget
{
}
}

View 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;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Play.HUD
{
/// <summary>
/// Denotes a container which can house <see cref="ISkinnableComponent"/>s.
/// </summary>
public interface ISkinnableTarget : IContainerCollection<Drawable>
{
}
}

View File

@ -22,7 +22,7 @@ using osuTK;
namespace osu.Game.Screens.Play
{
[Cached]
public class HUDOverlay : Container, IKeyBindingHandler<GlobalAction>
public class HUDOverlay : Container, IKeyBindingHandler<GlobalAction>, IDefaultSkinnableTarget
{
public const float FADE_DURATION = 300;

View File

@ -11,7 +11,7 @@ using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Skinning.Editor
{
@ -70,7 +70,7 @@ namespace osu.Game.Skinning.Editor
{
var instance = (Drawable)Activator.CreateInstance(type);
var targetContainer = target.ChildrenOfType<HUDOverlay>().FirstOrDefault();
var targetContainer = target.ChildrenOfType<IDefaultSkinnableTarget>().FirstOrDefault();
targetContainer?.Add(instance);
}