mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Revise TournamentSwitcher to include a close button
This commit is contained in:
parent
9e15dccc56
commit
8e428353ee
@ -42,6 +42,9 @@ namespace osu.Game.Tournament.Screens
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private TournamentGameBase game { get; set; }
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private TournamentSceneManager sceneManager { get; set; }
|
private TournamentSceneManager sceneManager { get; set; }
|
||||||
|
|
||||||
@ -68,9 +71,6 @@ namespace osu.Game.Tournament.Screens
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private Framework.Game game { get; set; }
|
|
||||||
|
|
||||||
private void reload()
|
private void reload()
|
||||||
{
|
{
|
||||||
var fileBasedIpc = ipc as FileBasedIPC;
|
var fileBasedIpc = ipc as FileBasedIPC;
|
||||||
@ -115,12 +115,14 @@ namespace osu.Game.Tournament.Screens
|
|||||||
Items = rulesets.AvailableRulesets,
|
Items = rulesets.AvailableRulesets,
|
||||||
Current = LadderInfo.Ruleset,
|
Current = LadderInfo.Ruleset,
|
||||||
},
|
},
|
||||||
new LabelledDropdown<string>
|
new TournamentSwitcher
|
||||||
{
|
{
|
||||||
Label = "Current tournament",
|
Label = "Current tournament",
|
||||||
Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.",
|
Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.",
|
||||||
Items = storage.ListTournaments(),
|
Items = storage.ListTournaments(),
|
||||||
Current = storage.CurrentTournament,
|
Current = storage.CurrentTournament,
|
||||||
|
ButtonText = "Close osu!",
|
||||||
|
Action = () => game.GracefullyExit()
|
||||||
},
|
},
|
||||||
resolution = new ResolutionSelector
|
resolution = new ResolutionSelector
|
||||||
{
|
{
|
||||||
@ -165,7 +167,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
private class ActionableInfo : LabelledDrawable<Drawable>
|
private class ActionableInfo : LabelledDrawable<Drawable>
|
||||||
{
|
{
|
||||||
private OsuButton button;
|
protected OsuButton Button;
|
||||||
|
|
||||||
public ActionableInfo()
|
public ActionableInfo()
|
||||||
: base(true)
|
: base(true)
|
||||||
@ -174,7 +176,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
public string ButtonText
|
public string ButtonText
|
||||||
{
|
{
|
||||||
set => button.Text = value;
|
set => Button.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Value
|
public string Value
|
||||||
@ -211,7 +213,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
Spacing = new Vector2(10, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
button = new TriangleButton
|
Button = new TriangleButton
|
||||||
{
|
{
|
||||||
Size = new Vector2(100, 40),
|
Size = new Vector2(100, 40),
|
||||||
Action = () => Action?.Invoke()
|
Action = () => Action?.Invoke()
|
||||||
@ -222,6 +224,34 @@ namespace osu.Game.Tournament.Screens
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TournamentSwitcher : ActionableInfo
|
||||||
|
{
|
||||||
|
private OsuDropdown<string> dropdown;
|
||||||
|
|
||||||
|
public IEnumerable<string> Items
|
||||||
|
{
|
||||||
|
get => dropdown.Items;
|
||||||
|
set => dropdown.Items = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bindable<string> Current
|
||||||
|
{
|
||||||
|
get => dropdown.Current;
|
||||||
|
set => dropdown.Current = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateComponent()
|
||||||
|
{
|
||||||
|
var drawable = base.CreateComponent();
|
||||||
|
FlowContainer.Insert(-1, dropdown = new OsuDropdown<string>
|
||||||
|
{
|
||||||
|
Width = 510
|
||||||
|
});
|
||||||
|
|
||||||
|
return drawable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class ResolutionSelector : ActionableInfo
|
private class ResolutionSelector : ActionableInfo
|
||||||
{
|
{
|
||||||
private const int minimum_window_height = 480;
|
private const int minimum_window_height = 480;
|
||||||
|
Loading…
Reference in New Issue
Block a user