2019-08-26 03:21:11 +00: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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
2019-08-28 07:36:20 +00:00
|
|
|
using osu.Game.Audio;
|
2019-08-26 03:21:11 +00:00
|
|
|
using osu.Game.Configuration;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A container which overrides existing skin options with beatmap-local values.
|
|
|
|
/// </summary>
|
|
|
|
public class BeatmapSkinProvidingContainer : SkinProvidingContainer
|
|
|
|
{
|
|
|
|
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
|
|
|
|
private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
|
|
|
|
|
|
|
|
protected override bool AllowConfigurationLookup => beatmapSkins.Value;
|
2019-08-30 05:39:02 +00:00
|
|
|
protected override bool AllowDrawableLookup(ISkinComponent component) => beatmapSkins.Value;
|
2019-08-26 03:21:11 +00:00
|
|
|
protected override bool AllowTextureLookup(string componentName) => beatmapSkins.Value;
|
2019-08-28 07:36:20 +00:00
|
|
|
protected override bool AllowSampleLookup(ISampleInfo componentName) => beatmapHitsounds.Value;
|
2019-08-26 03:21:11 +00:00
|
|
|
|
|
|
|
public BeatmapSkinProvidingContainer(ISkin skin)
|
|
|
|
: base(skin)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuConfigManager config)
|
|
|
|
{
|
|
|
|
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
|
|
|
|
config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
|
|
|
|
|
|
|
|
beatmapSkins.BindValueChanged(_ => TriggerSourceChanged());
|
|
|
|
beatmapHitsounds.BindValueChanged(_ => TriggerSourceChanged());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|