1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Fix ModDisplay potentially being operated on before loaded completely

Closes https://github.com/ppy/osu/issues/11810.
This commit is contained in:
Dean Herbert 2021-02-17 21:09:20 +09:00
parent d757dfa05c
commit 403536ef80

View File

@ -72,19 +72,6 @@ namespace osu.Game.Screens.Play.HUD
} }
}, },
}; };
Current.ValueChanged += mods =>
{
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue)
{
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
}
if (IsLoaded)
appearTransform();
};
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
@ -97,7 +84,16 @@ namespace osu.Game.Screens.Play.HUD
{ {
base.LoadComplete(); base.LoadComplete();
appearTransform(); Current.BindValueChanged(mods =>
{
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue)
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
appearTransform();
}, true);
iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint); iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
} }