1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Merge pull request #3850 from peppy/fix-hitsound-change-crash

Fix crash when changing beatmap toggles at loading screen
This commit is contained in:
Dean Herbert 2018-12-14 19:41:13 +09:00 committed by GitHub
commit 59a56b1a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,8 +16,8 @@ namespace osu.Game.Skinning
{
public event Action SourceChanged;
private Bindable<bool> beatmapSkins = new Bindable<bool>();
private Bindable<bool> beatmapHitsounds = new Bindable<bool>();
private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
public Drawable GetDrawableComponent(string componentName)
{
@ -84,11 +84,8 @@ namespace osu.Game.Skinning
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
beatmapSkins = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
beatmapSkins.BindValueChanged(_ => onSourceChanged());
beatmapHitsounds = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true);
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
}
protected override void LoadComplete()
@ -97,6 +94,9 @@ namespace osu.Game.Skinning
if (fallbackSource != null)
fallbackSource.SourceChanged += onSourceChanged;
beatmapSkins.BindValueChanged(_ => onSourceChanged());
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true);
}
protected override void Dispose(bool isDisposing)