Automatically select new match in ladder editor after adding

This commit is contained in:
Dean Herbert 2023-07-24 20:45:01 +09:00
parent dd32b771cf
commit e46385ee6a
2 changed files with 7 additions and 6 deletions

View File

@ -78,8 +78,12 @@ public MenuItem[] ContextMenuItems
{
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
{
var pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
LadderInfo.Matches.Add(new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } });
Vector2 pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
TournamentMatch newMatch = new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } };
LadderInfo.Matches.Add(newMatch);
editorInfo.Selected.Value = newMatch;
}),
new OsuMenuItem("Reset teams", MenuItemType.Destructive, () =>
{

View File

@ -250,10 +250,7 @@ protected override void LoadComplete()
if (editorInfo != null)
{
globalSelection = editorInfo.Selected.GetBoundCopy();
globalSelection.BindValueChanged(s =>
{
if (s.NewValue != Match) Selected = false;
});
globalSelection.BindValueChanged(s => Selected = s.NewValue == Match, true);
}
}