From 3aa1f35127d18b005bc222a9ebef222ba2bb3e42 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 05:12:11 -0300 Subject: [PATCH 01/13] Basic layout --- .../Tests/TestCaseDrawableRoom.cs | 18 +- .../Tests/TestCaseRoomInspector.cs | 101 ++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Online/Multiplayer/Room.cs | 4 +- .../Overlays/Toolbar/ToolbarModeButton.cs | 2 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 6 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 502 ++++++++++++++++++ osu.Game/Users/User.cs | 4 + osu.Game/osu.Game.csproj | 1 + 9 files changed, 632 insertions(+), 7 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs create mode 100644 osu.Game/Screens/Multiplayer/RoomInspector.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index de58323abe..32af330f44 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -38,12 +38,26 @@ namespace osu.Desktop.VisualTests.Tests first.Room.Name.Value = @"Great Room Right Here"; first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}; first.Room.Status.Value = new RoomStatusOpen(); - first.Room.Beatmap.Value = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }; + first.Room.Beatmap.Value = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Seiryu", + Artist = @"Critical Crystal", + }, + }; second.Room.Name.Value = @"Relax It's The Weekend"; second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}; second.Room.Status.Value = new RoomStatusPlaying(); - second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }; + second.Room.Beatmap.Value = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Serendipity", + Artist = @"ZAQ", + }, + }; AddStep(@"change state", () => { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs new file mode 100644 index 0000000000..8ec1f66f8b --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -0,0 +1,101 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Game.Screens.Multiplayer; +using osu.Game.Database; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; +using osu.Framework.Allocation; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseRoomInspector : TestCase + { + public override string Description => @"from the multiplayer lobby"; + + private RulesetDatabase rulesets; + + public override void Reset() + { + base.Reset(); + + var room = new Room(); + room.Name.Value = @"My Awesome Room"; + room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; + room.Status.Value = new RoomStatusOpen(); + room.Beatmap.Value = new BeatmapInfo + { + StarDifficulty = 3.7, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Platina", + Artist = @"Maaya Sakamoto", + Author = @"uwutm8", + }, + }; + room.MaxParticipants.Value = 200; + room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }}; + + RoomInspector inspector; + Add(inspector = new RoomInspector + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Room = room, + }); + + AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); + AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); + AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change beatmap", () => room.Beatmap.Value = null); + AddStep(@"change max participants", () => room.MaxParticipants.Value = null); + AddStep(@"change participants", () => room.Participants.Value = new[] + { + new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 }, + new User { Username = @"_index", Id = 652457, GlobalRank = 15024 } + }); + + AddStep(@"change room", () => + { + var newRoom = new Room(); + newRoom.Name.Value = @"My New, Better Than Ever Room"; + newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; + newRoom.Status.Value = new RoomStatusOpen(); + newRoom.Beatmap.Value = new BeatmapInfo + { + StarDifficulty = 7.07, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"xi", + Artist = @"FREEDOM DIVE", + Author = @"Nakagawa-Kanon", + }, + }; + newRoom.MaxParticipants.Value = 10; + newRoom.Participants.Value = new[] + { + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, + new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, + new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + }; + + inspector.Room = newRoom; + }); + } + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 5a532d7234..466c9336f0 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -224,6 +224,7 @@ + diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index c82025f902..fe3378f4a6 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,6 +12,8 @@ namespace osu.Game.Online.Multiplayer public Bindable Name = new Bindable(); public Bindable Host = new Bindable(); public Bindable Status = new Bindable(); - public Bindable Beatmap = new Bindable(); + public Bindable Beatmap = new Bindable(); + public Bindable MaxParticipants = new Bindable(); + public Bindable Participants = new Bindable(); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index dd70289f7d..5f0ab3991d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -55,4 +55,4 @@ namespace osu.Game.Overlays.Toolbar DrawableIcon.TextSize *= 1.4f; } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 7365963085..bbe279946a 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -227,13 +227,13 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), 100); } - private void displayBeatmap(BeatmapMetadata value) + private void displayBeatmap(BeatmapInfo value) { if (value != null) { - beatmapTitle.Current = localisation.GetUnicodePreference(value.TitleUnicode, value.Title); + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(value.ArtistUnicode, value.Artist); + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs new file mode 100644 index 0000000000..1471e2ed26 --- /dev/null +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -0,0 +1,502 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Localisation; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class RoomInspector : Container + { + private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + + private readonly FillFlowContainer topFlow; + private readonly Box statusStrip; + private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; + private readonly Sprite cover; + private readonly FillFlowContainer levelRangeContainer; + private readonly ScrollContainer participantsScroll; + private readonly FillFlowContainer participantsFlow; + private readonly Container rulesetContainer; + private readonly Container flagContainer; + + private Bindable nameBind = new Bindable(); + private Bindable hostBind = new Bindable(); + private Bindable statusBind = new Bindable(); + private Bindable beatmapBind = new Bindable(); + private Bindable maxParticipantsBind = new Bindable(); + private Bindable participantsBind = new Bindable(); + + private OsuColour colours; + private LocalisationEngine localisation; + + private Room room; + public Room Room + { + get { return room; } + set + { + if (value == room) return; + room = value; + + nameBind.BindTo(Room.Name); + hostBind.BindTo(Room.Host); + statusBind.BindTo(Room.Status); + beatmapBind.BindTo(Room.Beatmap); + maxParticipantsBind.BindTo(Room.MaxParticipants); + participantsBind.BindTo(Room.Participants); + } + } + + public RoomInspector() + { + Width = 520; + RelativeSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"343138"), + }, + topFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = 200, + Masking = true, + Children = new Drawable[] + { + cover = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(20), + Children = new Drawable[] + { + new FillFlowContainer + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = 100, + Children = new[] + { + participants = new OsuSpriteText + { + TextSize = 30, + Font = @"Exo2.0-Bold" + }, + participantsSlash = new OsuSpriteText + { + Text = @"/", + TextSize = 30, + Font = @"Exo2.0-Light" + }, + maxParticipants = new OsuSpriteText + { + TextSize = 30, + Font = @"Exo2.0-Light" + }, + }, + }, + name = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + TextSize = 30, + }, + }, + }, + }, + }, + statusStrip = new Box + { + RelativeSizeAxes = Axes.X, + Height = 5, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"28242d"), + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Padding = content_padding, + Spacing = new Vector2(0f, 5f), + Children = new Drawable[] + { + status = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = 100, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + rulesetContainer = new Container + { + Size = new Vector2(30f), + }, + new Container //todo: game type icon + { + Size = new Vector2(30f), + CornerRadius = 15f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"545454"), + }, + }, + }, + new Container + { + AutoSizeAxes = Axes.X, + Height = 30f, + Margin = new MarginPadding { Left = 5 }, + Children = new[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + beatmapTitle = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + }, + beatmapDash = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + }, + beatmapArtist = new OsuSpriteText + { + Font = @"Exo2.0-RegularItalic", + }, + }, + }, + beatmapAuthor = new OsuSpriteText + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + TextSize = 14, + }, + }, + }, + }, + }, + }, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = content_padding, + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + Height = 15f, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = "Level Range ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + Text = "6251", + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }, + }, + }, + }, + participantsScroll = new ScrollContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Top = content_padding.Top, Left = 38, Right = 37 }, + Children = new[] + { + participantsFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + LayoutDuration = 100, + Spacing = new Vector2(5f), + }, + }, + }, + }; + + nameBind.ValueChanged += displayName; + hostBind.ValueChanged += displayUser; + maxParticipantsBind.ValueChanged += displayMaxParticipants; + participantsBind.ValueChanged += displayParticipants; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures, RulesetDatabase rulesets) + { + this.localisation = localisation; + this.colours = colours; + + beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + + cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); + + rulesetContainer.Add(new DifficultyIcon(new BeatmapInfo + { + Ruleset = rulesets.GetRuleset(0), + StarDifficulty = 3.7, + }) { Size = new Vector2(30f) }); + + //binded here instead of ctor because dependencies are needed + statusBind.ValueChanged += displayStatus; + beatmapBind.ValueChanged += displayBeatmap; + + statusBind.TriggerChange(); + beatmapBind.TriggerChange(); + } + + protected override void Update() + { + base.Update(); + + participantsScroll.Height = DrawHeight - topFlow.DrawHeight; + } + + private void displayName(string value) + { + name.Text = value; + } + + private void displayUser(User value) + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + + private void displayStatus(RoomStatus value) + { + if (value == null) return; + status.Text = value.Message; + + foreach (Drawable d in new Drawable[] { statusStrip, status }) + d.FadeColour(value.GetAppropriateColour(colours), 100); + } + + private void displayBeatmap(BeatmapInfo value) + { + if (value != null) + { + rulesetContainer.FadeIn(100); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(rulesetContainer.DrawHeight), + } + }; + + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); + beatmapDash.Text = @" - "; + beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); + beatmapAuthor.Text = $"mapped by {value.Metadata.Author}"; + } + else + { + rulesetContainer.FadeOut(100); + + beatmapTitle.Current = null; + beatmapArtist.Current = null; + + beatmapTitle.Text = "Changing map"; + beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty; + } + } + + private void displayMaxParticipants(int? value) + { + if (value == null) + { + participantsSlash.FadeOut(100); + maxParticipants.FadeOut(100); + } + else + { + participantsSlash.FadeIn(100); + maxParticipants.FadeIn(100); + maxParticipants.Text = value.ToString(); + } + } + + private void displayParticipants(User[] value) + { + participants.Text = value.Length.ToString(); + + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + + participantsFlow.Children = value.Select(u => new UserTile(u)); + } + + private class UserTile : Container, IHasTooltip + { + private readonly User user; + + public string TooltipText => user.Username; + + public UserTile(User user) + { + this.user = user; + Size = new Vector2(70f); + CornerRadius = 5f; + Masking = true; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"27252d"), + }, + new UpdateableAvatar + { + RelativeSizeAxes = Axes.Both, + User = user, + }, + }; + } + } + } +} diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 93933c8fe9..8c5ab29736 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -22,6 +22,10 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); + public int GlobalRank; + + public int CountryRank; + //public Team Team; [JsonProperty(@"profile_colour")] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0ec0624978..d233d1e28b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -452,6 +452,7 @@ + From 774d37a05897d68fab316f7c3ca322f69e37e10b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:13:05 -0300 Subject: [PATCH 02/13] Add transition_duration, remove testing DifficultyIcon --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 1471e2ed26..485ebf63b0 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -25,6 +25,7 @@ namespace osu.Game.Screens.Multiplayer public class RoomInspector : Container { private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + private const float transition_duration = 100; private readonly FillFlowContainer topFlow; private readonly Box statusStrip; @@ -113,7 +114,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutDuration = 100, + LayoutDuration = transition_duration, Children = new[] { participants = new OsuSpriteText @@ -178,7 +179,7 @@ namespace osu.Game.Screens.Multiplayer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutDuration = 100, + LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { @@ -349,7 +350,7 @@ namespace osu.Game.Screens.Multiplayer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - LayoutDuration = 100, + LayoutDuration = transition_duration, Spacing = new Vector2(5f), }, }, @@ -363,7 +364,7 @@ namespace osu.Game.Screens.Multiplayer } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures, RulesetDatabase rulesets) + private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures) { this.localisation = localisation; this.colours = colours; @@ -373,12 +374,6 @@ namespace osu.Game.Screens.Multiplayer cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); - rulesetContainer.Add(new DifficultyIcon(new BeatmapInfo - { - Ruleset = rulesets.GetRuleset(0), - StarDifficulty = 3.7, - }) { Size = new Vector2(30f) }); - //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += displayBeatmap; @@ -411,14 +406,14 @@ namespace osu.Game.Screens.Multiplayer status.Text = value.Message; foreach (Drawable d in new Drawable[] { statusStrip, status }) - d.FadeColour(value.GetAppropriateColour(colours), 100); + d.FadeColour(value.GetAppropriateColour(colours), transition_duration); } private void displayBeatmap(BeatmapInfo value) { if (value != null) { - rulesetContainer.FadeIn(100); + rulesetContainer.FadeIn(transition_duration); rulesetContainer.Children = new[] { new DifficultyIcon(value) @@ -434,7 +429,7 @@ namespace osu.Game.Screens.Multiplayer } else { - rulesetContainer.FadeOut(100); + rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; @@ -448,13 +443,13 @@ namespace osu.Game.Screens.Multiplayer { if (value == null) { - participantsSlash.FadeOut(100); - maxParticipants.FadeOut(100); + participantsSlash.FadeOut(transition_duration); + maxParticipants.FadeOut(transition_duration); } else { - participantsSlash.FadeIn(100); - maxParticipants.FadeIn(100); + participantsSlash.FadeIn(transition_duration); + maxParticipants.FadeIn(transition_duration); maxParticipants.Text = value.ToString(); } } From 5d6534031e72cd271cab797d1fae631baecd8627 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:35:37 -0300 Subject: [PATCH 03/13] Proper cover loading --- .../Tests/TestCaseRoomInspector.cs | 8 ++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 43 +++++++++++++------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 8ec1f66f8b..ac685d8b99 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -35,6 +35,10 @@ namespace osu.Desktop.VisualTests.Tests Artist = @"Maaya Sakamoto", Author = @"uwutm8", }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, + }, }; room.MaxParticipants.Value = 200; room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, @@ -79,6 +83,10 @@ namespace osu.Desktop.VisualTests.Tests Artist = @"FREEDOM DIVE", Author = @"Nakagawa-Kanon", }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, + }, }; newRoom.MaxParticipants.Value = 10; newRoom.Participants.Value = new[] diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 485ebf63b0..4c706cc630 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -27,15 +27,11 @@ namespace osu.Game.Screens.Multiplayer private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; - private readonly FillFlowContainer topFlow; private readonly Box statusStrip; + private readonly Container coverContainer, rulesetContainer, flagContainer; + private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; - private readonly Sprite cover; - private readonly FillFlowContainer levelRangeContainer; private readonly ScrollContainer participantsScroll; - private readonly FillFlowContainer participantsFlow; - private readonly Container rulesetContainer; - private readonly Container flagContainer; private Bindable nameBind = new Bindable(); private Bindable hostBind = new Bindable(); @@ -46,6 +42,7 @@ namespace osu.Game.Screens.Multiplayer private OsuColour colours; private LocalisationEngine localisation; + private TextureStore textures; private Room room; public Room Room @@ -91,11 +88,21 @@ namespace osu.Game.Screens.Multiplayer Masking = true, Children = new Drawable[] { - cover = new Sprite + new Container { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + coverContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }, }, new Box { @@ -368,12 +375,11 @@ namespace osu.Game.Screens.Multiplayer { this.localisation = localisation; this.colours = colours; + this.textures = textures; beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; host.Colour = colours.Blue; - cover.Texture = textures.Get(@"https://a.pomf.cat/mvduor.png"); - //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; beatmapBind.ValueChanged += displayBeatmap; @@ -413,6 +419,18 @@ namespace osu.Game.Screens.Multiplayer { if (value != null) { + coverContainer.FadeIn(transition_duration); + coverContainer.Children = new[] + { + new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + }) { RelativeSizeAxes = Axes.Both } + }; + rulesetContainer.FadeIn(transition_duration); rulesetContainer.Children = new[] { @@ -429,6 +447,7 @@ namespace osu.Game.Screens.Multiplayer } else { + coverContainer.FadeOut(transition_duration); rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; From b97691100f94bc9f5ff5c63e7ce307b8577ead15 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 19:53:06 -0300 Subject: [PATCH 04/13] Add ruleset_height to remove magic numbers --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 4c706cc630..7f0cf409d2 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -26,6 +26,7 @@ namespace osu.Game.Screens.Multiplayer { private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; + private const float ruleset_height = 30; private readonly Box statusStrip; private readonly Container coverContainer, rulesetContainer, flagContainer; @@ -192,11 +193,11 @@ namespace osu.Game.Screens.Multiplayer { rulesetContainer = new Container { - Size = new Vector2(30f), + Size = new Vector2(ruleset_height), }, new Container //todo: game type icon { - Size = new Vector2(30f), + Size = new Vector2(ruleset_height), CornerRadius = 15f, Masking = true, Children = new[] @@ -211,7 +212,7 @@ namespace osu.Game.Screens.Multiplayer new Container { AutoSizeAxes = Axes.X, - Height = 30f, + Height = ruleset_height, Margin = new MarginPadding { Left = 5 }, Children = new[] { @@ -436,7 +437,7 @@ namespace osu.Game.Screens.Multiplayer { new DifficultyIcon(value) { - Size = new Vector2(rulesetContainer.DrawHeight), + Size = new Vector2(ruleset_height), } }; From d331aa3b301bb4b374d3663c72587f17566ba42f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 20:02:05 -0300 Subject: [PATCH 05/13] Fix random layout animations when loaded --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 7f0cf409d2..c771777d27 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -185,7 +185,8 @@ namespace osu.Game.Screens.Multiplayer }, new FillFlowContainer { - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.X, + Height = ruleset_height, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), @@ -212,7 +213,7 @@ namespace osu.Game.Screens.Multiplayer new Container { AutoSizeAxes = Axes.X, - Height = ruleset_height, + RelativeSizeAxes = Axes.Y, Margin = new MarginPadding { Left = 5 }, Children = new[] { @@ -389,9 +390,9 @@ namespace osu.Game.Screens.Multiplayer beatmapBind.TriggerChange(); } - protected override void Update() + protected override void UpdateAfterChildren() { - base.Update(); + base.UpdateAfterChildren(); participantsScroll.Height = DrawHeight - topFlow.DrawHeight; } From 9e01074852a5b4bd78357522e62f797cb3d63b77 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 21:41:20 -0300 Subject: [PATCH 06/13] Add GameType and DrawableGameType --- .../Tests/TestCaseRoomInspector.cs | 3 + osu.Game/Online/Multiplayer/GameType.cs | 127 ++++++++++++++++++ osu.Game/Online/Multiplayer/Room.cs | 1 + .../Screens/Multiplayer/DrawableGameType.cs | 43 ++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 29 ++-- osu.Game/osu.Game.csproj | 2 + 6 files changed, 193 insertions(+), 12 deletions(-) create mode 100644 osu.Game/Online/Multiplayer/GameType.cs create mode 100644 osu.Game/Screens/Multiplayer/DrawableGameType.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index ac685d8b99..7ec78cd136 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -25,6 +25,7 @@ namespace osu.Desktop.VisualTests.Tests room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); + room.Type.Value = new GameTypeTeamVersus(); room.Beatmap.Value = new BeatmapInfo { StarDifficulty = 3.7, @@ -59,6 +60,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change type", () => room.Type.Value = new GameTypeTag()); AddStep(@"change beatmap", () => room.Beatmap.Value = null); AddStep(@"change max participants", () => room.MaxParticipants.Value = null); AddStep(@"change participants", () => room.Participants.Value = new[] @@ -73,6 +75,7 @@ namespace osu.Desktop.VisualTests.Tests newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); + newRoom.Type.Value = new GameTypeTagTeam(); newRoom.Beatmap.Value = new BeatmapInfo { StarDifficulty = 7.07, diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs new file mode 100644 index 0000000000..0b9633a752 --- /dev/null +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -0,0 +1,127 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Online.Multiplayer +{ + public abstract class GameType + { + public abstract string Name { get; } + public abstract Drawable GetIcon(OsuColour colours, float size); + } + + public class GameTypeTag : GameType + { + public override string Name => "Tag"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_refresh, + TextSize = size, + Colour = colours.Blue, + Shadow = false, + UseFullGlyphHeight = false, + }; + } + } + + public class GameTypeVersus : GameType + { + public override string Name => "Versus"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + } + } + + public class GameTypeTagTeam : GameType + { + public override string Name => "Tag Team"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + } + } + + public class GameTypeTeamVersus : GameType + { + public override string Name => "Team Versus"; + public override Drawable GetIcon(OsuColour colours, float size) + { + return new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2f), + Children = new[] + { + new VersusRow(colours.Blue, colours.Pink, size * 0.5f), + new VersusRow(colours.Blue, colours.Pink, size * 0.5f), + }, + }; + } + } + + internal class VersusRow : FillFlowContainer + { + public VersusRow(Color4 first, Color4 second, float size) + { + var triangle_size = new Vector2(size); + AutoSizeAxes = Axes.Both; + Spacing = new Vector2(2f, 0f); + + Children = new[] + { + new Container + { + Size = triangle_size, + Colour = first, + Children = new[] + { + new EquilateralTriangle + { + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Rotation = 90, + EdgeSmoothness = new Vector2(1f), + }, + }, + }, + new Container + { + Size = triangle_size, + Colour = second, + Children = new[] + { + new EquilateralTriangle + { + Anchor = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Rotation = -90, + EdgeSmoothness = new Vector2(1f), + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index fe3378f4a6..26b9dbc88a 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,6 +12,7 @@ namespace osu.Game.Online.Multiplayer public Bindable Name = new Bindable(); public Bindable Host = new Bindable(); public Bindable Status = new Bindable(); + public Bindable Type = new Bindable(); public Bindable Beatmap = new Bindable(); public Bindable MaxParticipants = new Bindable(); public Bindable Participants = new Bindable(); diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs new file mode 100644 index 0000000000..6e7458b3dc --- /dev/null +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Online.Multiplayer; + +namespace osu.Game.Screens.Multiplayer +{ + public class DrawableGameType : CircularContainer, IHasTooltip + { + private readonly GameType type; + + public string TooltipText => type.Name; + + public DrawableGameType(GameType type) + { + this.type = type; + Masking = true; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"545454"), + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Add(type.GetIcon(colours, Height / 2)); + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index c771777d27..89b71bf9b9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer private const float ruleset_height = 30; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, flagContainer; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer; private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; private readonly ScrollContainer participantsScroll; @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Multiplayer private Bindable nameBind = new Bindable(); private Bindable hostBind = new Bindable(); private Bindable statusBind = new Bindable(); + private Bindable typeBind = new Bindable(); private Bindable beatmapBind = new Bindable(); private Bindable maxParticipantsBind = new Bindable(); private Bindable participantsBind = new Bindable(); @@ -57,6 +58,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.BindTo(Room.Name); hostBind.BindTo(Room.Host); statusBind.BindTo(Room.Status); + typeBind.BindTo(Room.Type); beatmapBind.BindTo(Room.Beatmap); maxParticipantsBind.BindTo(Room.MaxParticipants); participantsBind.BindTo(Room.Participants); @@ -196,19 +198,9 @@ namespace osu.Game.Screens.Multiplayer { Size = new Vector2(ruleset_height), }, - new Container //todo: game type icon + gameTypeContainer = new Container { Size = new Vector2(ruleset_height), - CornerRadius = 15f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"545454"), - }, - }, }, new Container { @@ -384,9 +376,11 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; + typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); + typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -417,6 +411,17 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), transition_duration); } + private void displayGameType(GameType value) + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(ruleset_height), + }, + }; + } + private void displayBeatmap(BeatmapInfo value) { if (value != null) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d233d1e28b..5e673e0477 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -453,6 +453,8 @@ + + From 185a4c4d2e65dbf7c669f2fa5845d875b681ac15 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:00:27 -0300 Subject: [PATCH 07/13] Unused usings --- osu.Game/Screens/Multiplayer/DrawableGameType.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs index 6e7458b3dc..ccc98c3ccd 100644 --- a/osu.Game/Screens/Multiplayer/DrawableGameType.cs +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; From 7ba32f20215d6e24132db952e1911e5426c84572 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:11:45 -0300 Subject: [PATCH 08/13] Cleanup --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 89b71bf9b9..6b68c396c9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -196,11 +196,11 @@ namespace osu.Game.Screens.Multiplayer { rulesetContainer = new Container { - Size = new Vector2(ruleset_height), + AutoSizeAxes = Axes.Both, }, gameTypeContainer = new Container { - Size = new Vector2(ruleset_height), + AutoSizeAxes = Axes.Both, }, new Container { @@ -263,7 +263,7 @@ namespace osu.Game.Screens.Multiplayer Width = 22f, RelativeSizeAxes = Axes.Y, }, - new Container + new Container //todo: team banners { Width = 38f, RelativeSizeAxes = Axes.Y, @@ -399,12 +399,17 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + flagContainer.Children = new[] + { + new DrawableFlag(value.Country?.FlagName ?? @"__") + { + RelativeSizeAxes = Axes.Both, + }, + }; } private void displayStatus(RoomStatus value) { - if (value == null) return; status.Text = value.Message; foreach (Drawable d in new Drawable[] { statusStrip, status }) From a483422b44e430162a505c9fcea698a9f94c52c3 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:23:00 -0300 Subject: [PATCH 09/13] CI fixes --- osu.Game/Online/Multiplayer/GameType.cs | 6 ++--- osu.Game/Screens/Multiplayer/RoomInspector.cs | 22 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs index 0b9633a752..2f4c92d289 100644 --- a/osu.Game/Online/Multiplayer/GameType.cs +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -85,7 +85,7 @@ namespace osu.Game.Online.Multiplayer { public VersusRow(Color4 first, Color4 second, float size) { - var triangle_size = new Vector2(size); + var triangleSize = new Vector2(size); AutoSizeAxes = Axes.Both; Spacing = new Vector2(2f, 0f); @@ -93,7 +93,7 @@ namespace osu.Game.Online.Multiplayer { new Container { - Size = triangle_size, + Size = triangleSize, Colour = first, Children = new[] { @@ -108,7 +108,7 @@ namespace osu.Game.Online.Multiplayer }, new Container { - Size = triangle_size, + Size = triangleSize, Colour = second, Children = new[] { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 6b68c396c9..fc4c1e1159 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Multiplayer { public class RoomInspector : Container { - private readonly MarginPadding content_padding = new MarginPadding { Horizontal = 20, Vertical = 10 }; + private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; private const float ruleset_height = 30; @@ -34,13 +34,13 @@ namespace osu.Game.Screens.Multiplayer private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; private readonly ScrollContainer participantsScroll; - private Bindable nameBind = new Bindable(); - private Bindable hostBind = new Bindable(); - private Bindable statusBind = new Bindable(); - private Bindable typeBind = new Bindable(); - private Bindable beatmapBind = new Bindable(); - private Bindable maxParticipantsBind = new Bindable(); - private Bindable participantsBind = new Bindable(); + private readonly Bindable nameBind = new Bindable(); + private readonly Bindable hostBind = new Bindable(); + private readonly Bindable statusBind = new Bindable(); + private readonly Bindable typeBind = new Bindable(); + private readonly Bindable beatmapBind = new Bindable(); + private readonly Bindable maxParticipantsBind = new Bindable(); + private readonly Bindable participantsBind = new Bindable(); private OsuColour colours; private LocalisationEngine localisation; @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Padding = content_padding, + Padding = contentPadding, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { @@ -247,7 +247,7 @@ namespace osu.Game.Screens.Multiplayer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = content_padding, + Padding = contentPadding, Children = new Drawable[] { new FillFlowContainer @@ -344,7 +344,7 @@ namespace osu.Game.Screens.Multiplayer Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Padding = new MarginPadding { Top = content_padding.Top, Left = 38, Right = 37 }, + Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 }, Children = new[] { participantsFlow = new FillFlowContainer From ecece2bc29f0874ccd5be1d720f37f3140f7949d Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:28:15 -0300 Subject: [PATCH 10/13] "Use" object initializers in visual test --- osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 7ec78cd136..0e3ed7c1a9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room(); + var room = new Room { }; room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); @@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room(); + var newRoom = new Room { }; newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); From e708cdf41a3d1e8be0e2cff41892d752577da097 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 30 May 2017 22:34:02 -0300 Subject: [PATCH 11/13] Level Range -> Range Range, don't use empty object initializers --- osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs | 4 ++-- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 0e3ed7c1a9..7ec78cd136 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room { }; + var room = new Room(); room.Name.Value = @"My Awesome Room"; room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; room.Status.Value = new RoomStatusOpen(); @@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room { }; + var newRoom = new Room(); newRoom.Name.Value = @"My New, Better Than Ever Room"; newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; newRoom.Status.Value = new RoomStatusOpen(); diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index fc4c1e1159..25a4740698 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -304,7 +304,7 @@ namespace osu.Game.Screens.Multiplayer { new OsuSpriteText { - Text = "Level Range ", + Text = "Rank Range ", TextSize = 14, }, new OsuSpriteText From 1a8f207db32c1ea14241285b1cedc7b4a4cb706a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 22:14:56 +0900 Subject: [PATCH 12/13] Code formatting --- .../Tests/TestCaseRoomInspector.cs | 21 +++++++++++-------- osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index 7ec78cd136..c5fac3afe8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -23,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests var room = new Room(); room.Name.Value = @"My Awesome Room"; - room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }}; + room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } }; room.Status.Value = new RoomStatusOpen(); room.Type.Value = new GameTypeTeamVersus(); room.Beatmap.Value = new BeatmapInfo @@ -42,12 +42,15 @@ namespace osu.Desktop.VisualTests.Tests }, }; room.MaxParticipants.Value = 200; - room.Participants.Value = new[] { new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, - new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, - new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, - new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, - new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }}; + room.Participants.Value = new[] + { + new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + }; RoomInspector inspector; Add(inspector = new RoomInspector @@ -58,7 +61,7 @@ namespace osu.Desktop.VisualTests.Tests }); AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above"); - AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" }}); + AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }); AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying()); AddStep(@"change type", () => room.Type.Value = new GameTypeTag()); AddStep(@"change beatmap", () => room.Beatmap.Value = null); @@ -73,7 +76,7 @@ namespace osu.Desktop.VisualTests.Tests { var newRoom = new Room(); newRoom.Name.Value = @"My New, Better Than Ever Room"; - newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }}; + newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } }; newRoom.Status.Value = new RoomStatusOpen(); newRoom.Type.Value = new GameTypeTagTeam(); newRoom.Beatmap.Value = new BeatmapInfo diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index b7eca2dc8a..2181f37be9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -48,6 +48,7 @@ namespace osu.Game.Screens.Multiplayer private TextureStore textures; private Room room; + public Room Room { get { return room; } From f314f5f7ea8aa5f0c93f9475f7c8dfb0f83acc79 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Jun 2017 22:34:36 +0900 Subject: [PATCH 13/13] CI fixes --- .../Tests/TestCaseRoomInspector.cs | 110 ++++++++++-------- 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index c5fac3afe8..beb664e7ff 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -21,35 +21,43 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - var room = new Room(); - room.Name.Value = @"My Awesome Room"; - room.Host.Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } }; - room.Status.Value = new RoomStatusOpen(); - room.Type.Value = new GameTypeTeamVersus(); - room.Beatmap.Value = new BeatmapInfo + var room = new Room { - StarDifficulty = 3.7, - Ruleset = rulesets.GetRuleset(3), - Metadata = new BeatmapMetadata + Name = { Value = @"My Awesome Room" }, + Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTeamVersus() }, + Beatmap = { - Title = @"Platina", - Artist = @"Maaya Sakamoto", - Author = @"uwutm8", + Value = new BeatmapInfo + { + StarDifficulty = 3.7, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Platina", + Artist = @"Maaya Sakamoto", + Author = @"uwutm8", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, + }, + } }, - OnlineInfo = new BeatmapOnlineInfo + MaxParticipants = { Value = 200 }, + Participants = { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" }, - }, - }; - room.MaxParticipants.Value = 200; - room.Participants.Value = new[] - { - new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, - new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, - new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, - new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, - new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + Value = new[] + { + new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, + new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, + new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, + new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, + new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } + } + } }; RoomInspector inspector; @@ -74,32 +82,40 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change room", () => { - var newRoom = new Room(); - newRoom.Name.Value = @"My New, Better Than Ever Room"; - newRoom.Host.Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } }; - newRoom.Status.Value = new RoomStatusOpen(); - newRoom.Type.Value = new GameTypeTagTeam(); - newRoom.Beatmap.Value = new BeatmapInfo + var newRoom = new Room { - StarDifficulty = 7.07, - Ruleset = rulesets.GetRuleset(0), - Metadata = new BeatmapMetadata + Name = { Value = @"My New, Better Than Ever Room" }, + Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = { - Title = @"xi", - Artist = @"FREEDOM DIVE", - Author = @"Nakagawa-Kanon", + Value = new BeatmapInfo + { + StarDifficulty = 7.07, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"xi", + Artist = @"FREEDOM DIVE", + Author = @"Nakagawa-Kanon", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, + }, + } }, - OnlineInfo = new BeatmapOnlineInfo + MaxParticipants = { Value = 10 }, + Participants = { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" }, - }, - }; - newRoom.MaxParticipants.Value = 10; - newRoom.Participants.Value = new[] - { - new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, - new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, - new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + Value = new[] + { + new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, + new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, + new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } + } + } }; inspector.Room = newRoom;