Merge pull request #8177 from peppy/tournament-design-schedule

Implement 2020 schedule design
This commit is contained in:
Dan Balasescu 2020-03-10 10:45:48 +09:00 committed by GitHub
commit 310e947add
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 47 deletions

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Schedule;
namespace osu.Game.Tournament.Tests.Screens namespace osu.Game.Tournament.Tests.Screens
@ -11,6 +13,7 @@ namespace osu.Game.Tournament.Tests.Screens
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
Add(new ScheduleScreen()); Add(new ScheduleScreen());
} }
} }

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -24,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private readonly bool editor; private readonly bool editor;
protected readonly FillFlowContainer<DrawableMatchTeam> Flow; protected readonly FillFlowContainer<DrawableMatchTeam> Flow;
private readonly Drawable selectionBox; private readonly Drawable selectionBox;
private readonly Drawable currentMatchSelectionBox; protected readonly Drawable CurrentMatchSelectionBox;
private Bindable<TournamentMatch> globalSelection; private Bindable<TournamentMatch> globalSelection;
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
@ -54,14 +53,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
Colour = Color4.YellowGreen, Colour = Color4.YellowGreen,
Child = new Box { RelativeSizeAxes = Axes.Both } Child = new Box { RelativeSizeAxes = Axes.Both }
}, },
currentMatchSelectionBox = new Container CurrentMatchSelectionBox = new Container
{ {
Scale = new Vector2(1.1f), Scale = new Vector2(1.05f, 1.1f),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Alpha = 0, Alpha = 0,
Colour = OsuColour.FromHex("#D24747"), Colour = Color4.White,
Child = new Box { RelativeSizeAxes = Axes.Both } Child = new Box { RelativeSizeAxes = Axes.Both }
}, },
Flow = new FillFlowContainer<DrawableMatchTeam> Flow = new FillFlowContainer<DrawableMatchTeam>
@ -125,9 +124,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateCurrentMatch() private void updateCurrentMatch()
{ {
if (Match.Current.Value) if (Match.Current.Value)
currentMatchSelectionBox.Show(); CurrentMatchSelectionBox.Show();
else else
currentMatchSelectionBox.Hide(); CurrentMatchSelectionBox.Hide();
} }
private bool selected; private bool selected;

View File

@ -18,7 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Schedule namespace osu.Game.Tournament.Screens.Schedule
{ {
public class ScheduleScreen : TournamentScreen public class ScheduleScreen : TournamentScreen // IProvidesVideo
{ {
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Container mainContainer; private Container mainContainer;
@ -38,10 +38,63 @@ namespace osu.Game.Tournament.Screens.Schedule
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
mainContainer = new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
} Padding = new MarginPadding(100) { Bottom = 50 },
Children = new Drawable[]
{
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableTournamentTitleText(),
new Container
{
Margin = new MarginPadding { Top = 40 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = Color4.White,
Size = new Vector2(50, 10),
},
new TournamentSpriteTextWithBackground("Schedule")
{
X = 60,
Scale = new Vector2(0.8f)
}
}
},
}
},
},
new Drawable[]
{
mainContainer = new Container
{
RelativeSizeAxes = Axes.Both,
}
}
}
}
}
},
}; };
currentMatch.BindValueChanged(matchChanged); currentMatch.BindValueChanged(matchChanged);
@ -62,7 +115,7 @@ namespace osu.Game.Tournament.Screens.Schedule
.SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); .SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a))));
upcoming = upcoming.Concat(conditionals); upcoming = upcoming.Concat(conditionals);
upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); upcoming = upcoming.OrderBy(p => p.Date.Value).Take(8);
mainContainer.Child = new FillFlowContainer mainContainer.Child = new FillFlowContainer
{ {
@ -73,7 +126,7 @@ namespace osu.Game.Tournament.Screens.Schedule
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.65f, Height = 0.74f,
Child = new FillFlowContainer Child = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -91,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Schedule
.Take(8) .Take(8)
.Select(p => new ScheduleMatch(p)) .Select(p => new ScheduleMatch(p))
}, },
new ScheduleContainer("match overview") new ScheduleContainer("upcoming matches")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.6f, Width = 0.6f,
@ -100,26 +153,57 @@ namespace osu.Game.Tournament.Screens.Schedule
} }
} }
}, },
new ScheduleContainer("current match") new ScheduleContainer("coming up next")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,
Children = new Drawable[] Children = new Drawable[]
{ {
new TournamentSpriteText new FillFlowContainer
{ {
Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10, 0), Direction = FillDirection.Horizontal,
Text = match.NewValue.Round.Value?.Name.Value, Spacing = new Vector2(30),
Colour = Color4.Black, Children = new Drawable[]
Font = OsuFont.Torus.With(size: 20) {
}, new ScheduleMatch(match.NewValue, false)
new ScheduleMatch(match.NewValue, false), {
new TournamentSpriteText Anchor = Anchor.CentreLeft,
{ Origin = Anchor.CentreLeft,
Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), },
Colour = Color4.Black, new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value)
Font = OsuFont.Torus.With(size: 20) {
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Scale = new Vector2(0.5f)
},
new TournamentSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = match.NewValue.Team1.Value?.FullName + " vs " + match.NewValue.Team2.Value?.FullName,
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold)
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new TournamentSpriteText
{
Text = "Starting ",
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
},
new DrawableDate(match.NewValue.Date.Value)
{
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
}
}
},
}
}, },
} }
} }
@ -134,6 +218,10 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
Flow.Direction = FillDirection.Horizontal; Flow.Direction = FillDirection.Horizontal;
Scale = new Vector2(0.8f);
CurrentMatchSelectionBox.Scale = new Vector2(1.02f, 1.15f);
bool conditional = match is ConditionalTournamentMatch; bool conditional = match is ConditionalTournamentMatch;
if (conditional) if (conditional)
@ -145,15 +233,16 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Colour = Color4.Black, Colour = OsuColour.Gray(0.7f),
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Font = OsuFont.Torus,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
}); });
AddInternal(new TournamentSpriteText AddInternal(new TournamentSpriteText
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Colour = Color4.Black, Colour = OsuColour.Gray(0.7f),
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "")
@ -170,29 +259,27 @@ namespace osu.Game.Tournament.Screens.Schedule
public ScheduleContainer(string title) public ScheduleContainer(string title)
{ {
Padding = new MarginPadding { Left = 30, Top = 30 }; Padding = new MarginPadding { Left = 60, Top = 10 };
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TournamentSpriteText new FillFlowContainer
{ {
X = 30,
Text = title,
Colour = Color4.Black,
Spacing = new Vector2(10, 0),
Font = OsuFont.Torus.With(size: 30)
},
content = new FillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding(40) Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new TournamentSpriteTextWithBackground(title.ToUpperInvariant())
{
Scale = new Vector2(0.5f)
},
content = new FillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding(10)
},
}
}, },
new Circle
{
Colour = new Color4(233, 187, 79, 255),
Width = 5,
RelativeSizeAxes = Axes.Y,
}
}; };
} }
} }