1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

avoid potentially cancelling contract when switching away from GameplayScreen

This commit is contained in:
Dao Heng Liu 2023-07-23 10:39:47 +01:00
parent 647f2b6715
commit 3049d159d8
No known key found for this signature in database
GPG Key ID: 76B315615CDDAFDE

View File

@ -3,6 +3,7 @@
#nullable disable
using System.Diagnostics.Contracts;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -159,6 +160,25 @@ namespace osu.Game.Tournament.Screens.Gameplay
private TourneyState lastState;
private MatchHeader header;
private void contract()
{
SongBar.Expanded = false;
scoreDisplay.FadeOut(100);
using (chat?.BeginDelayedSequence(500))
chat?.Expand();
}
private void expand()
{
chat?.Contract();
using (BeginDelayedSequence(300))
{
scoreDisplay.FadeIn(100);
SongBar.Expanded = true;
}
}
private void stateChanged(ValueChangedEvent<TourneyState> state)
{
try
@ -175,25 +195,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
scheduledOperation?.Cancel();
void expand()
{
chat?.Contract();
using (BeginDelayedSequence(300))
{
scoreDisplay.FadeIn(100);
SongBar.Expanded = true;
}
}
void contract()
{
SongBar.Expanded = false;
scoreDisplay.FadeOut(100);
using (chat?.BeginDelayedSequence(500))
chat?.Expand();
}
switch (state.NewValue)
{
case TourneyState.Idle:
@ -234,7 +235,14 @@ namespace osu.Game.Tournament.Screens.Gameplay
public override void Hide()
{
scheduledOperation?.Cancel();
if (scheduledOperation != null)
{
scheduledOperation.Cancel();
if (State.Value == TourneyState.Ranking)
contract();
}
base.Hide();
}