Visual settings: Ignore beatmap skin

This commit is contained in:
TocoToucan 2018-04-20 18:17:57 +03:00
parent 295e1c78ee
commit 606e088713
3 changed files with 33 additions and 4 deletions

View File

@ -15,6 +15,7 @@ namespace osu.Game.Configuration
// UI/selection defaults // UI/selection defaults
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
Set(OsuSetting.Skin, 0, 0, int.MaxValue); Set(OsuSetting.Skin, 0, 0, int.MaxValue);
Set(OsuSetting.IgnoreBeatmapSkin, false);
Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details); Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
@ -133,6 +134,7 @@ namespace osu.Game.Configuration
Skin, Skin,
ScreenshotFormat, ScreenshotFormat,
ScreenshotCaptureMenuCursor, ScreenshotCaptureMenuCursor,
SongSelectRightMouseScroll SongSelectRightMouseScroll,
IgnoreBeatmapSkin
} }
} }

View File

@ -15,6 +15,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
private readonly PlayerSliderBar<double> dimSliderBar; private readonly PlayerSliderBar<double> dimSliderBar;
private readonly PlayerSliderBar<double> blurSliderBar; private readonly PlayerSliderBar<double> blurSliderBar;
private readonly PlayerCheckbox showStoryboardToggle; private readonly PlayerCheckbox showStoryboardToggle;
private readonly PlayerCheckbox ignoreBeatmapSkinToggle;
public VisualSettings() public VisualSettings()
{ {
@ -34,7 +35,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
Text = "Toggles:" Text = "Toggles:"
}, },
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" } showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" },
ignoreBeatmapSkinToggle = new PlayerCheckbox { LabelText = "Ignore beatmap skin" }
}; };
} }
@ -44,6 +46,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel); dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel); blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard); showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
ignoreBeatmapSkinToggle.Bindable = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapSkin);
} }
} }
} }

View File

@ -4,9 +4,11 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Configuration;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -14,9 +16,21 @@ namespace osu.Game.Skinning
{ {
public event Action SourceChanged; public event Action SourceChanged;
public Drawable GetDrawableComponent(string componentName) => source.GetDrawableComponent(componentName) ?? fallbackSource?.GetDrawableComponent(componentName); public Drawable GetDrawableComponent(string componentName)
{
Drawable sourceDrawable;
if (!ignoreBeatmapSkin && (sourceDrawable = source.GetDrawableComponent(componentName)) != null)
return sourceDrawable;
return fallbackSource?.GetDrawableComponent(componentName);
}
public Texture GetTexture(string componentName) => source.GetTexture(componentName) ?? fallbackSource.GetTexture(componentName); public Texture GetTexture(string componentName)
{
Texture sourceTexture;
if (!ignoreBeatmapSkin && (sourceTexture = source.GetTexture(componentName)) != null)
return sourceTexture;
return fallbackSource.GetTexture(componentName);
}
public SampleChannel GetSample(string sampleName) => source.GetSample(sampleName) ?? fallbackSource?.GetSample(sampleName); public SampleChannel GetSample(string sampleName) => source.GetSample(sampleName) ?? fallbackSource?.GetSample(sampleName);
@ -60,6 +74,16 @@ namespace osu.Game.Skinning
return dependencies; return dependencies;
} }
private Bindable<bool> ignoreBeatmapSkin = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
ignoreBeatmapSkin = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapSkin);
ignoreBeatmapSkin.ValueChanged += val => onSourceChanged();
ignoreBeatmapSkin.TriggerChange();
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();