Visual settings: Ignore beatmap hitsounds

This commit is contained in:
TocoToucan 2018-04-20 18:30:41 +03:00
parent 606e088713
commit 1ce38c7fc6
3 changed files with 19 additions and 3 deletions

View File

@ -16,6 +16,7 @@ protected override void InitialiseDefaults()
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 @@ public enum OsuSetting
ScreenshotFormat,
ScreenshotCaptureMenuCursor,
SongSelectRightMouseScroll,
IgnoreBeatmapSkin
IgnoreBeatmapSkin,
IgnoreBeatmapHitsounds
}
}

View File

@ -16,6 +16,7 @@ public class VisualSettings : PlayerSettingsGroup
private readonly PlayerSliderBar<double> blurSliderBar;
private readonly PlayerCheckbox showStoryboardToggle;
private readonly PlayerCheckbox ignoreBeatmapSkinToggle;
private readonly PlayerCheckbox ignoreBeatmapHitsoundsToggle;
public VisualSettings()
{
@ -36,7 +37,8 @@ public VisualSettings()
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 @@ private void load(OsuConfigManager config)
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
ignoreBeatmapSkinToggle.Bindable = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapSkin);
ignoreBeatmapHitsoundsToggle.Bindable = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapHitsounds);
}
}
}

View File

@ -32,7 +32,13 @@ public Texture GetTexture(string componentName)
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<TConfiguration, TValue>(Func<TConfiguration, TValue?> query) where TConfiguration : SkinConfiguration where TValue : struct
{
@ -75,6 +81,7 @@ protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnl
}
private Bindable<bool> ignoreBeatmapSkin = new Bindable<bool>();
private Bindable<bool> ignoreBeatmapHitsounds = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
@ -82,6 +89,10 @@ private void load(OsuConfigManager config)
ignoreBeatmapSkin = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapSkin);
ignoreBeatmapSkin.ValueChanged += val => onSourceChanged();
ignoreBeatmapSkin.TriggerChange();
ignoreBeatmapHitsounds = config.GetBindable<bool>(OsuSetting.IgnoreBeatmapHitsounds);
ignoreBeatmapHitsounds.ValueChanged += val => onSourceChanged();
ignoreBeatmapHitsounds.TriggerChange();
}
protected override void LoadComplete()