diff --git a/osu.Game.Tests/Visual/TestCaseMatchInfo.cs b/osu.Game.Tests/Visual/TestCaseMatchInfo.cs index 37b3f6030d..0272581a8f 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchInfo.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchInfo.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; @@ -13,6 +15,14 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseMatchInfo : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Info), + typeof(HeaderButton), + typeof(ReadyButton), + typeof(ViewBeatmapButton) + }; + [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 4e3349056c..db71f7d2fe 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Multi.Match.Components tabStrip.Colour = colours.Yellow; } - private class BeatmapSelectButton : TriangleButton + private class BeatmapSelectButton : HeaderButton { private readonly IBindable roomIDBind = new Bindable(); diff --git a/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs b/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs new file mode 100644 index 0000000000..30fe609ede --- /dev/null +++ b/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Multi.Match.Components +{ + public class HeaderButton : TriangleButton + { + [BackgroundDependencyLoader] + private void load() + { + BackgroundColour = OsuColour.FromHex(@"1187aa"); + + Triangles.ColourLight = OsuColour.FromHex(@"277b9c"); + Triangles.ColourDark = OsuColour.FromHex(@"1f6682"); + Triangles.TriangleScale = 1.5f; + + Add(new Container + { + RelativeSizeAxes = Axes.Both, + Alpha = 1f, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.15f, + Blending = BlendingMode.Additive, + }, + }); + } + + protected override SpriteText CreateText() => new OsuSpriteText + { + Depth = -1, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Font = @"Exo2.0-Light", + TextSize = 30, + }; + } +} diff --git a/osu.Game/Screens/Multi/Match/Components/Info.cs b/osu.Game/Screens/Multi/Match/Components/Info.cs index f63fed8152..4912c95327 100644 --- a/osu.Game/Screens/Multi/Match/Components/Info.cs +++ b/osu.Game/Screens/Multi/Match/Components/Info.cs @@ -23,8 +23,6 @@ namespace osu.Game.Screens.Multi.Match.Components { public class Info : Container { - public const float HEIGHT = 156; - public Action OnStart; private readonly OsuSpriteText availabilityStatus; @@ -41,7 +39,7 @@ namespace osu.Game.Screens.Multi.Match.Components public Info() { RelativeSizeAxes = Axes.X; - Height = HEIGHT; + AutoSizeAxes = Axes.Y; BeatmapTypeInfo beatmapTypeInfo; OsuSpriteText name; @@ -56,14 +54,16 @@ namespace osu.Game.Screens.Multi.Match.Components }, new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Children = new Drawable[] { - new Container + new FillFlowContainer { - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), Padding = new MarginPadding { Vertical = 20 }, Children = new Drawable[] { @@ -75,12 +75,10 @@ namespace osu.Game.Screens.Multi.Match.Components { name = new OsuSpriteText { TextSize = 30 }, availabilityStatus = new OsuSpriteText { TextSize = 14 }, - }, + } }, new FillFlowContainer { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] @@ -93,18 +91,25 @@ namespace osu.Game.Screens.Multi.Match.Components }, } } - }, }, - new ReadyButton + new FillFlowContainer { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - RelativeSizeAxes = Axes.Y, - Size = new Vector2(200, 1), - Padding = new MarginPadding { Vertical = 10 }, - Action = () => OnStart?.Invoke() - }, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.X, + Height = 70, + Spacing = new Vector2(10, 0), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new ViewBeatmapButton(), + new ReadyButton + { + Action = () => OnStart?.Invoke() + } + } + } }, }, }; diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index f0ca013b62..ec07b5ec09 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -1,50 +1,19 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; +using osuTK; namespace osu.Game.Screens.Multi.Match.Components { - public class ReadyButton : TriangleButton + public class ReadyButton : HeaderButton { - [BackgroundDependencyLoader] - private void load() + public ReadyButton() { - BackgroundColour = OsuColour.FromHex(@"1187aa"); - - Triangles.ColourLight = OsuColour.FromHex(@"277b9c"); - Triangles.ColourDark = OsuColour.FromHex(@"1f6682"); - Triangles.TriangleScale = 1.5f; + RelativeSizeAxes = Axes.Y; + Size = new Vector2(200, 1); Text = "Start"; - - Add(new Container - { - RelativeSizeAxes = Axes.Both, - Alpha = 1f, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.15f, - Blending = BlendingMode.Additive, - }, - }); } - - protected override SpriteText CreateText() => new OsuSpriteText - { - Depth = -1, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Font = @"Exo2.0-Light", - TextSize = 30, - }; } } diff --git a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs new file mode 100644 index 0000000000..e9cff656c2 --- /dev/null +++ b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osuTK; + +namespace osu.Game.Screens.Multi.Match.Components +{ + public class ViewBeatmapButton : HeaderButton + { + public ViewBeatmapButton() + { + RelativeSizeAxes = Axes.Y; + Size = new Vector2(200, 1); + + Text = "View beatmap"; + } + } +} diff --git a/osu.Game/Screens/Multi/Match/MatchScreen.cs b/osu.Game/Screens/Multi/Match/MatchScreen.cs index 1d713dd0b1..82b234e9c8 100644 --- a/osu.Game/Screens/Multi/Match/MatchScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchScreen.cs @@ -66,19 +66,21 @@ namespace osu.Game.Screens.Multi.Match Children = new Drawable[] { - header = new Components.Header - { - Depth = -1, - }, - info = new Info - { - Margin = new MarginPadding { Top = Components.Header.HEIGHT }, - OnStart = onStart - }, - participants = new Participants + new GridContainer { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = Components.Header.HEIGHT + Info.HEIGHT }, + Content = new[] + { + new Drawable[] { header = new Components.Header { Depth = -1 } }, + new Drawable[] { info = new Info { OnStart = onStart } }, + new Drawable[] { participants = new Participants { RelativeSizeAxes = Axes.Both } }, + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.AutoSize), + new Dimension(GridSizeMode.Distributed), + } }, new Container {