private void stateChanged(ValueChangedEvent <TourneyState> state) { try { if (state.NewValue == TourneyState.Ranking) { if (warmup.Value) { return; } if (ipc.Score1.Value > ipc.Score2.Value) { currentMatch.Value.Team1Score.Value++; } else { currentMatch.Value.Team2Score.Value++; } } scheduledOperation?.Cancel(); void expand() { chat?.Expand(); using (BeginDelayedSequence(300, true)) { scoreDisplay.FadeIn(100); SongBar.Expanded = true; } } void contract() { SongBar.Expanded = false; scoreDisplay.FadeOut(100); using (chat?.BeginDelayedSequence(500)) chat?.Contract(); } switch (state.NewValue) { case TourneyState.Idle: contract(); const float delay_before_progression = 4000; // if we've returned to idle and the last screen was ranking // we should automatically proceed after a short delay if (lastState == TourneyState.Ranking && !warmup.Value) { if (currentMatch.Value?.Completed.Value == true) { scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression); } else if (currentMatch.Value?.Completed.Value == false) { scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression); } } break; case TourneyState.Ranking: scheduledOperation = Scheduler.AddDelayed(contract, 10000); break; default: chat.Expand(); expand(); break; } } finally { lastState = state.NewValue; } }