1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Merge pull request #24331 from ILW8/tourney-fix-screen-auto-switch

Fix auto advance screens sometimes not advancing
This commit is contained in:
Dean Herbert 2023-07-25 17:53:27 +09:00 committed by GitHub
commit ec1b0884f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 36 deletions

View File

@ -139,7 +139,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
base.LoadComplete();
State.BindTo(ipc.State);
State.BindValueChanged(stateChanged, true);
State.BindValueChanged(_ => updateState(), true);
}
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
@ -150,20 +150,47 @@ namespace osu.Game.Tournament.Screens.Gameplay
return;
warmup.Value = match.NewValue.Team1Score.Value + match.NewValue.Team2Score.Value == 0;
scheduledOperation?.Cancel();
scheduledScreenChange?.Cancel();
}
private ScheduledDelegate scheduledOperation;
private ScheduledDelegate scheduledScreenChange;
private ScheduledDelegate scheduledContract;
private TournamentMatchScoreDisplay scoreDisplay;
private TourneyState lastState;
private MatchHeader header;
private void stateChanged(ValueChangedEvent<TourneyState> state)
private void contract()
{
scheduledContract?.Cancel();
SongBar.Expanded = false;
scoreDisplay.FadeOut(100);
using (chat?.BeginDelayedSequence(500))
chat?.Expand();
}
private void expand()
{
scheduledContract?.Cancel();
chat?.Contract();
using (BeginDelayedSequence(300))
{
scoreDisplay.FadeIn(100);
SongBar.Expanded = true;
}
}
private void updateState()
{
try
{
if (state.NewValue == TourneyState.Ranking)
scheduledScreenChange?.Cancel();
if (State.Value == TourneyState.Ranking)
{
if (warmup.Value || CurrentMatch.Value == null) return;
@ -173,28 +200,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
CurrentMatch.Value.Team2Score.Value++;
}
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)
switch (State.Value)
{
case TourneyState.Idle:
contract();
@ -208,30 +214,41 @@ namespace osu.Game.Tournament.Screens.Gameplay
if (lastState == TourneyState.Ranking && !warmup.Value)
{
if (CurrentMatch.Value?.Completed.Value == true)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression);
scheduledScreenChange = 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);
scheduledScreenChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression);
}
}
break;
case TourneyState.Ranking:
scheduledOperation = Scheduler.AddDelayed(contract, 10000);
scheduledContract = Scheduler.AddDelayed(contract, 10000);
break;
default:
chat.Contract();
expand();
break;
}
}
finally
{
lastState = state.NewValue;
lastState = State.Value;
}
}
public override void Hide()
{
scheduledScreenChange?.Cancel();
base.Hide();
}
public override void Show()
{
updateState();
base.Show();
}
private partial class ChromaArea : CompositeDrawable
{
[Resolved]

View File

@ -37,6 +37,8 @@ namespace osu.Game.Tournament.Screens.MapPool
private OsuButton buttonRedPick;
private OsuButton buttonBluePick;
private ScheduledDelegate scheduledScreenChange;
[BackgroundDependencyLoader]
private void load(MatchIPCInfo ipc)
{
@ -188,8 +190,6 @@ namespace osu.Game.Tournament.Screens.MapPool
setNextMode();
}
private ScheduledDelegate scheduledChange;
private void addForBeatmap(int beatmapId)
{
if (CurrentMatch.Value == null)
@ -216,12 +216,18 @@ namespace osu.Game.Tournament.Screens.MapPool
{
if (pickType == ChoiceType.Pick && CurrentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
{
scheduledChange?.Cancel();
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
scheduledScreenChange?.Cancel();
scheduledScreenChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
}
}
}
public override void Hide()
{
scheduledScreenChange?.Cancel();
base.Hide();
}
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
{
base.CurrentMatchChanged(match);