From 606e08871330d7a7718bacb49fc1721d86bca293 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Fri, 20 Apr 2018 18:17:57 +0300 Subject: [PATCH 1/4] Visual settings: Ignore beatmap skin --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++- .../Play/PlayerSettings/VisualSettings.cs | 5 +++- .../Skinning/LocalSkinOverrideContainer.cs | 28 +++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 3efaa02a31..6785b53cdd 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -15,6 +15,7 @@ namespace osu.Game.Configuration // UI/selection defaults Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); Set(OsuSetting.Skin, 0, 0, int.MaxValue); + Set(OsuSetting.IgnoreBeatmapSkin, false); Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details); @@ -133,6 +134,7 @@ namespace osu.Game.Configuration Skin, ScreenshotFormat, ScreenshotCaptureMenuCursor, - SongSelectRightMouseScroll + SongSelectRightMouseScroll, + IgnoreBeatmapSkin } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 92d069a224..8a2a8ac773 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -15,6 +15,7 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerSliderBar dimSliderBar; private readonly PlayerSliderBar blurSliderBar; private readonly PlayerCheckbox showStoryboardToggle; + private readonly PlayerCheckbox ignoreBeatmapSkinToggle; public VisualSettings() { @@ -34,7 +35,8 @@ namespace osu.Game.Screens.Play.PlayerSettings { 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(OsuSetting.DimLevel); blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); + ignoreBeatmapSkinToggle.Bindable = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); } } } diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index bfbb1719df..3332f73ac7 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -4,9 +4,11 @@ using System; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Textures; +using osu.Game.Configuration; namespace osu.Game.Skinning { @@ -14,9 +16,21 @@ namespace osu.Game.Skinning { 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); @@ -60,6 +74,16 @@ namespace osu.Game.Skinning return dependencies; } + private Bindable ignoreBeatmapSkin = new Bindable(); + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + ignoreBeatmapSkin = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); + ignoreBeatmapSkin.ValueChanged += val => onSourceChanged(); + ignoreBeatmapSkin.TriggerChange(); + } + protected override void LoadComplete() { base.LoadComplete(); From 1ce38c7fc6fb3cb76957dc0f9ec5d8ddcfd9f9e0 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Fri, 20 Apr 2018 18:30:41 +0300 Subject: [PATCH 2/4] Visual settings: Ignore beatmap hitsounds --- osu.Game/Configuration/OsuConfigManager.cs | 4 +++- .../Screens/Play/PlayerSettings/VisualSettings.cs | 5 ++++- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 13 ++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6785b53cdd..a7dcaef500 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -16,6 +16,7 @@ namespace osu.Game.Configuration Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); Set(OsuSetting.Skin, 0, 0, int.MaxValue); Set(OsuSetting.IgnoreBeatmapSkin, false); + Set(OsuSetting.IgnoreBeatmapHitsounds, false); Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details); @@ -135,6 +136,7 @@ namespace osu.Game.Configuration ScreenshotFormat, ScreenshotCaptureMenuCursor, SongSelectRightMouseScroll, - IgnoreBeatmapSkin + IgnoreBeatmapSkin, + IgnoreBeatmapHitsounds } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 8a2a8ac773..66d2d413fa 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -16,6 +16,7 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerSliderBar blurSliderBar; private readonly PlayerCheckbox showStoryboardToggle; private readonly PlayerCheckbox ignoreBeatmapSkinToggle; + private readonly PlayerCheckbox ignoreBeatmapHitsoundsToggle; public VisualSettings() { @@ -36,7 +37,8 @@ namespace osu.Game.Screens.Play.PlayerSettings Text = "Toggles:" }, showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }, - ignoreBeatmapSkinToggle = new PlayerCheckbox { LabelText = "Ignore beatmap skin" } + ignoreBeatmapSkinToggle = new PlayerCheckbox { LabelText = "Ignore beatmap skin" }, + ignoreBeatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Ignore beatmap hitsounds" } }; } @@ -47,6 +49,7 @@ namespace osu.Game.Screens.Play.PlayerSettings blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); ignoreBeatmapSkinToggle.Bindable = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); + ignoreBeatmapHitsoundsToggle.Bindable = config.GetBindable(OsuSetting.IgnoreBeatmapHitsounds); } } } diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 3332f73ac7..f4476eb3a6 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -32,7 +32,13 @@ namespace osu.Game.Skinning return fallbackSource.GetTexture(componentName); } - public SampleChannel GetSample(string sampleName) => source.GetSample(sampleName) ?? fallbackSource?.GetSample(sampleName); + public SampleChannel GetSample(string sampleName) + { + SampleChannel sourceChannel; + if (!ignoreBeatmapHitsounds && (sourceChannel = source.GetSample(sampleName)) != null) + return sourceChannel; + return fallbackSource?.GetSample(sampleName); + } public TValue? GetValue(Func query) where TConfiguration : SkinConfiguration where TValue : struct { @@ -75,6 +81,7 @@ namespace osu.Game.Skinning } private Bindable ignoreBeatmapSkin = new Bindable(); + private Bindable ignoreBeatmapHitsounds = new Bindable(); [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -82,6 +89,10 @@ namespace osu.Game.Skinning ignoreBeatmapSkin = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); ignoreBeatmapSkin.ValueChanged += val => onSourceChanged(); ignoreBeatmapSkin.TriggerChange(); + + ignoreBeatmapHitsounds = config.GetBindable(OsuSetting.IgnoreBeatmapHitsounds); + ignoreBeatmapHitsounds.ValueChanged += val => onSourceChanged(); + ignoreBeatmapHitsounds.TriggerChange(); } protected override void LoadComplete() From 4f53185d436c6e8fc4d69ff914e340084aa392bc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Apr 2018 16:15:23 +0900 Subject: [PATCH 3/4] Invert logic to match existing toggles --- osu.Game/Configuration/OsuConfigManager.cs | 9 +++---- .../Play/PlayerSettings/VisualSettings.cs | 12 +++++----- .../Skinning/LocalSkinOverrideContainer.cs | 24 +++++++++---------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a7dcaef500..509622c2fe 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -15,8 +15,6 @@ namespace osu.Game.Configuration // UI/selection defaults Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); Set(OsuSetting.Skin, 0, 0, int.MaxValue); - Set(OsuSetting.IgnoreBeatmapSkin, false); - Set(OsuSetting.IgnoreBeatmapHitsounds, false); Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details); @@ -62,6 +60,9 @@ namespace osu.Game.Configuration Set(OsuSetting.ShowFpsDisplay, false); Set(OsuSetting.ShowStoryboard, true); + Set(OsuSetting.BeatmapSkins, true); + Set(OsuSetting.BeatmapHitsounds, true); + Set(OsuSetting.CursorRotation, true); Set(OsuSetting.MenuParallax, true); @@ -136,7 +137,7 @@ namespace osu.Game.Configuration ScreenshotFormat, ScreenshotCaptureMenuCursor, SongSelectRightMouseScroll, - IgnoreBeatmapSkin, - IgnoreBeatmapHitsounds + BeatmapSkins, + BeatmapHitsounds } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 66d2d413fa..439e344020 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -15,8 +15,8 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerSliderBar dimSliderBar; private readonly PlayerSliderBar blurSliderBar; private readonly PlayerCheckbox showStoryboardToggle; - private readonly PlayerCheckbox ignoreBeatmapSkinToggle; - private readonly PlayerCheckbox ignoreBeatmapHitsoundsToggle; + private readonly PlayerCheckbox beatmapSkinsToggle; + private readonly PlayerCheckbox beatmapHitsoundsToggle; public VisualSettings() { @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play.PlayerSettings Text = "Toggles:" }, showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }, - ignoreBeatmapSkinToggle = new PlayerCheckbox { LabelText = "Ignore beatmap skin" }, - ignoreBeatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Ignore beatmap hitsounds" } + beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" }, + beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" } }; } @@ -48,8 +48,8 @@ namespace osu.Game.Screens.Play.PlayerSettings dimSliderBar.Bindable = config.GetBindable(OsuSetting.DimLevel); blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); - ignoreBeatmapSkinToggle.Bindable = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); - ignoreBeatmapHitsoundsToggle.Bindable = config.GetBindable(OsuSetting.IgnoreBeatmapHitsounds); + beatmapSkinsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapSkins); + beatmapHitsoundsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapHitsounds); } } } diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index f4476eb3a6..bab2a956be 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -16,10 +16,13 @@ namespace osu.Game.Skinning { public event Action SourceChanged; + private Bindable beatmapSkins = new Bindable(); + private Bindable beatmapHitsounds = new Bindable(); + public Drawable GetDrawableComponent(string componentName) { Drawable sourceDrawable; - if (!ignoreBeatmapSkin && (sourceDrawable = source.GetDrawableComponent(componentName)) != null) + if (beatmapSkins && (sourceDrawable = source.GetDrawableComponent(componentName)) != null) return sourceDrawable; return fallbackSource?.GetDrawableComponent(componentName); } @@ -27,7 +30,7 @@ namespace osu.Game.Skinning public Texture GetTexture(string componentName) { Texture sourceTexture; - if (!ignoreBeatmapSkin && (sourceTexture = source.GetTexture(componentName)) != null) + if (beatmapSkins && (sourceTexture = source.GetTexture(componentName)) != null) return sourceTexture; return fallbackSource.GetTexture(componentName); } @@ -35,7 +38,7 @@ namespace osu.Game.Skinning public SampleChannel GetSample(string sampleName) { SampleChannel sourceChannel; - if (!ignoreBeatmapHitsounds && (sourceChannel = source.GetSample(sampleName)) != null) + if (beatmapHitsounds && (sourceChannel = source.GetSample(sampleName)) != null) return sourceChannel; return fallbackSource?.GetSample(sampleName); } @@ -80,19 +83,16 @@ namespace osu.Game.Skinning return dependencies; } - private Bindable ignoreBeatmapSkin = new Bindable(); - private Bindable ignoreBeatmapHitsounds = new Bindable(); - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - ignoreBeatmapSkin = config.GetBindable(OsuSetting.IgnoreBeatmapSkin); - ignoreBeatmapSkin.ValueChanged += val => onSourceChanged(); - ignoreBeatmapSkin.TriggerChange(); + beatmapSkins = config.GetBindable(OsuSetting.BeatmapSkins); + beatmapSkins.ValueChanged += val => onSourceChanged(); + beatmapSkins.TriggerChange(); - ignoreBeatmapHitsounds = config.GetBindable(OsuSetting.IgnoreBeatmapHitsounds); - ignoreBeatmapHitsounds.ValueChanged += val => onSourceChanged(); - ignoreBeatmapHitsounds.TriggerChange(); + beatmapHitsounds = config.GetBindable(OsuSetting.BeatmapHitsounds); + beatmapHitsounds.ValueChanged += val => onSourceChanged(); + beatmapHitsounds.TriggerChange(); } protected override void LoadComplete() From 6e6586909bc25bccc0380afa6c8f90a8e1d83272 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Apr 2018 16:32:06 +0900 Subject: [PATCH 4/4] User pattern matching --- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index bab2a956be..ad6a033936 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -46,8 +46,7 @@ namespace osu.Game.Skinning public TValue? GetValue(Func query) where TConfiguration : SkinConfiguration where TValue : struct { TValue? val = null; - var conf = (source as Skin)?.Configuration as TConfiguration; - if (conf != null) + if ((source as Skin)?.Configuration is TConfiguration conf) val = query?.Invoke(conf); return val ?? fallbackSource?.GetValue(query); @@ -56,8 +55,7 @@ namespace osu.Game.Skinning public TValue GetValue(Func query) where TConfiguration : SkinConfiguration where TValue : class { TValue val = null; - var conf = (source as Skin)?.Configuration as TConfiguration; - if (conf != null) + if ((source as Skin)?.Configuration is TConfiguration conf) val = query?.Invoke(conf); return val ?? fallbackSource?.GetValue(query);