2021-05-06 14:16:16 +08: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-07 17:18:29 +08:00
|
|
|
using osu.Game.Skinning;
|
2021-05-06 14:16:16 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
{
|
2021-05-07 17:18:29 +08:00
|
|
|
public class SkinnableElementTargetContainer : SkinReloadableDrawable, ISkinnableTarget
|
2021-05-06 14:16:16 +08:00
|
|
|
{
|
2021-05-07 18:13:38 +08:00
|
|
|
public SkinnableTarget Target { get; }
|
|
|
|
|
|
|
|
public SkinnableElementTargetContainer(SkinnableTarget target)
|
|
|
|
{
|
|
|
|
Target = target;
|
|
|
|
}
|
|
|
|
|
2021-05-07 17:18:29 +08:00
|
|
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
|
|
|
{
|
|
|
|
base.SkinChanged(skin, allowFallback);
|
|
|
|
|
2021-05-07 18:13:38 +08:00
|
|
|
var loadable = skin.GetDrawableComponent(new SkinnableTargetComponent(Target));
|
2021-05-07 17:18:29 +08:00
|
|
|
|
|
|
|
ClearInternal();
|
|
|
|
if (loadable != null)
|
2021-05-07 18:13:38 +08:00
|
|
|
LoadComponentAsync(loadable, AddInternal);
|
2021-05-07 17:18:29 +08:00
|
|
|
}
|
2021-05-06 14:16:16 +08:00
|
|
|
}
|
|
|
|
}
|