Add ruleset selection to tournament client

This commit is contained in:
Dean Herbert 2019-11-11 17:03:50 +09:00
parent fced262c41
commit 702a1c496b
3 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Rulesets;
namespace osu.Game.Tournament.Models
{
@ -14,6 +15,8 @@ namespace osu.Game.Tournament.Models
[Serializable]
public class LadderInfo
{
public Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
public BindableList<TournamentMatch> Matches = new BindableList<TournamentMatch>();
public BindableList<TournamentRound> Rounds = new BindableList<TournamentRound>();
public BindableList<TournamentTeam> Teams = new BindableList<TournamentTeam>();

View File

@ -10,6 +10,7 @@
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Tournament.IPC;
using osuTK;
using osuTK.Graphics;
@ -28,6 +29,9 @@ public class SetupScreen : TournamentScreen, IProvideVideo
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
[BackgroundDependencyLoader]
private void load()
{
@ -85,7 +89,14 @@ private void reload()
Value = api?.LocalUser.Value.Username,
Failing = api?.IsLoggedIn != true,
Description = "In order to access the API and display metadata, a login is required."
}
},
new LabelledDropdown<RulesetInfo>
{
Label = "Ruleset",
Description = "Decides what stats are displayed and which ranks are retrieved for players",
Items = rulesets.AvailableRulesets,
Current = LadderInfo.Ruleset,
},
};
}

View File

@ -126,6 +126,8 @@ private void readBracket()
ladder = new LadderInfo();
}
Ruleset.BindTo(ladder.Ruleset);
dependencies.Cache(ladder);
bool addedInfo = false;