1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Read from skin config

This commit is contained in:
Dean Herbert 2021-05-07 18:18:29 +09:00
parent b9ab9342fa
commit 67ea4a7e97
2 changed files with 17 additions and 4 deletions

View File

@ -1,11 +1,24 @@
// 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.Containers;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Skinning;
namespace osu.Game.Screens.Play.HUD
{
public class SkinnableElementTargetContainer : Container, ISkinnableTarget
public class SkinnableElementTargetContainer : SkinReloadableDrawable, ISkinnableTarget
{
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
base.SkinChanged(skin, allowFallback);
var loadable = skin.GetConfig<Type, IEnumerable<Drawable>>(this.GetType());
ClearInternal();
if (loadable != null)
LoadComponentsAsync(loadable.Value, AddRangeInternal);
}
}
}

View File

@ -1,6 +1,8 @@
// 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 System;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
@ -57,7 +59,5 @@ namespace osu.Game.Skinning
/// <returns>A matching value boxed in an <see cref="IBindable{TValue}"/>, or null if unavailable.</returns>
[CanBeNull]
IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup);
// IEnumerable<ISkinnableInfo> ComponentInfo { get; }
}
}