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
1 changed files with 6 additions and 1 deletions

View File

@ -81,9 +81,13 @@ private void load(AudioManager audio)
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 @@ protected override void AnimateOpen()
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