1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 04:52:57 +08:00

Avoid redundant (synchronous) skin change

This commit is contained in:
Dean Herbert 2019-02-27 14:30:04 +09:00
parent a8bc87f5d8
commit 9473b53226

View File

@ -71,27 +71,20 @@ namespace osu.Game.Skinning
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
fallbackSource = dependencies.Get<ISkinSource>(); fallbackSource = dependencies.Get<ISkinSource>();
dependencies.CacheAs<ISkinSource>(this);
return dependencies;
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
}
protected override void LoadComplete()
{
base.LoadComplete();
if (fallbackSource != null) if (fallbackSource != null)
fallbackSource.SourceChanged += onSourceChanged; fallbackSource.SourceChanged += onSourceChanged;
dependencies.CacheAs<ISkinSource>(this);
var config = dependencies.Get<OsuConfigManager>();
config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins);
config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds);
beatmapSkins.BindValueChanged(_ => onSourceChanged()); beatmapSkins.BindValueChanged(_ => onSourceChanged());
beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true); beatmapHitsounds.BindValueChanged(_ => onSourceChanged());
return dependencies;
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)