mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:03:20 +08:00
Add grouping manager
This commit is contained in:
parent
c26d226a75
commit
a4bb4255b1
50
osu.Game.Tournament.Tests/TestCaseGroupingManager.cs
Normal file
50
osu.Game.Tournament.Tests/TestCaseGroupingManager.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||
|
||||
namespace osu.Game.Tournament.Tests
|
||||
{
|
||||
public class TestCaseGroupingManager : LadderTestCase
|
||||
{
|
||||
public TestCaseGroupingManager()
|
||||
{
|
||||
FillFlowContainer items;
|
||||
|
||||
Add(items = new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
});
|
||||
|
||||
foreach (var g in Ladder.Groupings)
|
||||
items.Add(new GroupingRow(g));
|
||||
}
|
||||
|
||||
public class GroupingRow : CompositeDrawable
|
||||
{
|
||||
public readonly TournamentGrouping Grouping;
|
||||
|
||||
public GroupingRow(TournamentGrouping grouping)
|
||||
{
|
||||
Grouping = grouping;
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Horizontal,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Name },
|
||||
new SettingsTextBox { Width = 0.4f, Bindable = Grouping.Description },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = grouping.Description.ToUpper(),
|
||||
Text = grouping.Description.Value.ToUpper(),
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre
|
||||
},
|
||||
|
@ -2,13 +2,14 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public class TournamentGrouping
|
||||
{
|
||||
public string Name;
|
||||
public string Description;
|
||||
public readonly Bindable<string> Name = new Bindable<string>();
|
||||
public readonly Bindable<string> Description = new Bindable<string>();
|
||||
|
||||
public int BestOf;
|
||||
|
||||
|
@ -8,6 +8,6 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public class SettingsTextBox : SettingsItem<string>
|
||||
{
|
||||
protected override Drawable CreateControl() => new OsuTextBox();
|
||||
protected override Drawable CreateControl() => new OsuTextBox { RelativeSizeAxes = Axes.X };
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user