From d89f9590ea5d86bde2a07ebedacb107671c860e0 Mon Sep 17 00:00:00 2001 From: Naeferith Date: Sat, 4 Mar 2017 23:48:28 +0100 Subject: [PATCH 01/32] Visual test for lobby room panels --- .../Tests/TestCaseMultiRoomPanel.cs | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs new file mode 100644 index 0000000000..0ef0e39b1b --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs @@ -0,0 +1,71 @@ +// 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.Screens.Testing; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Select; +using osu.Game.Screens.Multiplayer; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseMultiRoomPanel : TestCase + { + private MultiRoomPanel test; + private FlowContainer panelContainer; + public override string Name => @"MultiRoomPanel"; + public override string Description => @"Select your favourite room"; + + private void action(int action) + { + switch (action) + { + case 0: + if (test.Status == 0) test.Status = 1; + else test.Status = 0; + break; + } + } + + public override void Reset() + { + base.Reset(); + + AddButton(@"ChangeState", () => action(0)); + + Add(panelContainer = new FlowContainer //Positionning container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Direction = FlowDirections.Vertical, + Size = new Vector2(0.4f, 0.5f), + Children = new Drawable[] + { + test = new MultiRoomPanel("Great Room Right Here", "Naeferith", 0), + new MultiRoomPanel("Relax it's the weekend", "Someone", 1), + } + }); + } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + foreach (MultiRoomPanel panel in panelContainer.Children) + { + panel.BorderThickness = 0; + if (panel.Clicked == true) + { + panel.BorderThickness = 3; + panel.Clicked = false; + } + } + return base.OnMouseUp(state, args); + } + } +} From 89a443fb9261ccc63e788f5646127e910e627a7a Mon Sep 17 00:00:00 2001 From: Naeferith Date: Sat, 4 Mar 2017 23:49:47 +0100 Subject: [PATCH 02/32] Lobby's Room Panel --- .../Screens/Multiplayer/MultiRoomPanel.cs | 261 ++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 osu.Game/Screens/Multiplayer/MultiRoomPanel.cs diff --git a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs new file mode 100644 index 0000000000..386b9217e3 --- /dev/null +++ b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs @@ -0,0 +1,261 @@ +// 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.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Multiplayer +{ + public class MultiRoomPanel : ClickableContainer + { + private bool didClick; + private string roomName; + private string hostName; + + private int roomStatus; + private Color4 statusColour; + private string statusString; + + private Box sideSprite; + private OsuSpriteText hostSprite; + private OsuSpriteText statusSprite; + private OsuSpriteText roomSprite; + + public const int BORDER_SIZE = 3; + public const int PANEL_HEIGHT = 90; + + + public Color4 ColourFree = new Color4(166, 204, 0, 255); + public Color4 ColourBusy = new Color4(135, 102, 237, 255); + + public int CONTENT_PADDING = 5; + + public bool Clicked + { + get { return didClick; } + set + { + didClick = value; + } + } + + public int Status + { + get { return roomStatus; } + set + { + roomStatus = value; + if (roomStatus == 0) + { + statusColour = ColourFree; + statusString = "Welcoming Players"; + + UpdatePanel(this); + } + else + { + statusColour = ColourBusy; + statusString = "Now Playing"; + + UpdatePanel(this); + } + } + } + + public void UpdatePanel(MultiRoomPanel panel) + { + panel.BorderColour = statusColour; + panel.sideSprite.Colour = statusColour; + + statusSprite.Colour = statusColour; + statusSprite.Text = statusString; + } + + public MultiRoomPanel(string matchName = "Room Name", string host = "Undefined", int status = 0) + { + roomName = matchName; + hostName = host; + roomStatus = status; + + if (status == 0) + { + statusColour = ColourFree; + statusString = "Welcoming Players"; + } + else + { + statusColour = ColourBusy; + statusString = "Now Playing"; + } + + RelativeSizeAxes = Axes.X; + Height = PANEL_HEIGHT; + Masking = true; + CornerRadius = 5; + BorderThickness = 0; + BorderColour = statusColour; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(40), + Radius = 5, + }; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(34,34,34, 255), + }, + sideSprite = new Box + { + RelativeSizeAxes = Axes.Y, + Width = 5, + Colour = statusColour, + }, + /*new Box //Beatmap img + { + + },*/ + new Background(@"Backgrounds/bg4") + { + RelativeSizeAxes = Axes.Both, + } + , + new FlowContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Direction = FlowDirections.Vertical, + Size = new Vector2(0.75f,1), + + Children = new Drawable[] + { + roomSprite = new OsuSpriteText + { + Text = roomName, + TextSize = 18, + Margin = new MarginPadding { Top = CONTENT_PADDING }, + }, + new FlowContainer + { + RelativeSizeAxes = Axes.X, + Height = 20, + Direction = FlowDirections.Horizontal, + Spacing = new Vector2(5,0), + Children = new Drawable[] + { + + + new Container + { + Masking = true, + CornerRadius = 5, + Width = 30, + Height = 20, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Gray, + } + } + + }, + new Container + { + Masking = true, + CornerRadius = 5, + Width = 40, + Height = 20, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(173,56,126,255), + } + } + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + hostSprite = new OsuSpriteText + { + Text = hostName, + Font = @"Exo2.0-Bold", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Shear = new Vector2(0.1f,0), + Colour = new Color4(69,179,222,255), + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#6895 - #50024", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Margin = new MarginPadding { Left = 80 }, + Colour = new Color4(153,153,153,255), + } + } + }, + statusSprite = new OsuSpriteText + { + Text = statusString, + TextSize = 14, + Font = @"Exo2.0-Bold", + Colour = statusColour, + Margin = new MarginPadding { Top = 10 } + }, + new FlowContainer + { + RelativeSizeAxes = Axes.X, + Direction = FlowDirections.Horizontal, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Platina", + Font = @"Exo2.0-Bold", + TextSize = 14, + Shear = new Vector2(0.1f,0), + Colour = new Color4(153,153,153,255), + }, + new OsuSpriteText + { + Text = " - " + "Maaya Sakamoto", + TextSize = 14, + Shear = new Vector2(0.1f,0), + Colour = new Color4(153,153,153,255), + } + } + }, + } + }, + }; + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + BorderThickness = 3; + didClick = true; + return base.OnMouseUp(state, args); + } + } +} \ No newline at end of file From 2a269dbc5afa9a630eedaed10c573901526ef56b Mon Sep 17 00:00:00 2001 From: Naeferith Date: Fri, 28 Apr 2017 10:57:59 +0200 Subject: [PATCH 03/32] Remove unsused variable + IStateful Implementation --- .../Screens/Multiplayer/MultiRoomPanel.cs | 68 +++++++++++-------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs index 386b9217e3..174ec19f75 100644 --- a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs +++ b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs @@ -1,8 +1,9 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; @@ -14,8 +15,35 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Multiplayer { - public class MultiRoomPanel : ClickableContainer + public class MultiRoomPanel : ClickableContainer, IStateful { + private PanelState state; + public PanelState State + { + get { return state; } + set + { + if (state == value) + return; + + state = value; + switch (state) + { + case PanelState.Free: + statusColour = ColourFree; + statusString = "Welcoming Players"; + UpdatePanel(this); + break; + + case PanelState.Busy: + statusColour = ColourBusy; + statusString = "Now Playing"; + UpdatePanel(this); + break; + } + } + } + private bool didClick; private string roomName; private string hostName; @@ -29,15 +57,12 @@ namespace osu.Game.Screens.Multiplayer private OsuSpriteText statusSprite; private OsuSpriteText roomSprite; - public const int BORDER_SIZE = 3; public const int PANEL_HEIGHT = 90; - + public const int CONTENT_PADDING = 5; public Color4 ColourFree = new Color4(166, 204, 0, 255); public Color4 ColourBusy = new Color4(135, 102, 237, 255); - public int CONTENT_PADDING = 5; - public bool Clicked { get { return didClick; } @@ -47,29 +72,6 @@ namespace osu.Game.Screens.Multiplayer } } - public int Status - { - get { return roomStatus; } - set - { - roomStatus = value; - if (roomStatus == 0) - { - statusColour = ColourFree; - statusString = "Welcoming Players"; - - UpdatePanel(this); - } - else - { - statusColour = ColourBusy; - statusString = "Now Playing"; - - UpdatePanel(this); - } - } - } - public void UpdatePanel(MultiRoomPanel panel) { panel.BorderColour = statusColour; @@ -257,5 +259,11 @@ namespace osu.Game.Screens.Multiplayer didClick = true; return base.OnMouseUp(state, args); } + + public enum PanelState + { + Free, + Busy + } } -} \ No newline at end of file +} From bf6c1705411178b545effba584820eecaa0666bd Mon Sep 17 00:00:00 2001 From: Naeferith Date: Fri, 28 Apr 2017 10:59:34 +0200 Subject: [PATCH 04/32] IStateful implementation --- osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs index 0ef0e39b1b..29cc4481a9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; @@ -28,8 +28,7 @@ namespace osu.Desktop.VisualTests.Tests switch (action) { case 0: - if (test.Status == 0) test.Status = 1; - else test.Status = 0; + test.State = test.State == MultiRoomPanel.PanelState.Free ? MultiRoomPanel.PanelState.Busy : MultiRoomPanel.PanelState.Free; break; } } From bc980b60ac1d762b593f0e14daaf352b58ec1b0b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sun, 21 May 2017 22:36:46 -0300 Subject: [PATCH 05/32] Add files to project, update with framework changes --- .../Tests/TestCaseMultiRoomPanel.cs | 12 ++++++------ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Screens/Multiplayer/MultiRoomPanel.cs | 14 +++++++------- osu.Game/osu.Game.csproj | 1 + 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs index 29cc4481a9..a6dbcda8f9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs @@ -3,7 +3,6 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework.Screens.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select; using osu.Game.Screens.Multiplayer; @@ -13,14 +12,15 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; +using osu.Framework.Testing; namespace osu.Desktop.VisualTests.Tests { class TestCaseMultiRoomPanel : TestCase { private MultiRoomPanel test; - private FlowContainer panelContainer; - public override string Name => @"MultiRoomPanel"; + private FillFlowContainer panelContainer; + public override string Description => @"Select your favourite room"; private void action(int action) @@ -37,14 +37,14 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - AddButton(@"ChangeState", () => action(0)); + AddStep(@"ChangeState", () => action(0)); - Add(panelContainer = new FlowContainer //Positionning container + Add(panelContainer = new FillFlowContainer //Positionning container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Vertical, Size = new Vector2(0.4f, 0.5f), Children = new Drawable[] { diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 135e4596c7..a2228ca9aa 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -217,6 +217,7 @@ + diff --git a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs index 174ec19f75..cbc4cc1182 100644 --- a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs +++ b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs @@ -4,12 +4,12 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; -using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -132,12 +132,12 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.Both, } , - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Direction = FlowDirections.Vertical, + Direction = FillDirection.Vertical, Size = new Vector2(0.75f,1), Children = new Drawable[] @@ -148,11 +148,11 @@ namespace osu.Game.Screens.Multiplayer TextSize = 18, Margin = new MarginPadding { Top = CONTENT_PADDING }, }, - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, Height = 20, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Horizontal, Spacing = new Vector2(5,0), Children = new Drawable[] { @@ -225,10 +225,10 @@ namespace osu.Game.Screens.Multiplayer Colour = statusColour, Margin = new MarginPadding { Top = 10 } }, - new FlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, - Direction = FlowDirections.Horizontal, + Direction = FillDirection.Horizontal, Children = new Drawable[] { new OsuSpriteText diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2a1195135a..6cc05bf327 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -427,6 +427,7 @@ + From e5ee7096f8a37e7b1dd205eeee7184ae34e0dcca Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 00:07:15 -0300 Subject: [PATCH 06/32] Initial cleanup --- .../Tests/TestCaseDrawableMultiplayerRoom.cs | 60 ++++ .../Tests/TestCaseMultiRoomPanel.cs | 70 ----- .../osu.Desktop.VisualTests.csproj | 2 +- .../Online/Multiplayer/MultiplayerRoom.cs | 26 ++ .../Multiplayer/DrawableMultiplayerRoom.cs | 215 ++++++++++++++ .../Screens/Multiplayer/MultiRoomPanel.cs | 269 ------------------ osu.Game/osu.Game.csproj | 6 +- 7 files changed, 307 insertions(+), 341 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs delete mode 100644 osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs create mode 100644 osu.Game/Online/Multiplayer/MultiplayerRoom.cs create mode 100644 osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs delete mode 100644 osu.Game/Screens/Multiplayer/MultiRoomPanel.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs new file mode 100644 index 0000000000..c9a0dfa280 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs @@ -0,0 +1,60 @@ +// 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.Game.Graphics.UserInterface; +using osu.Game.Screens.Select; +using osu.Game.Screens.Multiplayer; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; +using osu.Framework.Testing; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; +using osu.Game.Database; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseDrawableMultiplayerRoom : TestCase + { + public override string Description => @"Select your favourite room"; + + public override void Reset() + { + base.Reset(); + + DrawableMultiplayerRoom p; + Add(new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Y, + Width = 500f, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + p = new DrawableMultiplayerRoom(new MultiplayerRoom + { + Name = @"Great Room Right Here", + Host = new User { Username = @"Naeferith", Country = new Country { FlagName = @"FR" }}, + Status = MultiplayerRoomStatus.Open, + CurrentBeatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, + }), + new DrawableMultiplayerRoom(new MultiplayerRoom + { + Name = @"Relax It's The Weekend", + Host = new User{ Username = @"Someone", Country = new Country { FlagName = @"CA" }}, + Status = MultiplayerRoomStatus.Playing, + CurrentBeatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }, + }), + } + }); + + AddStep(@"change state", () => { p.Room.Status = MultiplayerRoomStatus.Playing; }); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs deleted file mode 100644 index a6dbcda8f9..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCaseMultiRoomPanel.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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.Game.Graphics.UserInterface; -using osu.Game.Screens.Select; -using osu.Game.Screens.Multiplayer; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Graphics.Sprites; -using osu.Framework.Testing; - -namespace osu.Desktop.VisualTests.Tests -{ - class TestCaseMultiRoomPanel : TestCase - { - private MultiRoomPanel test; - private FillFlowContainer panelContainer; - - public override string Description => @"Select your favourite room"; - - private void action(int action) - { - switch (action) - { - case 0: - test.State = test.State == MultiRoomPanel.PanelState.Free ? MultiRoomPanel.PanelState.Busy : MultiRoomPanel.PanelState.Free; - break; - } - } - - public override void Reset() - { - base.Reset(); - - AddStep(@"ChangeState", () => action(0)); - - Add(panelContainer = new FillFlowContainer //Positionning container - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Direction = FillDirection.Vertical, - Size = new Vector2(0.4f, 0.5f), - Children = new Drawable[] - { - test = new MultiRoomPanel("Great Room Right Here", "Naeferith", 0), - new MultiRoomPanel("Relax it's the weekend", "Someone", 1), - } - }); - } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - foreach (MultiRoomPanel panel in panelContainer.Children) - { - panel.BorderThickness = 0; - if (panel.Clicked == true) - { - panel.BorderThickness = 3; - panel.Clicked = false; - } - } - return base.OnMouseUp(state, args); - } - } -} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 2374b07bf3..fa507527aa 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -220,7 +220,7 @@ - + diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoom.cs b/osu.Game/Online/Multiplayer/MultiplayerRoom.cs new file mode 100644 index 0000000000..5c9e72bcf2 --- /dev/null +++ b/osu.Game/Online/Multiplayer/MultiplayerRoom.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; +using osu.Game.Database; +using osu.Game.Users; + +namespace osu.Game.Online.Multiplayer +{ + public class MultiplayerRoom + { + public string Name { get; set; } + public User Host { get; set; } + public MultiplayerRoomStatus Status { get; set; } + public BeatmapMetadata CurrentBeatmap { get; set; } + } + + public enum MultiplayerRoomStatus + { + [Description(@"Welcoming Players")] + Open, + + [Description(@"Now Playing")] + Playing, + } +} diff --git a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs new file mode 100644 index 0000000000..2c0e7db1db --- /dev/null +++ b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs @@ -0,0 +1,215 @@ +// 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; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Multiplayer; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class DrawableMultiplayerRoom : ClickableContainer + { + private const float content_padding = 5; + private const float height = 90; + + private readonly Box sideStrip; + private readonly OsuSpriteText status; + private readonly OsuSpriteText host; + private readonly OsuSpriteText rankBounds; + private readonly FillFlowContainer beatmapInfoFlow; + private readonly OsuSpriteText beatmapTitle; + private readonly OsuSpriteText beatmapArtist; + + private Color4 openColour; + private Color4 playingColour; + + public readonly MultiplayerRoom Room; + + public DrawableMultiplayerRoom(MultiplayerRoom room) + { + Room = room; + + RelativeSizeAxes = Axes.X; + Height = height; + CornerRadius = 5; + Masking = true; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(40), + Radius = 5, + }; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(34), + }, + new Background(@"Backgrounds/bg4") + { + RelativeSizeAxes = Axes.Both, + }, + sideStrip = new Box + { + RelativeSizeAxes = Axes.Y, + Width = 5, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = content_padding, Bottom = content_padding * 2, Left = Height + content_padding * 2, Right = content_padding }, + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(5f), + Children = new Drawable[] + { + new OsuSpriteText + { + Text = Room.Name, + TextSize = 18, + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = 20f, + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + new DrawableFlag(Room.Host?.Country?.FlagName ?? "__") + { + Width = 30f, + RelativeSizeAxes = Axes.Y, + }, + new Container + { + Width = 40f, + RelativeSizeAxes = Axes.Y, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = Room.Host?.Username ?? @"", + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + rankBounds = new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = "#6895 - #50024", + TextSize = 14, + Margin = new MarginPadding { Right = 10 }, + }, + }, + }, + }, + }, + new FillFlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + status = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + beatmapInfoFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Children = new[] + { + beatmapTitle = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + new OsuSpriteText + { + Text = @" - ", + TextSize = 14, + Font = @"Exo2.0-RegularItalic", + }, + beatmapArtist = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-RegularItalic", + }, + }, + }, + }, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, LocalisationEngine localisation) + { + openColour = colours.GreenLight; + playingColour = colours.Purple; + beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9; + host.Colour = colours.Blue; + + if (Room.CurrentBeatmap != null) + { + beatmapTitle.Current = localisation.GetUnicodePreference(Room.CurrentBeatmap.TitleUnicode, Room.CurrentBeatmap.Title); + beatmapArtist.Current = localisation.GetUnicodePreference(Room.CurrentBeatmap.ArtistUnicode, Room.CurrentBeatmap.Artist); + } + + updateStatus(); + } + + private void updateStatus() + { + if (Room == null) return; + + status.Text = Room.Status.GetDescription(); + + foreach (Drawable d in new Drawable[] { sideStrip, status }) + d.FadeColour(Room.Status == MultiplayerRoomStatus.Playing? playingColour : openColour); + } + } +} diff --git a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs b/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs deleted file mode 100644 index cbc4cc1182..0000000000 --- a/osu.Game/Screens/Multiplayer/MultiRoomPanel.cs +++ /dev/null @@ -1,269 +0,0 @@ -// 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; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; - -namespace osu.Game.Screens.Multiplayer -{ - public class MultiRoomPanel : ClickableContainer, IStateful - { - private PanelState state; - public PanelState State - { - get { return state; } - set - { - if (state == value) - return; - - state = value; - switch (state) - { - case PanelState.Free: - statusColour = ColourFree; - statusString = "Welcoming Players"; - UpdatePanel(this); - break; - - case PanelState.Busy: - statusColour = ColourBusy; - statusString = "Now Playing"; - UpdatePanel(this); - break; - } - } - } - - private bool didClick; - private string roomName; - private string hostName; - - private int roomStatus; - private Color4 statusColour; - private string statusString; - - private Box sideSprite; - private OsuSpriteText hostSprite; - private OsuSpriteText statusSprite; - private OsuSpriteText roomSprite; - - public const int PANEL_HEIGHT = 90; - public const int CONTENT_PADDING = 5; - - public Color4 ColourFree = new Color4(166, 204, 0, 255); - public Color4 ColourBusy = new Color4(135, 102, 237, 255); - - public bool Clicked - { - get { return didClick; } - set - { - didClick = value; - } - } - - public void UpdatePanel(MultiRoomPanel panel) - { - panel.BorderColour = statusColour; - panel.sideSprite.Colour = statusColour; - - statusSprite.Colour = statusColour; - statusSprite.Text = statusString; - } - - public MultiRoomPanel(string matchName = "Room Name", string host = "Undefined", int status = 0) - { - roomName = matchName; - hostName = host; - roomStatus = status; - - if (status == 0) - { - statusColour = ColourFree; - statusString = "Welcoming Players"; - } - else - { - statusColour = ColourBusy; - statusString = "Now Playing"; - } - - RelativeSizeAxes = Axes.X; - Height = PANEL_HEIGHT; - Masking = true; - CornerRadius = 5; - BorderThickness = 0; - BorderColour = statusColour; - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(40), - Radius = 5, - }; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(34,34,34, 255), - }, - sideSprite = new Box - { - RelativeSizeAxes = Axes.Y, - Width = 5, - Colour = statusColour, - }, - /*new Box //Beatmap img - { - - },*/ - new Background(@"Backgrounds/bg4") - { - RelativeSizeAxes = Axes.Both, - } - , - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Direction = FillDirection.Vertical, - Size = new Vector2(0.75f,1), - - Children = new Drawable[] - { - roomSprite = new OsuSpriteText - { - Text = roomName, - TextSize = 18, - Margin = new MarginPadding { Top = CONTENT_PADDING }, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - Height = 20, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5,0), - Children = new Drawable[] - { - - - new Container - { - Masking = true, - CornerRadius = 5, - Width = 30, - Height = 20, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Gray, - } - } - - }, - new Container - { - Masking = true, - CornerRadius = 5, - Width = 40, - Height = 20, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(173,56,126,255), - } - } - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - hostSprite = new OsuSpriteText - { - Text = hostName, - Font = @"Exo2.0-Bold", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Shear = new Vector2(0.1f,0), - Colour = new Color4(69,179,222,255), - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#6895 - #50024", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Margin = new MarginPadding { Left = 80 }, - Colour = new Color4(153,153,153,255), - } - } - }, - statusSprite = new OsuSpriteText - { - Text = statusString, - TextSize = 14, - Font = @"Exo2.0-Bold", - Colour = statusColour, - Margin = new MarginPadding { Top = 10 } - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "Platina", - Font = @"Exo2.0-Bold", - TextSize = 14, - Shear = new Vector2(0.1f,0), - Colour = new Color4(153,153,153,255), - }, - new OsuSpriteText - { - Text = " - " + "Maaya Sakamoto", - TextSize = 14, - Shear = new Vector2(0.1f,0), - Colour = new Color4(153,153,153,255), - } - } - }, - } - }, - }; - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - BorderThickness = 3; - didClick = true; - return base.OnMouseUp(state, args); - } - - public enum PanelState - { - Free, - Busy - } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f96bbaa08a..d773e0c093 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -428,7 +428,8 @@ - + + @@ -451,6 +452,9 @@ + + + - \ No newline at end of file + From 800a31947014ee6bb9c77a95eb782f6ac4f057d6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 01:08:35 -0300 Subject: [PATCH 09/32] Remove newline --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2b0a6435bc..27bcb8fa39 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -457,4 +457,4 @@ --> - + \ No newline at end of file From 26bf9dd64bfdceb7df4bf162ee21ee519a0947ec Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 01:13:51 -0300 Subject: [PATCH 10/32] Remove unused Background --- osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs index 4a746226d8..97efef2968 100644 --- a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs @@ -64,10 +64,6 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(34), }, - new Background(@"Backgrounds/bg4") - { - RelativeSizeAxes = Axes.Both, - }, sideStrip = new Box { RelativeSizeAxes = Axes.Y, From d1df89584437c5d3cb4af3c3424d62485506fe00 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 01:16:59 -0300 Subject: [PATCH 11/32] Unused using --- osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs index 97efef2968..37182cb692 100644 --- a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; using osu.Game.Users; From 87cdf5aac61fcf3a609823b556344218be1798cb Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 01:29:39 -0300 Subject: [PATCH 12/32] CI fixes --- .../Tests/TestCaseDrawableMultiplayerRoom.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs index a358fd6701..1c6c0d6420 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs @@ -1,25 +1,17 @@ // 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.Game.Graphics.UserInterface; -using osu.Game.Screens.Select; -using osu.Game.Screens.Multiplayer; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics; using osu.Framework.Testing; +using osu.Game.Screens.Multiplayer; using osu.Game.Online.Multiplayer; using osu.Game.Users; using osu.Game.Database; namespace osu.Desktop.VisualTests.Tests { - class TestCaseDrawableMultiplayerRoom : TestCase + internal class TestCaseDrawableMultiplayerRoom : TestCase { public override string Description => @"Select your favourite room"; From 6cef3021c7f0a3e5fcc8694adc40e08b149c6b86 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 19:50:01 +0900 Subject: [PATCH 13/32] Adjust sizing to better fit glows within the playfield. --- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 4 ++-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 9f91488fe3..6d3a9e79f6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { Type = EdgeEffectType.Glow, Colour = AccentColour, - Radius = KiaiMode ? 50 : 8 + Radius = KiaiMode ? 40 : 8 }; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 6a6353fde2..816c5042ce 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -13,12 +13,12 @@ namespace osu.Game.Rulesets.Taiko.Objects /// /// Diameter of a circle relative to the size of the . /// - public const float PLAYFIELD_RELATIVE_DIAMETER = 0.5f; + public const float PLAYFIELD_RELATIVE_DIAMETER = 0.45f; /// /// Scale multiplier for a strong circle. /// - public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.5f; + public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.4f; /// /// Default circle diameter. diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 2278158506..d1d895fc1d 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// /// The default play field height. /// - public const float DEFAULT_PLAYFIELD_HEIGHT = 168f; + public const float DEFAULT_PLAYFIELD_HEIGHT = 178f; /// /// The offset from which the center of the hit target lies at. @@ -221,7 +221,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// /// This is a very special type of container. It serves a similar purpose to , however unlike , /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. - /// + /// /// /// By adjusting the scale relative to the height of its parent, the aspect ratio of this container's children is maintained, however this is undesirable /// in the case where the hit object container should not have its width adjusted by scale. To counteract this, another container is nested inside this From 03f6cded8463a75cf762d8661c13e840ee349ccc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:44:58 -0300 Subject: [PATCH 14/32] MultiplayerRoom -> Room --- ...wableMultiplayerRoom.cs => TestCaseDrawableRoom.cs} | 8 ++++---- osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 2 +- .../Online/Multiplayer/{MultiplayerRoom.cs => Room.cs} | 2 +- .../{DrawableMultiplayerRoom.cs => DrawableRoom.cs} | 10 +++++----- osu.Game/osu.Game.csproj | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseDrawableMultiplayerRoom.cs => TestCaseDrawableRoom.cs} (89%) rename osu.Game/Online/Multiplayer/{MultiplayerRoom.cs => Room.cs} (91%) rename osu.Game/Screens/Multiplayer/{DrawableMultiplayerRoom.cs => DrawableRoom.cs} (95%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs similarity index 89% rename from osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs rename to osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 1c6c0d6420..8150de9fb8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableMultiplayerRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -11,7 +11,7 @@ using osu.Game.Database; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseDrawableMultiplayerRoom : TestCase + internal class TestCaseDrawableRoom : TestCase { public override string Description => @"Select your favourite room"; @@ -19,7 +19,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - DrawableMultiplayerRoom p; + DrawableRoom p; Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -29,14 +29,14 @@ namespace osu.Desktop.VisualTests.Tests Direction = FillDirection.Vertical, Children = new Drawable[] { - p = new DrawableMultiplayerRoom(new MultiplayerRoom + p = new DrawableRoom(new Room { Name = @"Great Room Right Here", Host = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}, Status = MultiplayerRoomStatus.Open, CurrentBeatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, }), - new DrawableMultiplayerRoom(new MultiplayerRoom + new DrawableRoom(new Room { Name = @"Relax It's The Weekend", Host = new User{ Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}, diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index fa507527aa..6e6f0a691d 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -220,7 +220,7 @@ - + diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoom.cs b/osu.Game/Online/Multiplayer/Room.cs similarity index 91% rename from osu.Game/Online/Multiplayer/MultiplayerRoom.cs rename to osu.Game/Online/Multiplayer/Room.cs index 5c9e72bcf2..9def99386d 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoom.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -7,7 +7,7 @@ using osu.Game.Users; namespace osu.Game.Online.Multiplayer { - public class MultiplayerRoom + public class Room { public string Name { get; set; } public User Host { get; set; } diff --git a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs similarity index 95% rename from osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs rename to osu.Game/Screens/Multiplayer/DrawableRoom.cs index 37182cb692..4a7622b888 100644 --- a/osu.Game/Screens/Multiplayer/DrawableMultiplayerRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -18,7 +18,7 @@ using osu.Game.Users; namespace osu.Game.Screens.Multiplayer { - public class DrawableMultiplayerRoom : ClickableContainer + public class DrawableRoom : ClickableContainer { private const float content_padding = 5; private const float height = 90; @@ -39,11 +39,11 @@ namespace osu.Game.Screens.Multiplayer private Color4 playingColour; private LocalisationEngine localisation; - public readonly Bindable Room; + public readonly Bindable Room; - public DrawableMultiplayerRoom(MultiplayerRoom room) + public DrawableRoom(Room room) { - Room = new Bindable(room); + Room = new Bindable(room); RelativeSizeAxes = Axes.X; Height = height; @@ -206,7 +206,7 @@ namespace osu.Game.Screens.Multiplayer Room.TriggerChange(); } - private void displayRoom(MultiplayerRoom room) + private void displayRoom(Room room) { name.Text = room.Name; status.Text = room.Status.GetDescription(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 27bcb8fa39..7af7bdf1e6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -425,8 +425,8 @@ - - + + From 2c16d9c3a7531d7397117719a0cd6e8e5b04befd Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:45:40 -0300 Subject: [PATCH 15/32] CurrentBeatmap -> Beatmap --- osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs | 6 +++--- osu.Game/Online/Multiplayer/Room.cs | 2 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 8150de9fb8..2a10be8906 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -34,14 +34,14 @@ namespace osu.Desktop.VisualTests.Tests Name = @"Great Room Right Here", Host = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}, Status = MultiplayerRoomStatus.Open, - CurrentBeatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, + Beatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, }), new DrawableRoom(new Room { Name = @"Relax It's The Weekend", Host = new User{ Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}, Status = MultiplayerRoomStatus.Playing, - CurrentBeatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }, + Beatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }, }), } }); @@ -66,7 +66,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change beatmap", () => { - p.Room.Value.CurrentBeatmap = null; + p.Room.Value.Beatmap = null; p.Room.TriggerChange(); }); diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 9def99386d..56ac71f6f9 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,7 +12,7 @@ namespace osu.Game.Online.Multiplayer public string Name { get; set; } public User Host { get; set; } public MultiplayerRoomStatus Status { get; set; } - public BeatmapMetadata CurrentBeatmap { get; set; } + public BeatmapMetadata Beatmap { get; set; } } public enum MultiplayerRoomStatus diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 4a7622b888..b33100c900 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -214,11 +214,11 @@ namespace osu.Game.Screens.Multiplayer flagContainer.Children = new[] { new DrawableFlag(room.Host.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; avatar.User = room.Host; - if (room.CurrentBeatmap != null) + if (room.Beatmap != null) { - beatmapTitle.Current = localisation.GetUnicodePreference(room.CurrentBeatmap.TitleUnicode, room.CurrentBeatmap.Title); + beatmapTitle.Current = localisation.GetUnicodePreference(room.Beatmap.TitleUnicode, room.Beatmap.Title); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(room.CurrentBeatmap.ArtistUnicode, room.CurrentBeatmap.Artist); + beatmapArtist.Current = localisation.GetUnicodePreference(room.Beatmap.ArtistUnicode, room.Beatmap.Artist); } else { From 65df2d2b70d262691a01cf424c74ebe95b1c4841 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:46:41 -0300 Subject: [PATCH 16/32] MultiplayerRoomStatus -> RoomStatus --- osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs | 8 ++++---- osu.Game/Online/Multiplayer/Room.cs | 4 ++-- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 2a10be8906..08034ee4ae 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -33,14 +33,14 @@ namespace osu.Desktop.VisualTests.Tests { Name = @"Great Room Right Here", Host = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}, - Status = MultiplayerRoomStatus.Open, + Status = RoomStatus.Open, Beatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, }), new DrawableRoom(new Room { Name = @"Relax It's The Weekend", Host = new User{ Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}, - Status = MultiplayerRoomStatus.Playing, + Status = RoomStatus.Playing, Beatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }, }), } @@ -48,7 +48,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change state", () => { - p.Room.Value.Status = MultiplayerRoomStatus.Playing; + p.Room.Value.Status = RoomStatus.Playing; p.Room.TriggerChange(); }); @@ -72,7 +72,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change state", () => { - p.Room.Value.Status = MultiplayerRoomStatus.Open; + p.Room.Value.Status = RoomStatus.Open; p.Room.TriggerChange(); }); } diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 56ac71f6f9..12df7dc61c 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -11,11 +11,11 @@ namespace osu.Game.Online.Multiplayer { public string Name { get; set; } public User Host { get; set; } - public MultiplayerRoomStatus Status { get; set; } + public RoomStatus Status { get; set; } public BeatmapMetadata Beatmap { get; set; } } - public enum MultiplayerRoomStatus + public enum RoomStatus { [Description(@"Welcoming Players")] Open, diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index b33100c900..db7dcb1a60 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -231,7 +231,7 @@ namespace osu.Game.Screens.Multiplayer } foreach (Drawable d in new Drawable[] { sideStrip, status }) - d.FadeColour(room.Status == MultiplayerRoomStatus.Playing? playingColour : openColour, 100); + d.FadeColour(room.Status == RoomStatus.Playing? playingColour : openColour, 100); } } } From 25b457e994947b6549fca71bf0b76ae3585714fe Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 13:05:18 -0300 Subject: [PATCH 17/32] Proper Bindable usage --- .../Tests/TestCaseDrawableRoom.cs | 44 ++++++++--------- osu.Game/Online/Multiplayer/Room.cs | 9 ++-- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 47 ++++++++++++------- 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 08034ee4ae..4164e27195 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -19,7 +19,8 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - DrawableRoom p; + DrawableRoom first; + DrawableRoom second; Add(new FillFlowContainer { Anchor = Anchor.Centre, @@ -29,51 +30,44 @@ namespace osu.Desktop.VisualTests.Tests Direction = FillDirection.Vertical, Children = new Drawable[] { - p = new DrawableRoom(new Room - { - Name = @"Great Room Right Here", - Host = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }}, - Status = RoomStatus.Open, - Beatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" }, - }), - new DrawableRoom(new Room - { - Name = @"Relax It's The Weekend", - Host = new User{ Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }}, - Status = RoomStatus.Playing, - Beatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }, - }), + first = new DrawableRoom(new Room()), + second = new DrawableRoom(new Room()), } }); + 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 = RoomStatus.Open; + first.Room.Beatmap.Value = 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 = RoomStatus.Playing; + second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }; + AddStep(@"change state", () => { - p.Room.Value.Status = RoomStatus.Playing; - p.Room.TriggerChange(); + first.Room.Status.Value = RoomStatus.Playing; }); AddStep(@"change name", () => { - p.Room.Value.Name = @"I Changed Name"; - p.Room.TriggerChange(); + first.Room.Name.Value = @"I Changed Name"; }); AddStep(@"change host", () => { - p.Room.Value.Host = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }; - p.Room.TriggerChange(); + first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }; }); AddStep(@"change beatmap", () => { - p.Room.Value.Beatmap = null; - p.Room.TriggerChange(); + first.Room.Beatmap.Value = null; }); AddStep(@"change state", () => { - p.Room.Value.Status = RoomStatus.Open; - p.Room.TriggerChange(); + first.Room.Status.Value = RoomStatus.Open; }); } } diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 12df7dc61c..3dacf0862e 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; +using osu.Framework.Configuration; using osu.Game.Database; using osu.Game.Users; @@ -9,10 +10,10 @@ namespace osu.Game.Online.Multiplayer { public class Room { - public string Name { get; set; } - public User Host { get; set; } - public RoomStatus Status { get; set; } - public BeatmapMetadata Beatmap { get; set; } + public Bindable Name = new Bindable(); + public Bindable Host = new Bindable(); + public Bindable Status = new Bindable(); + public Bindable Beatmap = new Bindable(); } public enum RoomStatus diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index db7dcb1a60..5e81c46282 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; @@ -39,11 +40,11 @@ namespace osu.Game.Screens.Multiplayer private Color4 playingColour; private LocalisationEngine localisation; - public readonly Bindable Room; + public readonly Room Room; public DrawableRoom(Room room) { - Room = new Bindable(room); + Room = room; RelativeSizeAxes = Axes.X; Height = height; @@ -190,7 +191,10 @@ namespace osu.Game.Screens.Multiplayer }, }; - Room.ValueChanged += displayRoom; + Room.Name.ValueChanged += displayName; + Room.Host.ValueChanged += displayUser; + Room.Status.ValueChanged += displayStatus; + Room.Beatmap.ValueChanged += displayBeatmap; } [BackgroundDependencyLoader] @@ -203,22 +207,36 @@ namespace osu.Game.Screens.Multiplayer beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9; host.Colour = colours.Blue; - Room.TriggerChange(); + displayStatus(Room.Status.Value); } - private void displayRoom(Room room) + private void displayName(string value) { - name.Text = room.Name; - status.Text = room.Status.GetDescription(); - host.Text = room.Host.Username; - flagContainer.Children = new[] { new DrawableFlag(room.Host.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; - avatar.User = room.Host; + name.Text = value; + } - if (room.Beatmap != null) + private void displayUser(User value) + { + avatar.User = value; + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + + private void displayStatus(RoomStatus value) + { + status.Text = value.GetDescription() ?? value.ToString(); + + foreach (Drawable d in new Drawable[] { sideStrip, status }) + d.FadeColour(value == RoomStatus.Playing ? playingColour : openColour, 100); + } + + private void displayBeatmap(BeatmapMetadata value) + { + if (value != null) { - beatmapTitle.Current = localisation.GetUnicodePreference(room.Beatmap.TitleUnicode, room.Beatmap.Title); + beatmapTitle.Current = localisation.GetUnicodePreference(value.TitleUnicode, value.Title); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(room.Beatmap.ArtistUnicode, room.Beatmap.Artist); + beatmapArtist.Current = localisation.GetUnicodePreference(value.ArtistUnicode, value.Artist); } else { @@ -229,9 +247,6 @@ namespace osu.Game.Screens.Multiplayer beatmapDash.Text = string.Empty; beatmapArtist.Text = string.Empty; } - - foreach (Drawable d in new Drawable[] { sideStrip, status }) - d.FadeColour(room.Status == RoomStatus.Playing? playingColour : openColour, 100); } } } From cf0e7887b57618ca01700b36054929a5b2ebd70f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 13:14:56 -0300 Subject: [PATCH 18/32] Unused using --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 5e81c46282..f3ff88b086 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -4,7 +4,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; From 9798117d53462e9aefea28c67be643ceaa3dbdb0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 21:13:57 -0300 Subject: [PATCH 19/32] Move RoomStatus to a class instead of enum --- .../Tests/TestCaseDrawableRoom.cs | 8 +++--- osu.Game/Online/Multiplayer/Room.cs | 12 +-------- osu.Game/Online/Multiplayer/RoomStatus.cs | 26 +++++++++++++++++++ osu.Game/Screens/Multiplayer/DrawableRoom.cs | 12 ++++----- osu.Game/osu.Game.csproj | 1 + 5 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 osu.Game/Online/Multiplayer/RoomStatus.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 4164e27195..de58323abe 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -37,17 +37,17 @@ 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 = RoomStatus.Open; + first.Room.Status.Value = new RoomStatusOpen(); first.Room.Beatmap.Value = 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 = RoomStatus.Playing; + second.Room.Status.Value = new RoomStatusPlaying(); second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" }; AddStep(@"change state", () => { - first.Room.Status.Value = RoomStatus.Playing; + first.Room.Status.Value = new RoomStatusPlaying(); }); AddStep(@"change name", () => @@ -67,7 +67,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"change state", () => { - first.Room.Status.Value = RoomStatus.Open; + first.Room.Status.Value = new RoomStatusOpen(); }); } } diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 3dacf0862e..c82025f902 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -1,7 +1,6 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel; using osu.Framework.Configuration; using osu.Game.Database; using osu.Game.Users; @@ -15,13 +14,4 @@ namespace osu.Game.Online.Multiplayer public Bindable Status = new Bindable(); public Bindable Beatmap = new Bindable(); } - - public enum RoomStatus - { - [Description(@"Welcoming Players")] - Open, - - [Description(@"Now Playing")] - Playing, - } } diff --git a/osu.Game/Online/Multiplayer/RoomStatus.cs b/osu.Game/Online/Multiplayer/RoomStatus.cs new file mode 100644 index 0000000000..4f943596a7 --- /dev/null +++ b/osu.Game/Online/Multiplayer/RoomStatus.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Game.Graphics; + +namespace osu.Game.Online.Multiplayer +{ + public abstract class RoomStatus + { + public abstract string Message { get; } + public abstract Color4 GetAppropriateColour(OsuColour colours); + } + + public class RoomStatusOpen : RoomStatus + { + public override string Message => @"Welcoming Players"; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.GreenLight; + } + + public class RoomStatusPlaying : RoomStatus + { + public override string Message => @"Now Playing"; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.Purple; + } +} diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index f3ff88b086..e4e781b839 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -4,7 +4,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -35,8 +34,7 @@ namespace osu.Game.Screens.Multiplayer private readonly OsuSpriteText beatmapDash; private readonly OsuSpriteText beatmapArtist; - private Color4 openColour; - private Color4 playingColour; + private OsuColour colours; private LocalisationEngine localisation; public readonly Room Room; @@ -200,9 +198,8 @@ namespace osu.Game.Screens.Multiplayer private void load(OsuColour colours, LocalisationEngine localisation) { this.localisation = localisation; + this.colours = colours; - openColour = colours.GreenLight; - playingColour = colours.Purple; beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9; host.Colour = colours.Blue; @@ -223,10 +220,11 @@ namespace osu.Game.Screens.Multiplayer private void displayStatus(RoomStatus value) { - status.Text = value.GetDescription() ?? value.ToString(); + if (value == null) return; + status.Text = value.Message; foreach (Drawable d in new Drawable[] { sideStrip, status }) - d.FadeColour(value == RoomStatus.Playing ? playingColour : openColour, 100); + d.FadeColour(value.GetAppropriateColour(colours), 100); } private void displayBeatmap(BeatmapMetadata value) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7af7bdf1e6..2d2894cdca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -427,6 +427,7 @@ + From 61348ff08d7269f1e4752a79d00f9e81e34ab7a0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 16:42:17 +0900 Subject: [PATCH 20/32] Restructure playfield so that various elements are masked. --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 49 +++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index d1d895fc1d..e6677ff0cd 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -44,10 +44,12 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Container hitObjectContainer; private readonly Container topLevelHitContainer; - private readonly Container leftBackgroundContainer; - private readonly Container rightBackgroundContainer; - private readonly Box leftBackground; - private readonly Box rightBackground; + + private readonly Container overlayBackgroundContainer; + private readonly Container backgroundContainer; + + private readonly Box overlayBackground; + private readonly Box background; public TaikoPlayfield() { @@ -59,7 +61,7 @@ namespace osu.Game.Rulesets.Taiko.UI Height = DEFAULT_PLAYFIELD_HEIGHT, Children = new[] { - rightBackgroundContainer = new Container + backgroundContainer = new Container { Name = "Transparent playfield background", RelativeSizeAxes = Axes.Both, @@ -73,7 +75,7 @@ namespace osu.Game.Rulesets.Taiko.UI }, Children = new Drawable[] { - rightBackground = new Box + background = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.6f @@ -82,16 +84,17 @@ namespace osu.Game.Rulesets.Taiko.UI }, new Container { - Name = "Transparent playfield elements", + Name = "Right area", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = left_area_size }, + Margin = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { new Container { - Name = "Hit target container", - X = hit_target_offset, + Name = "Masked elements", RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = hit_target_offset }, + Masking = true, Children = new Drawable[] { hitExplosionContainer = new Container @@ -114,23 +117,25 @@ namespace osu.Game.Rulesets.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - judgementContainer = new Container - { - RelativeSizeAxes = Axes.Y, - BlendingMode = BlendingMode.Additive - }, - }, + } + }, + judgementContainer = new Container + { + Name = "Judgements", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = hit_target_offset }, + BlendingMode = BlendingMode.Additive }, } }, - leftBackgroundContainer = new Container + overlayBackgroundContainer = new Container { Name = "Left overlay", Size = new Vector2(left_area_size, DEFAULT_PLAYFIELD_HEIGHT), BorderThickness = 1, Children = new Drawable[] { - leftBackground = new Box + overlayBackground = new Box { RelativeSizeAxes = Axes.Both, }, @@ -164,11 +169,11 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - leftBackgroundContainer.BorderColour = colours.Gray0; - leftBackground.Colour = colours.Gray1; + overlayBackgroundContainer.BorderColour = colours.Gray0; + overlayBackground.Colour = colours.Gray1; - rightBackgroundContainer.BorderColour = colours.Gray1; - rightBackground.Colour = colours.Gray0; + backgroundContainer.BorderColour = colours.Gray1; + background.Colour = colours.Gray0; } public override void Add(DrawableHitObject h) From 25a48d832f2ec71e52b3df4a894d3026714a31ae Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 17:36:35 +0900 Subject: [PATCH 21/32] Make kiai time hit object pulse on bar line beats. --- osu-framework | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 15 +++++++++++++++ .../Objects/Drawables/Pieces/TaikoPiece.cs | 8 +++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/osu-framework b/osu-framework index 773d60eb6b..71177efb0c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 773d60eb6b811f395e32a22dc66bb4d2e63a6dbc +Subproject commit 71177efb0c416361e4b346a92dd61ab20bf333d0 diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 6d3a9e79f6..f182eb6993 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -7,6 +7,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; +using osu.Game.Beatmaps.ControlPoints; +using osu.Framework.Audio.Track; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { @@ -148,5 +150,18 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces Radius = KiaiMode ? 40 : 8 }; } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + if (!effectPoint.KiaiMode) + return; + + if (beatIndex % (int)timingPoint.TimeSignature != 0) + return; + + background.FadeEdgeEffectTo(Color4.White); + using (BeginDelayedSequence(200)) + background.FadeEdgeEffectTo(AccentColour, 500, EasingTypes.OutQuint); + } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index 83b2e59e44..d54bfe9e17 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -5,10 +5,11 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics.Containers; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { - public class TaikoPiece : Container, IHasAccentColour + public class TaikoPiece : BeatSyncedContainer, IHasAccentColour { private Color4 accentColour; /// @@ -17,10 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public virtual Color4 AccentColour { get { return accentColour; } - set - { - accentColour = value; - } + set { accentColour = value; } } private bool kiaiMode; From ae94e6ea85007142089bbb61efb1c91612009650 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 17:57:34 +0900 Subject: [PATCH 22/32] Redesign hit explosions. --- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 35 +++++++++----------- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 20 +++++------ 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 2ebdeaa5b0..57cc42643b 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -16,23 +16,25 @@ namespace osu.Game.Rulesets.Taiko.UI /// /// A circle explodes from the hit target to indicate a hitobject has been hit. /// - internal class HitExplosion : CircularContainer + internal class HitExplosion : Container { - /// - /// The judgement this hit explosion visualises. - /// public readonly TaikoJudgement Judgement; private readonly Box innerFill; - public HitExplosion(TaikoJudgement judgement) + private bool isRim; + + public HitExplosion(TaikoJudgement judgement, bool isRim) { + this.isRim = isRim; + Judgement = judgement; - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); + RelativeSizeAxes = Axes.Y; + Width = TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_CIRCLE_DIAMETER; - Anchor = Anchor.Centre; - Origin = Anchor.Centre; + Anchor = Anchor.CentreLeft; + Origin = Anchor.CentreLeft; RelativePositionAxes = Axes.Both; @@ -54,22 +56,17 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - switch (Judgement.TaikoResult) - { - case TaikoHitResult.Good: - innerFill.Colour = colours.Green; - break; - case TaikoHitResult.Great: - innerFill.Colour = colours.Blue; - break; - } + if (isRim) + innerFill.Colour = colours.BlueDarker; + else + innerFill.Colour = colours.PinkDarker; } protected override void LoadComplete() { base.LoadComplete(); - ScaleTo(5f, 1000, EasingTypes.OutQuint); + ScaleTo(new Vector2(2f, 1), 1000, EasingTypes.OutQuint); FadeOut(500); Expire(); @@ -80,7 +77,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(Size * TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE, 50); + ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER, 1), 50); } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index e6677ff0cd..d6b2b26b7c 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// /// The offset from which the center of the hit target lies at. /// - private const float hit_target_offset = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40; + public const float HIT_TARGET_OFFSET = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40; /// /// The size of the left area of the playfield. This area contains the input drum. @@ -89,21 +89,19 @@ namespace osu.Game.Rulesets.Taiko.UI Margin = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { + hitExplosionContainer = new Container + { + RelativeSizeAxes = Axes.Y, + BlendingMode = BlendingMode.Additive + }, new Container { Name = "Masked elements", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = hit_target_offset }, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Masking = true, Children = new Drawable[] { - hitExplosionContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - BlendingMode = BlendingMode.Additive - }, barLineContainer = new Container { RelativeSizeAxes = Axes.Both, @@ -123,7 +121,7 @@ namespace osu.Game.Rulesets.Taiko.UI { Name = "Judgements", RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = hit_target_offset }, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, BlendingMode = BlendingMode.Additive }, } @@ -217,7 +215,7 @@ namespace osu.Game.Rulesets.Taiko.UI topLevelHitContainer.Add(judgedObject.CreateProxy()); } - hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement, judgedObject is DrawableRimHit)); } else hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); From 92552970757214337f02acb659c457676cf5d6ed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 17:58:12 +0900 Subject: [PATCH 23/32] Cleanup. --- .../Objects/Drawables/Pieces/TaikoPiece.cs | 1 - osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index d54bfe9e17..5e7e9e6350 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 57cc42643b..868f1cd9c0 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Box innerFill; - private bool isRim; + private readonly bool isRim; public HitExplosion(TaikoJudgement judgement, bool isRim) { @@ -56,10 +56,7 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (isRim) - innerFill.Colour = colours.BlueDarker; - else - innerFill.Colour = colours.PinkDarker; + innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker; } protected override void LoadComplete() From 4224143136f4136ada12c60e05f4e2d499051b9c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 14:53:28 +0900 Subject: [PATCH 24/32] Add faint kiai explosion on the hit marker. --- .../UI/KiaiHitExplosion.cs | 68 +++++++++++++++++++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 16 ++++- .../osu.Game.Rulesets.Taiko.csproj | 1 + 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs new file mode 100644 index 0000000000..62e4165ce4 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; + +namespace osu.Game.Rulesets.Taiko.UI +{ + public class KiaiHitExplosion : CircularContainer + { + public readonly TaikoJudgement Judgement; + + private readonly bool isRim; + + public KiaiHitExplosion(TaikoJudgement judgement, bool isRim) + { + this.isRim = isRim; + + Judgement = judgement; + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + RelativeSizeAxes = Axes.Y; + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER, 1); + + Masking = true; + Alpha = 0.15f; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = isRim ? colours.BlueDarker : colours.PinkDarker, + Radius = 60, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); + FadeOut(250); + + Expire(); + } + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index d6b2b26b7c..8f2d89dd05 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Taiko.UI protected override Container Content => hitObjectContainer; private readonly Container hitExplosionContainer; + private readonly Container kiaiExplosionContainer; private readonly Container barLineContainer; private readonly Container judgementContainer; @@ -117,6 +118,13 @@ namespace osu.Game.Rulesets.Taiko.UI }, } }, + kiaiExplosionContainer = new Container + { + Name = "Kiai hit explosions", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + BlendingMode = BlendingMode.Additive + }, judgementContainer = new Container { Name = "Judgements", @@ -207,6 +215,8 @@ namespace osu.Game.Rulesets.Taiko.UI if (!wasHit) return; + bool isRim = judgedObject.HitObject is RimHit; + if (!secondHit) { if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell)) @@ -215,7 +225,11 @@ namespace osu.Game.Rulesets.Taiko.UI topLevelHitContainer.Add(judgedObject.CreateProxy()); } - hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement, judgedObject is DrawableRimHit)); + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement, isRim)); + + if (judgedObject.HitObject.Kiai) + kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject.Judgement, isRim)); + } else hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 983dc72d9e..8d6fcb503c 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -87,6 +87,7 @@ + From 445b469e47fe81acc9a99b2d2f2d375eec4ed1d3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 15:22:46 +0900 Subject: [PATCH 25/32] Use ligher hue instead of white. --- .../Objects/Drawables/DrawableCentreHit.cs | 1 + .../Objects/Drawables/DrawableCentreHitStrong.cs | 1 + osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs | 1 + .../Objects/Drawables/DrawableRimHitStrong.cs | 1 + .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- .../Objects/Drawables/Pieces/TaikoPiece.cs | 5 +++++ 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs index 8bb78669ca..b2760e6914 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.PinkDarker; + MainPiece.KiaiFlashColour = colours.PinkLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs index 434fb9377f..da2e4a5733 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.PinkDarker; + MainPiece.KiaiFlashColour = colours.PinkLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs index 20e8d36105..cd5ceaa965 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.BlueDarker; + MainPiece.KiaiFlashColour = colours.BlueLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs index 4b1bb62bab..c9387f6e72 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.BlueDarker; + MainPiece.KiaiFlashColour = colours.BlueLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index f182eb6993..6118e00e25 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -159,7 +159,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces if (beatIndex % (int)timingPoint.TimeSignature != 0) return; - background.FadeEdgeEffectTo(Color4.White); + background.FadeEdgeEffectTo(KiaiFlashColour); using (BeginDelayedSequence(200)) background.FadeEdgeEffectTo(AccentColour, 500, EasingTypes.OutQuint); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index 5e7e9e6350..9ef9224942 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -20,6 +20,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces set { accentColour = value; } } + /// + /// The colour to be flashed on a kiai beat. + /// + public Color4 KiaiFlashColour; + private bool kiaiMode; /// /// Whether Kiai mode effects are enabled for this circle piece. From c29f4b2ee86385c51b0bae0acbfca382dc9931c1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 15:40:34 +0900 Subject: [PATCH 26/32] Fix weird glow + add small pre-beat transition. --- .../Objects/Drawables/Pieces/CirclePiece.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 6118e00e25..992c10fa99 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public const float SYMBOL_SIZE = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER * 0.45f; public const float SYMBOL_BORDER = 8; public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; + private const double pre_beat_transition_time = 50; /// /// The colour of the inner circle and outer glows. @@ -65,6 +66,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public CirclePiece(bool isStrong = false) { + EarlyActivationMilliseconds = pre_beat_transition_time; + AddInternal(new Drawable[] { background = new CircularContainer @@ -159,9 +162,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces if (beatIndex % (int)timingPoint.TimeSignature != 0) return; - background.FadeEdgeEffectTo(KiaiFlashColour); - using (BeginDelayedSequence(200)) - background.FadeEdgeEffectTo(AccentColour, 500, EasingTypes.OutQuint); + double duration = timingPoint.BeatLength * (int)timingPoint.TimeSignature; + + background.FadeEdgeEffectTo(KiaiFlashColour, pre_beat_transition_time, EasingTypes.OutQuint); + using (background.BeginDelayedSequence(pre_beat_transition_time)) + background.FadeEdgeEffectTo(AccentColour, duration, EasingTypes.OutQuint); } } } \ No newline at end of file From 56fe97a147197bd4cba09a6f462829481fbfef25 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 15:48:27 +0900 Subject: [PATCH 27/32] Make kiai hit explosions slightly more prominent. --- osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index 62e4165ce4..e0da3ed3db 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.UI Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER, 1); Masking = true; - Alpha = 0.15f; + Alpha = 0.25f; Children = new[] { From 7afa1766e17f50507bb93041ff9ca54c5f22c62e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 15:48:47 +0900 Subject: [PATCH 28/32] Make HitExplosion circular again, keep it masked to the stage. --- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 13 ++++++------- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 868f1cd9c0..c0c329c870 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// /// A circle explodes from the hit target to indicate a hitobject has been hit. /// - internal class HitExplosion : Container + internal class HitExplosion : CircularContainer { public readonly TaikoJudgement Judgement; @@ -30,11 +30,10 @@ namespace osu.Game.Rulesets.Taiko.UI Judgement = judgement; - RelativeSizeAxes = Axes.Y; - Width = TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_CIRCLE_DIAMETER; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; - Anchor = Anchor.CentreLeft; - Origin = Anchor.CentreLeft; + Size = new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); RelativePositionAxes = Axes.Both; @@ -63,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - ScaleTo(new Vector2(2f, 1), 1000, EasingTypes.OutQuint); + ScaleTo(3f, 1000, EasingTypes.OutQuint); FadeOut(500); Expire(); @@ -74,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER, 1), 50); + ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 8f2d89dd05..c7bd4a6704 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -90,11 +90,6 @@ namespace osu.Game.Rulesets.Taiko.UI Margin = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { - hitExplosionContainer = new Container - { - RelativeSizeAxes = Axes.Y, - BlendingMode = BlendingMode.Additive - }, new Container { Name = "Masked elements", @@ -103,6 +98,11 @@ namespace osu.Game.Rulesets.Taiko.UI Masking = true, Children = new Drawable[] { + hitExplosionContainer = new Container + { + RelativeSizeAxes = Axes.Y, + BlendingMode = BlendingMode.Additive, + }, barLineContainer = new Container { RelativeSizeAxes = Axes.Both, From 391134b1d3f328640fcb89f3b5d2228b4fc4750b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 17:15:51 +0900 Subject: [PATCH 29/32] Adjust glow a bit --- .../Objects/Drawables/DrawableCentreHit.cs | 1 - .../Objects/Drawables/DrawableCentreHitStrong.cs | 1 - .../Objects/Drawables/DrawableRimHit.cs | 1 - .../Objects/Drawables/DrawableRimHitStrong.cs | 1 - .../Objects/Drawables/Pieces/CirclePiece.cs | 14 ++++++++------ .../Objects/Drawables/Pieces/TaikoPiece.cs | 5 ----- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs index b2760e6914..8bb78669ca 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.PinkDarker; - MainPiece.KiaiFlashColour = colours.PinkLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs index da2e4a5733..434fb9377f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.PinkDarker; - MainPiece.KiaiFlashColour = colours.PinkLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs index cd5ceaa965..20e8d36105 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.BlueDarker; - MainPiece.KiaiFlashColour = colours.BlueLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs index c9387f6e72..4b1bb62bab 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs @@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private void load(OsuColour colours) { MainPiece.AccentColour = colours.BlueDarker; - MainPiece.KiaiFlashColour = colours.BlueLight; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 992c10fa99..3ea05b6558 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public const float SYMBOL_SIZE = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER * 0.45f; public const float SYMBOL_BORDER = 8; public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; - private const double pre_beat_transition_time = 50; + private const double pre_beat_transition_time = 80; /// /// The colour of the inner circle and outer glows. @@ -144,13 +144,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces Content.Width = 1 / Content.Scale.X; } + private const float edge_alpha_kiai = 0.5f; + private void resetEdgeEffects() { background.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = AccentColour, - Radius = KiaiMode ? 40 : 8 + Colour = AccentColour.Opacity(KiaiMode ? edge_alpha_kiai : 1f), + Radius = KiaiMode ? 32 : 8 }; } @@ -162,11 +164,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces if (beatIndex % (int)timingPoint.TimeSignature != 0) return; - double duration = timingPoint.BeatLength * (int)timingPoint.TimeSignature; + double duration = timingPoint.BeatLength * 2; - background.FadeEdgeEffectTo(KiaiFlashColour, pre_beat_transition_time, EasingTypes.OutQuint); + background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint); using (background.BeginDelayedSequence(pre_beat_transition_time)) - background.FadeEdgeEffectTo(AccentColour, duration, EasingTypes.OutQuint); + background.FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index 9ef9224942..5e7e9e6350 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -20,11 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces set { accentColour = value; } } - /// - /// The colour to be flashed on a kiai beat. - /// - public Color4 KiaiFlashColour; - private bool kiaiMode; /// /// Whether Kiai mode effects are enabled for this circle piece. From 0dbb2220e090f5c59723f25c275c23939a047ba6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 21:07:12 +0900 Subject: [PATCH 30/32] Add missing early activation to menu flashes --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 0cf1fa54fa..77239726e8 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -36,6 +36,8 @@ namespace osu.Game.Screens.Menu public MenuSideFlashes() { + EarlyActivationMilliseconds = box_fade_in_time; + RelativeSizeAxes = Axes.Both; Anchor = Anchor.Centre; Origin = Anchor.Centre; From 5cb6963940662f61982dbc43457303b70471b45e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 22:08:14 +0900 Subject: [PATCH 31/32] Make spinners easier for now The underlying spin counting doesn't match stabnle, so they have been near impossible to complete until now. --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index eff60ba935..6ba499739a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -24,6 +24,9 @@ namespace osu.Game.Rulesets.Osu.Objects base.ApplyDefaults(controlPointInfo, difficulty); SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5)); + + // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being. + SpinsRequired = (int)(SpinsRequired * 0.6); } } } From b803e40a7d68d3e996f9d7d2950d6c49fe6eb6df Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 17:02:28 -0300 Subject: [PATCH 32/32] Unbind from room values when disposing --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index e4e781b839..7365963085 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -245,5 +245,15 @@ namespace osu.Game.Screens.Multiplayer beatmapArtist.Text = string.Empty; } } + + protected override void Dispose(bool isDisposing) + { + Room.Name.ValueChanged -= displayName; + Room.Host.ValueChanged -= displayUser; + Room.Status.ValueChanged -= displayStatus; + Room.Beatmap.ValueChanged -= displayBeatmap; + + base.Dispose(isDisposing); + } } }