Skip to content

Commit

Permalink
使用WarningBoxContainer保证只有一个WarningBox
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwcgt committed Sep 11, 2024
1 parent 3e39ad7 commit 49be32f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions osu.Game.Tournament/Screens/Board/BoardScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public partial class BoardScreen : TournamentMatchScreen
[Resolved]
private TournamentSceneManager? sceneManager { get; set; }

private WarningBox warning = null!;
private Container warningBoxContainer = null!;
private WarningBox? warning;

private readonly Bindable<TournamentMatch?> currentMatch = new Bindable<TournamentMatch?>();

Expand Down Expand Up @@ -380,6 +381,10 @@ private void load(TextureStore textures)
Action = reset
},
},
},
warningBoxContainer = new Container
{
RelativeSizeAxes = Axes.Both
}
};
}
Expand Down Expand Up @@ -1182,13 +1187,13 @@ private void updateDisplay()

if (CurrentMatch.Value == null)
{
AddInternal(warning = new WarningBox("Cannot access current match, sorry ;w;"));
warningBoxContainer.Child = warning = new WarningBox("Cannot access current match, sorry ;w;");
return;
}

if (CurrentMatch.Value.Round.Value != null)
{
FillFlowContainer<BoardBeatmapPanel>? currentFlow = null;
FillFlowContainer<BoardBeatmapPanel>? currentFlow;

// Use predefined Board coodinate
if (CurrentMatch.Value.Round.Value.UseBoard.Value)
Expand Down Expand Up @@ -1225,9 +1230,10 @@ private void updateDisplay()
}
else
{
AddInternal(warning = new WarningBox("This round isn't set up for board view..."));
warningBoxContainer.Child = warning = new WarningBox("This round isn't set up for board view...");
return;
}

mapFlows.Padding = new MarginPadding(5);
}
}
Expand Down

0 comments on commit 49be32f

Please sign in to comment.