1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 19:52:55 +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; public event Action SourceChanged;
private Bindable<bool> beatmapSkins = new Bindable<bool>(); private readonly Bindable<bool> beatmapSkins = new Bindable<bool>();
private Bindable<bool> beatmapHitsounds = new Bindable<bool>(); private readonly Bindable<bool> beatmapHitsounds = new Bindable<bool>();
public Drawable GetDrawableComponent(string componentName) public Drawable GetDrawableComponent(string componentName)
{ {
@ -84,11 +84,8 @@ namespace osu.Game.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
beatmapSkins = config.GetBindable<bool>(OsuSetting.BeatmapSkins); config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
beatmapSkins.BindValueChanged(_ => onSourceChanged()); config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
beatmapHitsounds = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -97,6 +94,9 @@ namespace osu.Game.Skinning
if (fallbackSource != null) if (fallbackSource != null)
fallbackSource.SourceChanged += onSourceChanged; fallbackSource.SourceChanged += onSourceChanged;
beatmapSkins.BindValueChanged(_ => onSourceChanged());
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)