mirror of
https://github.com/ppy/osu.git
synced 2026-06-05 12:03:46 +08:00
Add basic interfaces for skinnable target containers
This commit is contained in:
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user