mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:03:20 +08:00
Update grouping dropdown after new groupings are added
This commit is contained in:
parent
d4ff9dc833
commit
eb86d43d19
@ -13,7 +13,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
public List<MatchPairing> Pairings = new List<MatchPairing>();
|
||||
public List<TournamentProgression> Progressions = new List<TournamentProgression>();
|
||||
public List<TournamentGrouping> Groupings = new List<TournamentGrouping>();
|
||||
public BindableList<TournamentGrouping> Groupings = new BindableList<TournamentGrouping>();
|
||||
public List<TournamentTeam> Teams = new List<TournamentTeam>();
|
||||
|
||||
[JsonIgnore]
|
||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Tournament.Screens.Groupings
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Scheduler.AddDelayed(() => LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList(), 500, true);
|
||||
Scheduler.AddDelayed(updateGroupings, 500, true);
|
||||
}
|
||||
|
||||
private void addNew()
|
||||
@ -80,12 +80,14 @@ namespace osu.Game.Tournament.Screens.Groupings
|
||||
Value = DateTimeOffset.UtcNow
|
||||
}
|
||||
}, updateGroupings));
|
||||
|
||||
updateGroupings();
|
||||
}
|
||||
|
||||
private void updateGroupings()
|
||||
{
|
||||
LadderInfo.Groupings = items.Children.Select(c => c.Grouping).ToList();
|
||||
LadderInfo.Groupings.Clear();
|
||||
LadderInfo.Groupings.AddRange(items.Children.Select(c => c.Grouping));
|
||||
}
|
||||
|
||||
public class GroupingRow : CompositeDrawable
|
||||
|
@ -39,8 +39,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
var teamEntries = ladderInfo.Teams;
|
||||
|
||||
var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping());
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
@ -77,8 +75,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
textboxTeam2 = new OsuTextBox { RelativeSizeAxes = Axes.X, Height = 20 },
|
||||
groupingDropdown = new SettingsDropdown<TournamentGrouping>
|
||||
{
|
||||
Bindable = new Bindable<TournamentGrouping> { Default = groupingOptions.First() },
|
||||
Items = groupingOptions
|
||||
Bindable = new Bindable<TournamentGrouping>(),
|
||||
},
|
||||
losersCheckbox = new PlayerCheckbox
|
||||
{
|
||||
@ -91,6 +88,17 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
}
|
||||
};
|
||||
|
||||
var groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping());
|
||||
|
||||
void updateDropdownItems()
|
||||
{
|
||||
groupingOptions = ladderInfo.Groupings.Prepend(new TournamentGrouping());
|
||||
groupingDropdown.Items = groupingOptions;
|
||||
}
|
||||
|
||||
ladderInfo.Groupings.ItemsRemoved += _ => updateDropdownItems();
|
||||
ladderInfo.Groupings.ItemsAdded += _ => updateDropdownItems();
|
||||
|
||||
editorInfo.Selected.ValueChanged += selection =>
|
||||
{
|
||||
textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym;
|
||||
|
Loading…
Reference in New Issue
Block a user