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

Add workaround for dropdowns playing close animation on first display

This commit is contained in:
Dean Herbert 2021-06-18 22:08:59 +09:00
parent 5ce52b2669
commit 390abccb4b

View File

@ -81,9 +81,13 @@ namespace osu.Game.Graphics.UserInterface
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
}
// todo: this shouldn't be required after https://github.com/ppy/osu-framework/issues/4519 is fixed.
private bool wasOpened;
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
protected override void AnimateOpen()
{
wasOpened = true;
this.FadeIn(300, Easing.OutQuint);
sampleOpen?.Play();
}
@ -91,7 +95,8 @@ namespace osu.Game.Graphics.UserInterface
protected override void AnimateClose()
{
this.FadeOut(300, Easing.OutQuint);
sampleClose?.Play();
if (wasOpened)
sampleClose?.Play();
}
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring