mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 15:33:22 +08:00
Merge pull request #31553 from ILW8/add-tourney-acronym-warning
add warning text on team acronym conflict
This commit is contained in:
commit
da6954762a
@ -71,6 +71,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private LadderInfo ladderInfo { get; set; } = null!;
|
private LadderInfo ladderInfo { get; set; } = null!;
|
||||||
|
|
||||||
|
private readonly SettingsTextBox acronymTextBox;
|
||||||
|
|
||||||
public TeamRow(TournamentTeam team, TournamentScreen parent)
|
public TeamRow(TournamentTeam team, TournamentScreen parent)
|
||||||
{
|
{
|
||||||
Model = team;
|
Model = team;
|
||||||
@ -112,7 +114,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
Width = 0.2f,
|
Width = 0.2f,
|
||||||
Current = Model.FullName
|
Current = Model.FullName
|
||||||
},
|
},
|
||||||
new SettingsTextBox
|
acronymTextBox = new SettingsTextBox
|
||||||
{
|
{
|
||||||
LabelText = "Acronym",
|
LabelText = "Acronym",
|
||||||
Width = 0.2f,
|
Width = 0.2f,
|
||||||
@ -177,6 +179,27 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Model.Acronym.BindValueChanged(acronym =>
|
||||||
|
{
|
||||||
|
var teamsWithSameAcronym = ladderInfo.Teams
|
||||||
|
.Where(t => t.Acronym.Value == acronym.NewValue && t != Model)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (teamsWithSameAcronym.Count > 0)
|
||||||
|
{
|
||||||
|
acronymTextBox.SetNoticeText(
|
||||||
|
$"Acronym '{acronym.NewValue}' is already in use by team{(teamsWithSameAcronym.Count > 1 ? "s" : "")}:\n"
|
||||||
|
+ $"{string.Join(",\n", teamsWithSameAcronym)}", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
acronymTextBox.ClearNoticeText();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
private partial class LastYearPlacementSlider : RoundedSliderBar<int>
|
private partial class LastYearPlacementSlider : RoundedSliderBar<int>
|
||||||
{
|
{
|
||||||
public override LocalisableString TooltipText => Current.Value == 0 ? "N/A" : base.TooltipText;
|
public override LocalisableString TooltipText => Current.Value == 0 ? "N/A" : base.TooltipText;
|
||||||
|
Loading…
Reference in New Issue
Block a user