From d89f9590ea5d86bde2a07ebedacb107671c860e0 Mon Sep 17 00:00:00 2001 From: Naeferith Date: Sat, 4 Mar 2017 23:48:28 +0100 Subject: [PATCH 001/162] 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 002/162] 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 003/162] 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 004/162] 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 9ba356f2c65754785dc151f48e22726117fcc82b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 17 May 2017 05:58:34 -0300 Subject: [PATCH 005/162] Added osu!direct header and filter control --- .../Tests/TestCaseDirect.cs | 27 +++ .../osu.Desktop.VisualTests.csproj | 1 + .../Graphics/UserInterface/OsuDropdown.cs | 2 +- .../Graphics/UserInterface/OsuEnumDropdown.cs | 32 +++ .../Graphics/UserInterface/OsuTabControl.cs | 12 +- osu.Game/OsuGame.cs | 8 + osu.Game/Overlays/Direct/FilterControl.cs | 188 ++++++++++++++++++ osu.Game/Overlays/Direct/Header.cs | 123 ++++++++++++ osu.Game/Overlays/Direct/SortTabControl.cs | 117 +++++++++++ osu.Game/Overlays/DirectOverlay.cs | 89 +++++++++ osu.Game/Screens/Menu/MainMenu.cs | 1 + osu.Game/osu.Game.csproj | 8 + 12 files changed, 601 insertions(+), 7 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseDirect.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs create mode 100644 osu.Game/Overlays/Direct/FilterControl.cs create mode 100644 osu.Game/Overlays/Direct/Header.cs create mode 100644 osu.Game/Overlays/Direct/SortTabControl.cs create mode 100644 osu.Game/Overlays/DirectOverlay.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs new file mode 100644 index 0000000000..8e2e88dd00 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Testing; +using osu.Game.Graphics; +using osu.Game.Overlays; +using osu.Game.Overlays.Dialog; + +namespace osu.Desktop.VisualTests.Tests +{ + public class TestCaseDirect : TestCase + { + public override string Description => @"osu!direct overlay"; + + private DirectOverlay direct; + + public override void Reset() + { + base.Reset(); + + Add(direct = new DirectOverlay()); + + AddStep(@"Toggle", direct.ToggleVisibility); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index dbb1750b72..8ec0fc83db 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -220,6 +220,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 4f286ba7b5..9c1799c04c 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -113,7 +113,7 @@ namespace osu.Game.Graphics.UserInterface } } - protected class OsuDropdownHeader : DropdownHeader + public class OsuDropdownHeader : DropdownHeader { private readonly SpriteText label; protected override string Label diff --git a/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs new file mode 100644 index 0000000000..fe828ca65b --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.ComponentModel; +using System.Reflection; +using System.Collections.Generic; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuEnumDropdown : OsuDropdown + { + public OsuEnumDropdown() + { + if (!typeof(T).IsEnum) + throw new InvalidOperationException("SettingsDropdown only supports enums as the generic type argument"); + + List> items = new List>(); + foreach(var val in (T[])Enum.GetValues(typeof(T))) + { + var field = typeof(T).GetField(Enum.GetName(typeof(T), val)); + items.Add( + new KeyValuePair( + field.GetCustomAttribute()?.Description ?? Enum.GetName(typeof(T), val), + val + ) + ); + } + Items = items; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index a9fad0c739..4bbae4efd1 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -57,9 +57,9 @@ namespace osu.Game.Graphics.UserInterface } } - private class OsuTabItem : TabItem + public class OsuTabItem : TabItem { - private readonly SpriteText text; + protected readonly SpriteText Text; private readonly Box box; private Color4? accentColour; @@ -70,7 +70,7 @@ namespace osu.Game.Graphics.UserInterface { accentColour = value; if (!Active) - text.Colour = value; + Text.Colour = value; } } @@ -94,13 +94,13 @@ namespace osu.Game.Graphics.UserInterface private void fadeActive() { box.FadeIn(transition_length, EasingTypes.OutQuint); - text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + Text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); } private void fadeInactive() { box.FadeOut(transition_length, EasingTypes.OutQuint); - text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); + Text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); } protected override bool OnHover(InputState state) @@ -130,7 +130,7 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - text = new OsuSpriteText + Text = new OsuSpriteText { Margin = new MarginPadding { Top = 5, Bottom = 5 }, Origin = Anchor.BottomLeft, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4cf436a8e4..5bbf28e2ef 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -41,6 +41,8 @@ namespace osu.Game private DialogOverlay dialogOverlay; + private DirectOverlay direct; + private Intro intro { get @@ -70,6 +72,8 @@ namespace osu.Game public void ToggleSettings() => settings.ToggleVisibility(); + public void ToggleDirect() => direct.ToggleVisibility(); + [BackgroundDependencyLoader] private void load() { @@ -160,6 +164,7 @@ namespace osu.Game }); //overlay elements + LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(musicController = new MusicController @@ -249,6 +254,9 @@ namespace osu.Game case Key.O: settings.ToggleVisibility(); return true; + case Key.D: + direct.ToggleVisibility(); + return true; } } diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs new file mode 100644 index 0000000000..9990681024 --- /dev/null +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -0,0 +1,188 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + +using Container = osu.Framework.Graphics.Containers.Container; + +namespace osu.Game.Overlays.Direct +{ + public class FilterControl : Container + { + private readonly Box tabStrip; + private readonly FillFlowContainer modeButtons; + private readonly OsuDropdown rankStatusDropdown; + + public readonly SearchTextBox Search; + + public enum RankStatus + { + Any, + [Description("Ranked & Approved")] + RankedApproved, + Approved, + Loved, + Favourites, + [Description("Mod Requests")] + ModRequests, + Pending, + Graveyard, + [Description("My Maps")] + MyMaps, + } + + protected override bool InternalContains(Vector2 screenSpacePos) => true; + + public FilterControl() + { + RelativeSizeAxes = Axes.X; + //AutoSizeAxes = Axes.Y; + Height = 127; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"384552"), + }, + tabStrip = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Position = new Vector2(0f, 1f), + RelativeSizeAxes = Axes.X, + Height = 1, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Left = DirectOverlay.WIDTH_PADDING, Right = DirectOverlay.WIDTH_PADDING, Top = 10 }, + Spacing = new Vector2(0f, 10f), + Children = new Drawable[] + { + Search = new DirectSearchTextBox + { + RelativeSizeAxes = Axes.X, + }, + modeButtons = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(10f, 0f), + }, + new SortTabControl + { + RelativeSizeAxes = Axes.X, + }, + }, + }, + rankStatusDropdown = new SlimEnumDropdown + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.None, + Margin = new MarginPadding { Top = 93, Bottom = 5, Right = DirectOverlay.WIDTH_PADDING }, //todo: sort of hacky positioning + Width = 160f, + }, + }; + + rankStatusDropdown.Current.Value = RankStatus.RankedApproved; + } + + [BackgroundDependencyLoader(true)] + private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) + { + tabStrip.Colour = colours.Yellow; + rankStatusDropdown.AccentColour = colours.BlueDark; + + foreach (var r in rulesets.AllRulesets) + { + modeButtons.Add(new ModeToggleButton(game?.Ruleset ?? new Bindable(), r)); + } + } + + private class DirectSearchTextBox : SearchTextBox + { + protected override Color4 BackgroundUnfocused => OsuColour.FromHex(@"222222"); + protected override Color4 BackgroundFocused => OsuColour.FromHex(@"222222"); + } + + private class ModeToggleButton : ClickableContainer + { + private TextAwesome icon; + + private RulesetInfo ruleset; + public RulesetInfo Ruleset + { + get { return ruleset; } + set + { + ruleset = value; + icon.Icon = Ruleset.CreateInstance().Icon; + } + } + + private Bindable bindable; + + void Bindable_ValueChanged(RulesetInfo obj) + { + icon.FadeTo((Ruleset == obj) ? 1f : 0.5f, 100); + } + + public ModeToggleButton(Bindable bindable, RulesetInfo ruleset) + { + this.bindable = bindable; + AutoSizeAxes = Axes.Both; + + Children = new[] + { + icon = new TextAwesome + { + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + TextSize = 32, + } + }; + + Ruleset = ruleset; + bindable.ValueChanged += Bindable_ValueChanged; + Bindable_ValueChanged(null); + Action = () => bindable.Value = Ruleset; + } + + protected override void Dispose(bool isDisposing) + { + if (bindable != null) + bindable.ValueChanged -= Bindable_ValueChanged; + base.Dispose(isDisposing); + } + } + + private class SlimEnumDropdown : OsuEnumDropdown + { + protected override DropdownHeader CreateHeader() => new SlimDropdownHeader { AccentColour = AccentColour }; + + private class SlimDropdownHeader : OsuDropdownHeader + { + public SlimDropdownHeader() + { + Height = 25; + Icon.TextSize = 16; + Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4, Left = 8, Right = 4, }; + } + } + } + } +} diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs new file mode 100644 index 0000000000..dfcb0c038f --- /dev/null +++ b/osu.Game/Overlays/Direct/Header.cs @@ -0,0 +1,123 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.ComponentModel; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +using Container = osu.Framework.Graphics.Containers.Container; + +namespace osu.Game.Overlays.Direct +{ + public class Header : Container + { + private readonly Box tabStrip; + private readonly DirectTabControl tabs; + + public Action OnSelectTab; + + public Header() + { + Height = 90; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"252f3a"), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = DirectOverlay.WIDTH_PADDING, Right = DirectOverlay.WIDTH_PADDING }, + Children = new Drawable[] + { + new FillFlowContainer + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomLeft, + Position = new Vector2(-35f, 5f), + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10f, 0f), + Children = new Drawable[] + { + new TextAwesome + { + TextSize = 25, + Icon = FontAwesome.fa_osu_chevron_down_o, + }, + new OsuSpriteText + { + TextSize = 25, + Text = @"osu!direct", + }, + }, + }, + tabStrip = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = 282, //todo: make this actually match the tab control's width instead of hardcoding + Height = 1, + }, + tabs = new DirectTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }; + + tabs.Current.ValueChanged += (newValue) => OnSelectTab?.Invoke(newValue); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + tabStrip.Colour = colours.Green; + } + + private class DirectTabControl : OsuTabControl + { + protected override TabItem CreateTabItem(DirectTab value) => new DirectTabItem(value); + + public DirectTabControl() + { + Height = 25; + AccentColour = Color4.White; + } + + private class DirectTabItem : OsuTabControl.OsuTabItem + { + public DirectTabItem(DirectTab value) : base(value) + { + Text.TextSize = 15; + } + } + } + } + + public enum DirectTab + { + Search, + [Description("Newest Maps")] + New, + [Description("Top Rated")] + Top, + [Description("Most Played")] + MostP + } +} diff --git a/osu.Game/Overlays/Direct/SortTabControl.cs b/osu.Game/Overlays/Direct/SortTabControl.cs new file mode 100644 index 0000000000..5da41e5fc5 --- /dev/null +++ b/osu.Game/Overlays/Direct/SortTabControl.cs @@ -0,0 +1,117 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Direct +{ + public class SortTabControl : OsuTabControl + { + protected override TabItem CreateTabItem(SortCriteria value) => new SortTabItem(value); + + public SortTabControl() + { + Height = 30; + } + + private class SortTabItem : TabItem + { + private readonly float transition_duration = 100; + + private Box box; + + public override bool Active + { + get { return base.Active; } + set + { + if (Active == value) return; + + if (value) + slideActive(); + else + slideInactive(); + base.Active = value; + } + } + + public SortTabItem(SortCriteria value) : base(value) + { + AutoSizeAxes = Axes.X; + RelativeSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new OsuSpriteText + { + Margin = new MarginPadding { Top = 8, Bottom = 8 }, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Text = (value as Enum)?.GetDescription() ?? value.ToString(), + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + box = new Box + { + RelativeSizeAxes = Axes.X, + Height = 5, + Scale = new Vector2(1f, 0f), + Colour = Color4.White, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + box.Colour = colours.Yellow; + } + + protected override bool OnHover(InputState state) + { + if (!Active) + slideActive(); + return true; + } + + protected override void OnHoverLost(InputState state) + { + if (!Active) + slideInactive(); + } + + private void slideActive() + { + box.ScaleTo(new Vector2(1f), transition_duration); + } + + private void slideInactive() + { + box.ScaleTo(new Vector2(1f, 0f), transition_duration); + } + } + } + + public enum SortCriteria + { + Title, + Artist, + Creator, + Difficulty, + Ranked, + Rating, + } +} diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs new file mode 100644 index 0000000000..09b45431d6 --- /dev/null +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -0,0 +1,89 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Overlays.Direct; + +namespace osu.Game.Overlays +{ + public class DirectOverlay : WaveOverlayContainer + { + public static readonly int WIDTH_PADDING = 80; + + private readonly Box background; + private readonly FilterControl filter; + + public DirectOverlay() + { + RelativeSizeAxes = Axes.Both; + + // osu!direct colours are not part of the standard palette + + FirstWaveColour = OsuColour.FromHex(@"19b0e2"); + SecondWaveColour = OsuColour.FromHex(@"2280a2"); + ThirdWaveColour = OsuColour.FromHex(@"005774"); + FourthWaveColour = OsuColour.FromHex(@"003a4e"); + + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"485e74"), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 5, + ColourLight = OsuColour.FromHex(@"465b71"), + ColourDark = OsuColour.FromHex(@"3f5265"), + }, + }, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Children = new Drawable[] + { + new Header + { + RelativeSizeAxes = Axes.X, + }, + filter = new FilterControl + { + RelativeSizeAxes = Axes.X, + }, + }, + }, + }; + + filter.Search.Exit = Hide; + } + + protected override void PopIn() + { + base.PopIn(); + + filter.Search.HoldFocus = true; + Schedule(() => filter.Search.TriggerFocus()); + } + + protected override void PopOut() + { + base.PopOut(); + + filter.Search.HoldFocus = false; + } + } +} diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 71d020b0f2..61e1ee0832 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -85,6 +85,7 @@ namespace osu.Game.Screens.Menu } buttons.OnSettings = game.ToggleSettings; + buttons.OnDirect = game.ToggleDirect; preloadSongSelect(); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 63acdb1914..96a823c9e7 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -428,6 +428,11 @@ + + + + + @@ -450,6 +455,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 062/162] 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 063/162] 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 064/162] 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 065/162] 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 059af0850b42ec57851194dffc226f1c9a844967 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 21 May 2017 23:47:08 -0500 Subject: [PATCH 066/162] Changes in-line with framework --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 079b3c92c4..76db6d1a06 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; +using osu.Framework.Audio.Track; namespace osu.Game.Screens.Menu { @@ -23,8 +24,8 @@ namespace osu.Game.Screens.Menu private Box leftBox; private Box rightBox; - private const int amplitude_dead_zone = 9000; - private const float alpha_multiplier = (short.MaxValue - amplitude_dead_zone) / 0.55f; + private const float amplitude_dead_zone = 0.25f; + private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; @@ -68,12 +69,13 @@ namespace osu.Game.Screens.Menu } else if (newBeat >= 0) { - short[] lev = beatmap.Value.Track.ChannelPeakAmplitudes; + + TrackAmplitudes amp = beatmap.Value.Track.PeakAmplitudes; bool nextIsLeft = newBeat % 2 == 0; if (kiai ? nextIsLeft : newBeat % (int)timeSignature == 0) { leftBox.ClearTransforms(); - leftBox.FadeTo(Math.Max(0, (lev[0] - amplitude_dead_zone) / alpha_multiplier), 65); + leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); using (leftBox.BeginDelayedSequence(box_fade_in_time)) leftBox.FadeOut(beatLength, EasingTypes.In); leftBox.DelayReset(); @@ -81,7 +83,7 @@ namespace osu.Game.Screens.Menu if (kiai ? !nextIsLeft : newBeat % (int)timeSignature == 0) { rightBox.ClearTransforms(); - rightBox.FadeTo(Math.Max(0, (lev[1] - amplitude_dead_zone) / alpha_multiplier), 65); + rightBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); using (rightBox.BeginDelayedSequence(box_fade_in_time)) rightBox.FadeOut(beatLength, EasingTypes.In); rightBox.DelayReset(); From 6bf0ca59fe2f0b19b454e7c750a1bed89e6ccabc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 02:03:26 -0300 Subject: [PATCH 067/162] Make FilterControl not scroll with the panels --- osu.Game/Overlays/Direct/FilterControl.cs | 4 +++- osu.Game/Overlays/DirectOverlay.cs | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index b35938f3a6..bdb880d5cc 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Direct { public class FilterControl : Container { + public static readonly float HEIGHT = 35 + 32 + 30 + padding * 2; // search + mode toggle buttons + sort tabs + padding + /// /// The height of the content below the filter control (tab strip + result count text). /// @@ -50,7 +52,7 @@ namespace osu.Game.Overlays.Direct public FilterControl() { RelativeSizeAxes = Axes.X; - Height = 35 + 32 + 30 + padding * 2; // search + mode toggle buttons + sort tabs + padding + Height = HEIGHT; DisplayStyle.Value = PanelDisplayStyle.Grid; Children = new Drawable[] diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index c56d995c8a..284c13299c 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -77,24 +77,18 @@ namespace osu.Game.Overlays }, }, }, - new ScrollContainer + new Container { RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, - Padding = new MarginPadding { Top = Header.HEIGHT }, - Children = new Drawable[] + Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, + Children = new[] { - new ReverseDepthFillFlowContainer + new ScrollContainer { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, Children = new Drawable[] { - filter = new FilterControl - { - RelativeSizeAxes = Axes.X, - }, panels = new FillFlowContainer { RelativeSizeAxes = Axes.X, @@ -106,6 +100,11 @@ namespace osu.Game.Overlays }, }, }, + filter = new FilterControl + { + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = Header.HEIGHT }, + }, header = new Header { RelativeSizeAxes = Axes.X, From 3c35badf069d7e0d62a1fca6802b4905df6ce898 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 02:03:53 -0300 Subject: [PATCH 068/162] Unused using --- osu.Game/Overlays/DirectOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 284c13299c..928ab3b300 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -11,7 +11,6 @@ using osu.Framework.Input; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Containers; using osu.Game.Overlays.Direct; namespace osu.Game.Overlays From 7ce3b73ecdaf0f1df0d390f51c24a5318a0c4cf0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:11:42 -0300 Subject: [PATCH 069/162] Added UserPanel and UserStatus --- .../Tests/TestCaseUserPanel.cs | 40 ++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Users/UserPanel.cs | 183 ++++++++++++++++++ osu.Game/Users/UserStatus.cs | 55 ++++++ osu.Game/osu.Game.csproj | 2 + 5 files changed, 281 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs create mode 100644 osu.Game/Users/UserPanel.cs create mode 100644 osu.Game/Users/UserStatus.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs new file mode 100644 index 0000000000..ab8bb425a7 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; +using osu.Game.Users; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseUserPanel : TestCase + { + public override string Description => @"Panels for displaying a user's status"; + + public override void Reset() + { + base.Reset(); + + UserPanel p; + Add(p = new UserPanel(new User + { + Username = @"flyte", + Id = 3103765, + Country = new Country { FlagName = @"JP" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" + }) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 300, + }); + + p.Status.Value = new UserStatusOnline(); + + AddStep(@"spectating", () => { p.Status.Value = new UserStatusSpectating(); }); + AddStep(@"multiplaying", () => { p.Status.Value = new UserStatusMultiplayerGame(); }); + AddStep(@"modding", () => { p.Status.Value = new UserStatusModding(); }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index dbb1750b72..e68935a561 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -220,6 +220,7 @@ + diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs new file mode 100644 index 0000000000..80d706d985 --- /dev/null +++ b/osu.Game/Users/UserPanel.cs @@ -0,0 +1,183 @@ +// 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.Configuration; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Users +{ + public class UserPanel : Container + { + private const float height = 100; + private const float content_padding = 10; + private const float status_height = 30; + + private readonly User user; + private OsuColour colours; + + private readonly Container cover; + private readonly Box statusBg; + private readonly OsuSpriteText statusMessage; + + public readonly Bindable Status = new Bindable(); + + public UserPanel(User user) + { + this.user = user; + + Height = height; + Masking = true; + CornerRadius = 5; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }; + + Children = new Drawable[] + { + cover = new Container + { + RelativeSizeAxes = Axes.Both, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0.7f), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = content_padding, Bottom = status_height + content_padding, Left = content_padding, Right = content_padding }, + Children = new Drawable[] + { + new UpdateableAvatar + { + Size = new Vector2(height - status_height - content_padding * 2), + User = user, + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding { Left = height - status_height - content_padding }, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = user.Username, + TextSize = 18, + Font = @"Exo2.0-SemiBoldItalic", + }, + new FillFlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + AutoSizeAxes = Axes.X, + Height = 20f, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + new DrawableFlag(user.Country?.FlagName ?? @"__") + { + Width = 30f, + RelativeSizeAxes = Axes.Y, + }, + new Container + { + Width = 40f, + RelativeSizeAxes = Axes.Y, + }, + new CircularContainer + { + Width = 20f, + RelativeSizeAxes = Axes.Y, + }, + }, + }, + }, + }, + }, + }, + new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = status_height, + Children = new Drawable[] + { + statusBg = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f, + }, + new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(5f, 0f), + Children = new[] + { + new TextAwesome + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Icon = FontAwesome.fa_circle_o, + Shadow = true, + TextSize = 14, + }, + statusMessage = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = @"Exo2.0-Semibold", + }, + }, + }, + }, + }, + }; + + Status.ValueChanged += displayStatus; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures) + { + this.colours = colours; + + cover.Add(new AsyncLoadWrapper(new Sprite + { + Texture = textures.Get(user.CoverUrl), + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(200), + }) { RelativeSizeAxes = Axes.Both }); + } + + private void displayStatus(UserStatus status) + { + statusBg.FadeColour(status.Colour(colours), 200); + statusMessage.Text = status.Message; + } + } +} diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs new file mode 100644 index 0000000000..b6ae53c9cd --- /dev/null +++ b/osu.Game/Users/UserStatus.cs @@ -0,0 +1,55 @@ +// 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.Users +{ + public abstract class UserStatus + { + public abstract string Message { get; } + public abstract Color4 Colour(OsuColour colours); + } + + public abstract class UserStatusAvailable : UserStatus + { + public override Color4 Colour(OsuColour colours) => colours.BlueDarker; + } + + public abstract class UserStatusBusy : UserStatus + { + public override Color4 Colour(OsuColour colours) => colours.YellowDark; + } + + public class UserStatusOnline : UserStatusAvailable + { + public override string Message => @"Online"; + } + + public class UserStatusSpectating : UserStatusAvailable + { + public override string Message => @"Spectating a game"; + } + + public class UserStatusInLobby : UserStatusAvailable + { + public override string Message => @"in Multiplayer Lobby"; + } + + public class UserStatusSoloGame : UserStatusBusy + { + public override string Message => @"Solo Game"; + } + + public class UserStatusMultiplayerGame: UserStatusBusy + { + public override string Message => @"Multiplaying"; + } + + public class UserStatusModding : UserStatus + { + public override string Message => @"Modding a map"; + public override Color4 Colour(OsuColour colours) => colours.PurpleDark; + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1631311ef6..ba72b0422d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -425,6 +425,8 @@ + + From 77affc1eb71a67153c2259ccb4a01bfb993e69b7 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:13:55 -0300 Subject: [PATCH 070/162] Split onto multiple lines --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 +++++++- osu.Game/Overlays/Direct/FilterControl.cs | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index fc63045e15..63298052c3 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -110,7 +110,13 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Padding = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = horizontal_padding }, + Padding = new MarginPadding + { + Top = vertical_padding, + Bottom = vertical_padding, + Left = horizontal_padding, + Right = horizontal_padding, + }, Children = new Drawable[] { new FillFlowContainer diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index bdb880d5cc..185ab7c321 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -44,7 +44,11 @@ namespace osu.Game.Overlays.Direct public ResultCounts ResultCounts { get { return resultCounts; } - set { resultCounts = value; updateResultCounts(); } + set + { + resultCounts = value; + updateResultCounts(); + } } protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos); From bdab545ca44779bc080d868f064e3f67306f15f0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:15:22 -0300 Subject: [PATCH 071/162] Use BeatmapBackgroundSprite --- osu.Game/Overlays/Direct/DirectPanel.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 9aae719d5c..8a56cf392e 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -36,10 +36,9 @@ namespace osu.Game.Overlays.Direct protected Drawable GetBackground(TextureStore textures) { - return new AsyncLoadWrapper(new Sprite + return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null)) { FillMode = FillMode.Fill, - Texture = new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null).Background, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), }) { RelativeSizeAxes = Axes.Both }; } From a73cf929946cb30ec7154014b66fe091595c6bdc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:27:08 -0300 Subject: [PATCH 072/162] Add second UserPanel to visual test, center cover sprite --- .../Tests/TestCaseUserPanel.cs | 42 +++++++++++++------ osu.Game/Users/UserPanel.cs | 3 ++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index ab8bb425a7..efee8e0e24 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -5,6 +5,8 @@ using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Users; +using osu.Framework.Graphics.Containers; +using OpenTK; namespace osu.Desktop.VisualTests.Tests { @@ -16,25 +18,39 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - UserPanel p; - Add(p = new UserPanel(new User - { - Username = @"flyte", - Id = 3103765, - Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" - }) + UserPanel flyte; + UserPanel peppy; + Add(new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Width = 300, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(10f), + Children = new[] + { + flyte = new UserPanel(new User + { + Username = @"flyte", + Id = 3103765, + Country = new Country { FlagName = @"JP" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" + }), + peppy = new UserPanel(new User + { + Username = @"peppy", + Id = 2, + Country = new Country { FlagName = @"AU" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg" + }), + }, }); - p.Status.Value = new UserStatusOnline(); + flyte.Status.Value = new UserStatusOnline(); + peppy.Status.Value = new UserStatusSoloGame(); - AddStep(@"spectating", () => { p.Status.Value = new UserStatusSpectating(); }); - AddStep(@"multiplaying", () => { p.Status.Value = new UserStatusMultiplayerGame(); }); - AddStep(@"modding", () => { p.Status.Value = new UserStatusModding(); }); + AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); + AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); + AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 80d706d985..4de309fb62 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -34,6 +34,7 @@ namespace osu.Game.Users { this.user = user; + Width = 300; Height = height; Masking = true; CornerRadius = 5; @@ -168,6 +169,8 @@ namespace osu.Game.Users cover.Add(new AsyncLoadWrapper(new Sprite { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Texture = textures.Get(user.CoverUrl), FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200), From aa40f882586b9a9137e9b0a1aa0c1cffaa9aad8f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:32:02 -0300 Subject: [PATCH 073/162] Add UserStatusOffline --- osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs | 1 + osu.Game/Users/UserStatus.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index efee8e0e24..d783d42f1f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -51,6 +51,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); }); AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); + AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); } } } diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index b6ae53c9cd..97ee47423e 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -22,6 +22,12 @@ namespace osu.Game.Users public override Color4 Colour(OsuColour colours) => colours.YellowDark; } + public class UserStatusOffline : UserStatus + { + public override string Message => @"Offline"; + public override Color4 Colour(OsuColour colours) => colours.Gray7; + } + public class UserStatusOnline : UserStatusAvailable { public override string Message => @"Online"; From 8a364c606824d7376286f38429dfe5545db3454e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:37:36 -0300 Subject: [PATCH 074/162] CI fixes --- osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs | 8 ++++---- osu.Game/Users/UserStatus.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index d783d42f1f..f7f0f8b24a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -10,10 +10,10 @@ using OpenTK; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseUserPanel : TestCase - { - public override string Description => @"Panels for displaying a user's status"; - + internal class TestCaseUserPanel : TestCase + { + public override string Description => @"Panels for displaying a user's status"; + public override void Reset() { base.Reset(); diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 97ee47423e..0ff8333c24 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -24,7 +24,7 @@ namespace osu.Game.Users public class UserStatusOffline : UserStatus { - public override string Message => @"Offline"; + public override string Message => @"Offline"; public override Color4 Colour(OsuColour colours) => colours.Gray7; } @@ -35,27 +35,27 @@ namespace osu.Game.Users public class UserStatusSpectating : UserStatusAvailable { - public override string Message => @"Spectating a game"; + public override string Message => @"Spectating a game"; } public class UserStatusInLobby : UserStatusAvailable { - public override string Message => @"in Multiplayer Lobby"; + public override string Message => @"in Multiplayer Lobby"; } public class UserStatusSoloGame : UserStatusBusy { - public override string Message => @"Solo Game"; + public override string Message => @"Solo Game"; } public class UserStatusMultiplayerGame: UserStatusBusy { - public override string Message => @"Multiplaying"; + public override string Message => @"Multiplaying"; } public class UserStatusModding : UserStatus { - public override string Message => @"Modding a map"; + public override string Message => @"Modding a map"; public override Color4 Colour(OsuColour colours) => colours.PurpleDark; } } From 62ca76bc4188f5241fa222b7e4ac971c449b9c3f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 03:42:32 -0300 Subject: [PATCH 075/162] Unused using --- osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index f7f0f8b24a..7c2745ee0f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -3,7 +3,6 @@ using osu.Framework.Testing; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; using osu.Game.Users; using osu.Framework.Graphics.Containers; using OpenTK; From a1547f12d426c1139afc749d75bdef963026c86a Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:38:21 -0500 Subject: [PATCH 076/162] Applied suggestions + Update Framework --- osu-framework | 2 +- osu.Game/Screens/Menu/MenuSideFlashes.cs | 50 +++++++++++------------- osu.Game/osu.Game.csproj | 1 + 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/osu-framework b/osu-framework index 42e26d49b9..9967572490 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 42e26d49b9046fcb96c123b0dfb48e06d741e162 +Subproject commit 9967572490ed2d1fa3c746311753c0cf00c08607 diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 76db6d1a06..4968da9689 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -4,6 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Game.Graphics.Containers; @@ -11,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; -using osu.Framework.Audio.Track; +using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; namespace osu.Game.Screens.Menu { @@ -19,13 +20,14 @@ namespace osu.Game.Screens.Menu { public override bool HandleInput => false; - private Bindable beatmap = new Bindable(); + private readonly Bindable beatmap = new Bindable(); private Box leftBox; private Box rightBox; private const float amplitude_dead_zone = 0.25f; private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; + private const float kiai_multiplier = (1 - (amplitude_dead_zone * 0.9f)) / 0.8f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; @@ -45,7 +47,7 @@ namespace osu.Game.Screens.Menu Width = 300, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Transparent), + ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)), }, rightBox = new Box { @@ -55,46 +57,38 @@ namespace osu.Game.Screens.Menu Width = 300, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(Color4.Transparent, new Color4(255, 255, 255, box_max_alpha)), + ColourInfo = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)), } }; } protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { - if (!beatmap?.Value?.Track?.IsRunning ?? false) + if (newBeat < 0) + return; + TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; + if (newBeat % (kiai ? 2 : (int)timeSignature) == 0) { - leftBox.FadeOut(50); - rightBox.FadeOut(50); + leftBox.ClearTransforms(); + leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); + using (leftBox.BeginDelayedSequence(box_fade_in_time)) + leftBox.FadeOut(beatLength, EasingTypes.In); + leftBox.DelayReset(); } - else if (newBeat >= 0) + if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) { - - TrackAmplitudes amp = beatmap.Value.Track.PeakAmplitudes; - bool nextIsLeft = newBeat % 2 == 0; - if (kiai ? nextIsLeft : newBeat % (int)timeSignature == 0) - { - leftBox.ClearTransforms(); - leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); - using (leftBox.BeginDelayedSequence(box_fade_in_time)) - leftBox.FadeOut(beatLength, EasingTypes.In); - leftBox.DelayReset(); - } - if (kiai ? !nextIsLeft : newBeat % (int)timeSignature == 0) - { - rightBox.ClearTransforms(); - rightBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); - using (rightBox.BeginDelayedSequence(box_fade_in_time)) - rightBox.FadeOut(beatLength, EasingTypes.In); - rightBox.DelayReset(); - } + rightBox.ClearTransforms(); + rightBox.FadeTo(Math.Max(0, (amp.RightChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); + using (rightBox.BeginDelayedSequence(box_fade_in_time)) + rightBox.FadeOut(beatLength, EasingTypes.In); + rightBox.DelayReset(); } } [BackgroundDependencyLoader] private void load(OsuGameBase game) { - beatmap = game.Beatmap; + beatmap.BindTo(game.Beatmap); } } } \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b94c19e1f8..a5e57f10db 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -183,6 +183,7 @@ + From f2b5be27c8581da525b50179638e4282eb28491c Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:53:32 -0500 Subject: [PATCH 077/162] CI Fixes --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 4968da9689..b961cd9adb 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -22,12 +22,12 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); - private Box leftBox; - private Box rightBox; + private readonly Box leftBox; + private readonly Box rightBox; private const float amplitude_dead_zone = 0.25f; private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; - private const float kiai_multiplier = (1 - (amplitude_dead_zone * 0.9f)) / 0.8f; + private const float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; From 601b840713df654f2dd6855e2156c04673e0f999 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:55:33 -0500 Subject: [PATCH 078/162] Apply suggestions --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index b961cd9adb..7e2b6b988a 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -66,8 +66,9 @@ namespace osu.Game.Screens.Menu { if (newBeat < 0) return; + TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (newBeat % (kiai ? 2 : (int)timeSignature) == 0) + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature) == 0) { leftBox.ClearTransforms(); leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); @@ -75,6 +76,7 @@ namespace osu.Game.Screens.Menu leftBox.FadeOut(beatLength, EasingTypes.In); leftBox.DelayReset(); } + if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) { rightBox.ClearTransforms(); From 63196df541280dee0e60b498e03dd44dd0c8a5f4 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 05:05:54 -0500 Subject: [PATCH 079/162] Typo fix Forgot the pharenteses --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 7e2b6b988a..aee501461a 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Menu return; TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature) == 0) + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) { leftBox.ClearTransforms(); leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); From 6cef3021c7f0a3e5fcc8694adc40e08b149c6b86 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 19:50:01 +0900 Subject: [PATCH 080/162] 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 9235cbff8d4c543413bac65e5e53b12ef19f7cf9 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 05:59:16 -0500 Subject: [PATCH 081/162] Apply suggestions --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 44 +++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index aee501461a..61d3ef10a8 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -22,6 +22,9 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); + private static readonly ColourInfo gradient_white_to_transparent_black = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)); + private static readonly ColourInfo gradient_transparent_black_to_white = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)); + private readonly Box leftBox; private readonly Box rightBox; @@ -30,6 +33,7 @@ namespace osu.Game.Screens.Menu private const float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; + private const int box_width = 300; public MenuSideFlashes() { @@ -44,47 +48,47 @@ namespace osu.Game.Screens.Menu Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Y, - Width = 300, + Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)), + ColourInfo = gradient_white_to_transparent_black, }, rightBox = new Box { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, - Width = 300, + Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)), + ColourInfo = gradient_transparent_black_to_white, } }; } + private bool kiai; + private double beatLength; + protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { if (newBeat < 0) return; - TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - { - leftBox.ClearTransforms(); - leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); - using (leftBox.BeginDelayedSequence(box_fade_in_time)) - leftBox.FadeOut(beatLength, EasingTypes.In); - leftBox.DelayReset(); - } + this.kiai = kiai; + this.beatLength = beatLength; + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) + flash(leftBox); if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - { - rightBox.ClearTransforms(); - rightBox.FadeTo(Math.Max(0, (amp.RightChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); - using (rightBox.BeginDelayedSequence(box_fade_in_time)) - rightBox.FadeOut(beatLength, EasingTypes.In); - rightBox.DelayReset(); - } + flash(rightBox); + } + + private void flash(Drawable d) + { + TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amp.LeftChannel : amp.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); + using (d.BeginDelayedSequence(box_fade_in_time)) + d.FadeOut(beatLength, EasingTypes.In); } [BackgroundDependencyLoader] From 35814e47e46bdd0df6f98d43b91a72e58a96eb91 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:37:19 -0300 Subject: [PATCH 082/162] Colour -> GetAppropriateColour, adjust status change transition --- osu.Game/Users/UserPanel.cs | 4 ++-- osu.Game/Users/UserStatus.cs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 4de309fb62..745fd166f8 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -78,7 +78,7 @@ namespace osu.Game.Users new Container { RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding { Left = height - status_height - content_padding }, + Padding = new MarginPadding { Left = height - status_height - content_padding }, Children = new Drawable[] { new OsuSpriteText @@ -179,7 +179,7 @@ namespace osu.Game.Users private void displayStatus(UserStatus status) { - statusBg.FadeColour(status.Colour(colours), 200); + statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); statusMessage.Text = status.Message; } } diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 0ff8333c24..dcb5ccbd8f 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -9,23 +9,23 @@ namespace osu.Game.Users public abstract class UserStatus { public abstract string Message { get; } - public abstract Color4 Colour(OsuColour colours); + public abstract Color4 GetAppropriateColour(OsuColour colours); } public abstract class UserStatusAvailable : UserStatus { - public override Color4 Colour(OsuColour colours) => colours.BlueDarker; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.BlueDarker; } public abstract class UserStatusBusy : UserStatus { - public override Color4 Colour(OsuColour colours) => colours.YellowDark; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.YellowDark; } - public class UserStatusOffline : UserStatus - { + public class UserStatusOffline : UserStatus + { public override string Message => @"Offline"; - public override Color4 Colour(OsuColour colours) => colours.Gray7; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray7; } public class UserStatusOnline : UserStatusAvailable @@ -56,6 +56,6 @@ namespace osu.Game.Users public class UserStatusModding : UserStatus { public override string Message => @"Modding a map"; - public override Color4 Colour(OsuColour colours) => colours.PurpleDark; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } } From 261ea4c1767c85931e5f7ebef1062fe746fd7f31 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:41:59 -0300 Subject: [PATCH 083/162] CoverBackgroundSprite for actually async cover loading --- osu.Game/Users/UserPanel.cs | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 745fd166f8..81e28e2735 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -159,22 +159,21 @@ namespace osu.Game.Users }, }; + cover.Add(new AsyncLoadWrapper(new CoverBackgroundSprite(user) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(200), + }) { RelativeSizeAxes = Axes.Both }); + Status.ValueChanged += displayStatus; } [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures) + private void load(OsuColour colours) { this.colours = colours; - - cover.Add(new AsyncLoadWrapper(new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Texture = textures.Get(user.CoverUrl), - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(200), - }) { RelativeSizeAxes = Axes.Both }); } private void displayStatus(UserStatus status) @@ -182,5 +181,22 @@ namespace osu.Game.Users statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); statusMessage.Text = status.Message; } + + private class CoverBackgroundSprite : Sprite + { + private readonly User user; + + public CoverBackgroundSprite(User user) + { + this.user = user; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (!string.IsNullOrEmpty(user.CoverUrl)) + Texture = textures.Get(user.CoverUrl); + } + } } } From 03f6cded8463a75cf762d8661c13e840ee349ccc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 12:44:58 -0300 Subject: [PATCH 084/162] 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 085/162] 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 086/162] 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 087/162] 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 8b505a9e8b2458beefbeab5efe017026df6c7e87 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 13:06:52 -0300 Subject: [PATCH 088/162] Remove tab character --- osu.Game/Users/UserPanel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 81e28e2735..6eff471989 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -159,9 +159,9 @@ namespace osu.Game.Users }, }; - cover.Add(new AsyncLoadWrapper(new CoverBackgroundSprite(user) - { - Anchor = Anchor.Centre, + cover.Add(new AsyncLoadWrapper(new CoverBackgroundSprite(user) + { + Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200), From cf0e7887b57618ca01700b36054929a5b2ebd70f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 13:14:56 -0300 Subject: [PATCH 089/162] 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 4681beab5d2c64ccf1b958378dceb3eb0c4736f0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 13:22:14 -0300 Subject: [PATCH 090/162] CI fixes --- osu.Game/Users/UserPanel.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 6eff471989..3502443d49 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -21,10 +21,8 @@ namespace osu.Game.Users private const float content_padding = 10; private const float status_height = 30; - private readonly User user; private OsuColour colours; - private readonly Container cover; private readonly Box statusBg; private readonly OsuSpriteText statusMessage; @@ -32,8 +30,6 @@ namespace osu.Game.Users public UserPanel(User user) { - this.user = user; - Width = 300; Height = height; Masking = true; @@ -45,6 +41,7 @@ namespace osu.Game.Users Radius = 4, }; + Container cover; Children = new Drawable[] { cover = new Container From 9798117d53462e9aefea28c67be643ceaa3dbdb0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 22 May 2017 21:13:57 -0300 Subject: [PATCH 091/162] 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 3e0aaa1aa0ab8a3bf1bda52674b0d82c63ec313d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 12:29:43 +0900 Subject: [PATCH 092/162] Add basic beat response to osu! logo --- .../Containers/BeatSyncedContainer.cs | 9 +- osu.Game/Screens/Menu/OsuLogo.cs | 173 ++++++++++-------- 2 files changed, 106 insertions(+), 76 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index dfb742f7d1..b9a7183338 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -16,12 +16,19 @@ namespace osu.Game.Graphics.Containers private int lastBeat; private ControlPoint lastControlPoint; + /// + /// The amount of time before a beat we should fire . + /// This allows for adding easing to animations that may be synchronised to the beat. + /// + protected double EarlyActivationMilliseconds; + protected override void Update() { if (beatmap.Value?.Track == null) return; - double currentTrackTime = beatmap.Value.Track.CurrentTime; + double currentTrackTime = beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; + ControlPoint overridePoint; ControlPoint controlPoint = beatmap.Value.Beatmap.TimingInfo.TimingPointAt(currentTrackTime, out overridePoint); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index e28adeacff..5f9a3bf655 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -12,21 +12,24 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Menu { /// /// osu! logo and its attachments (pulsing, visualiser etc.) /// - public class OsuLogo : Container + public class OsuLogo : BeatSyncedContainer { public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1"); private readonly Sprite logo; private readonly CircularContainer logoContainer; private readonly Container logoBounceContainer; + private readonly Container logoBeatContainer; private readonly Container logoHoverContainer; private SampleChannel sampleClick; @@ -67,8 +70,12 @@ namespace osu.Game.Screens.Menu private const float default_size = 480; + private const double beat_in_time = 60; + public OsuLogo() { + EarlyActivationMilliseconds = beat_in_time; + Size = new Vector2(default_size); Anchor = Anchor.Centre; @@ -78,109 +85,116 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - logoBounceContainer = new Container + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoHoverContainer = new Container + logoBounceContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new BufferedContainer + logoHoverContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoContainer = new CircularContainer + new BufferedContainer + { + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + logoContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.88f), + Masking = true, + Children = new Drawable[] + { + colourAndTriangles = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuPink, + }, + new Triangles + { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + }, + } + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = Color4.White, + Alpha = 0, + }, + }, + }, + logo = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + } + }, + rippleContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.88f), + Children = new Drawable[] + { + ripple = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BlendingMode = BlendingMode.Additive, + Alpha = 0.15f + } + } + }, + impactContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + BorderColour = Color4.White, + RelativeSizeAxes = Axes.Both, + BorderThickness = 10, Masking = true, Children = new Drawable[] { - colourAndTriangles = new Container + new Box { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuPink, - }, - new Triangles - { - TriangleScale = 4, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - }, - } - }, - flashLayer = new Box - { - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = Color4.White, + AlwaysPresent = true, Alpha = 0, - }, - }, + } + } }, - logo = new Sprite + new MenuVisualisation { Anchor = Anchor.Centre, Origin = Anchor.Centre, - }, - } - }, - rippleContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ripple = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlendingMode = BlendingMode.Additive, - Alpha = 0.15f - } - } - }, - impactContainer = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0, - BorderColour = Color4.White, - RelativeSizeAxes = Axes.Both, - BorderThickness = 10, - Masking = true, - Children = new Drawable[] - { - new Box - { RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - Alpha = 0, + BlendingMode = BlendingMode.Additive, + Alpha = 0.2f, } } - }, - new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Alpha = 0.2f, } } } @@ -206,6 +220,15 @@ namespace osu.Game.Screens.Menu ripple.Loop(300); } + protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) + { + base.OnNewBeat(newBeat, beatLength, timeSignature, kiai); + + logoBeatContainer.ScaleTo(0.97f, beat_in_time, EasingTypes.Out); + using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) + logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) return false; From aad6f8f5d61f05f752f06932643ce186099db155 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 16:11:46 +0900 Subject: [PATCH 093/162] Refactoring of BeatSyncedContainer. --- osu-framework | 2 +- .../Graphics/Containers/BeatSyncedContainer.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu-framework b/osu-framework index c6f030d6f1..773d60eb6b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c6f030d6f1ab65a48de9ff1d0c424acb686e0149 +Subproject commit 773d60eb6b811f395e32a22dc66bb4d2e63a6dbc diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 5895eabde4..3d08431bea 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Beatmaps.Timing; namespace osu.Game.Graphics.Containers { @@ -30,21 +30,21 @@ namespace osu.Game.Graphics.Containers if (timingPoint.BeatLength == 0) return; - int beat = (int)((currentTrackTime - timingPoint.Time) / timingPoint.BeatLength); + int beatIndex = (int)((currentTrackTime - timingPoint.Time) / timingPoint.BeatLength); // The beats before the start of the first control point are off by 1, this should do the trick if (currentTrackTime < timingPoint.Time) - beat--; + beatIndex--; - if (timingPoint == lastTimingPoint && beat == lastBeat) + if (timingPoint == lastTimingPoint && beatIndex == lastBeat) return; double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength; using (BeginDelayedSequence(offsetFromBeat, true)) - OnNewBeat(beat, timingPoint.BeatLength, timingPoint.TimeSignature, effectPoint.KiaiMode); + OnNewBeat(beatIndex, timingPoint, effectPoint, beatmap.Value.Track.CurrentAmplitudes); - lastBeat = beat; + lastBeat = beatIndex; lastTimingPoint = timingPoint; } @@ -54,7 +54,7 @@ namespace osu.Game.Graphics.Containers beatmap.BindTo(game.Beatmap); } - protected virtual void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) + protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { } } From 61348ff08d7269f1e4752a79d00f9e81e34ab7a0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 16:42:17 +0900 Subject: [PATCH 094/162] 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 73320f9a7ea8acd293830ee2af1053efc418f948 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 15:29:23 +0900 Subject: [PATCH 095/162] Don't bounce the ripple Also ripple better. --- osu.Game/Screens/Menu/OsuLogo.cs | 57 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 5f9a3bf655..738204e30e 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - logoBeatContainer = new Container + logoHoverContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -95,7 +95,23 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoHoverContainer = new Container + rippleContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + ripple = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BlendingMode = BlendingMode.Additive, + Alpha = 0 + } + } + }, + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -151,22 +167,6 @@ namespace osu.Game.Screens.Menu }, } }, - rippleContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ripple = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlendingMode = BlendingMode.Additive, - Alpha = 0.15f - } - } - }, impactContainer = new CircularContainer { Anchor = Anchor.Centre, @@ -211,22 +211,23 @@ namespace osu.Game.Screens.Menu ripple.Texture = textures.Get(@"Menu/logo"); } - protected override void LoadComplete() - { - base.LoadComplete(); - - ripple.ScaleTo(ripple.Scale * 1.1f, 500); - ripple.FadeOut(500); - ripple.Loop(300); - } - protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { base.OnNewBeat(newBeat, beatLength, timeSignature, kiai); - logoBeatContainer.ScaleTo(0.97f, beat_in_time, EasingTypes.Out); + if (newBeat < 0) return; + + logoBeatContainer.ScaleTo(0.98f, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + + ripple.ClearTransforms(); + + ripple.ScaleTo(Vector2.One); + ripple.Alpha = 0.15f; + + ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); + ripple.FadeOut(beatLength); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 2decb2b2ff929f5a782592a1563fb32073b429ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 16:27:01 +0900 Subject: [PATCH 096/162] Add more flashiness during kiai time --- osu.Game/Screens/Menu/OsuLogo.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 738204e30e..74fc7a3f87 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -228,6 +228,15 @@ namespace osu.Game.Screens.Menu ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); ripple.FadeOut(beatLength); + + if (kiai && flashLayer.Alpha < 0.4f) + { + flashLayer.ClearTransforms(); + + flashLayer.FadeTo(0.14f, beat_in_time, EasingTypes.Out); + using (flashLayer.BeginDelayedSequence(beat_in_time)) + flashLayer.FadeOut(beatLength); + } } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 0dd52e4e2930509788aa71a1eaaa47b2082a03d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 17:26:28 +0900 Subject: [PATCH 097/162] Various refactoring --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 44 +++++++++++------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 61d3ef10a8..ced6d179d6 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.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.Graphics; @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; +using osu.Game.Graphics; using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; namespace osu.Game.Screens.Menu @@ -22,25 +23,22 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); - private static readonly ColourInfo gradient_white_to_transparent_black = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)); - private static readonly ColourInfo gradient_transparent_black_to_white = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)); - private readonly Box leftBox; private readonly Box rightBox; private const float amplitude_dead_zone = 0.25f; private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; private const float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f; + private const int box_max_alpha = 200; private const double box_fade_in_time = 65; - private const int box_width = 300; + private const int box_width = 200; public MenuSideFlashes() { RelativeSizeAxes = Axes.Both; Anchor = Anchor.Centre; Origin = Anchor.Centre; - BlendingMode = BlendingMode.Additive; Children = new Drawable[] { leftBox = new Box @@ -51,7 +49,6 @@ namespace osu.Game.Screens.Menu Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = gradient_white_to_transparent_black, }, rightBox = new Box { @@ -61,40 +58,41 @@ namespace osu.Game.Screens.Menu Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = gradient_transparent_black_to_white, } }; } - private bool kiai; - private double beatLength; + [BackgroundDependencyLoader] + private void load(OsuGameBase game, OsuColour colours) + { + beatmap.BindTo(game.Beatmap); + + // linear colour looks better in this case, so let's use it for now. + Color4 gradientDark = colours.Blue.Opacity(0).ToLinear(); + Color4 gradientLight = colours.Blue.Opacity(0.3f).ToLinear(); + + leftBox.ColourInfo = ColourInfo.GradientHorizontal(gradientLight, gradientDark); + rightBox.ColourInfo = ColourInfo.GradientHorizontal(gradientDark, gradientLight); + } protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { if (newBeat < 0) return; - this.kiai = kiai; - this.beatLength = beatLength; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - flash(leftBox); + flash(leftBox, beatLength, kiai); if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - flash(rightBox); + flash(rightBox, beatLength, kiai); } - private void flash(Drawable d) + private void flash(Drawable d, double beatLength, bool kiai) { TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amp.LeftChannel : amp.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); using (d.BeginDelayedSequence(box_fade_in_time)) d.FadeOut(beatLength, EasingTypes.In); } - - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - beatmap.BindTo(game.Beatmap); - } } -} \ No newline at end of file +} From 25a48d832f2ec71e52b3df4a894d3026714a31ae Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 17:36:35 +0900 Subject: [PATCH 098/162] 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 099/162] 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 100/162] 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 7628cdf52244ab3113fa51b635387871a0d86d82 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 01:38:04 +0900 Subject: [PATCH 101/162] Return first control point in the list if the time is before it. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 5740c961b1..6809c417a4 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -82,7 +82,7 @@ namespace osu.Game.Beatmaps.ControlPoints return new T(); if (time < list[0].Time) - return new T(); + return list[0]; int index = list.BinarySearch(new T() { Time = time }); From 462bbd02bab617953b484a6a74e06bb9a71be87e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 01:38:28 +0900 Subject: [PATCH 102/162] Simplify expression. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 6809c417a4..9dba9cfa19 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -92,8 +92,6 @@ namespace osu.Game.Beatmaps.ControlPoints index = ~index; - if (index == list.Count) - return list[list.Count - 1]; return list[index - 1]; } } From f57b234cc3694ad0ff9d334624280ccfbdcf6ec5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:44:47 +0900 Subject: [PATCH 103/162] Expose Beatmap in BeatSyncedContainer --- .../Graphics/Containers/BeatSyncedContainer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 5624ca07ef..c0defceac0 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Containers { public class BeatSyncedContainer : Container { - private readonly Bindable beatmap = new Bindable(); + protected readonly Bindable Beatmap = new Bindable(); private int lastBeat; private TimingControlPoint lastTimingPoint; @@ -25,13 +25,13 @@ namespace osu.Game.Graphics.Containers protected override void Update() { - if (beatmap.Value?.Track == null) + if (Beatmap.Value?.Track == null) return; - double currentTrackTime = beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; + double currentTrackTime = Beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; - TimingControlPoint timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); - EffectControlPoint effectPoint = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); + TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); + EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); if (timingPoint.BeatLength == 0) return; @@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Containers double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength; using (BeginDelayedSequence(offsetFromBeat, true)) - OnNewBeat(beatIndex, timingPoint, effectPoint, beatmap.Value.Track.CurrentAmplitudes); + OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes); lastBeat = beatIndex; lastTimingPoint = timingPoint; @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.Containers [BackgroundDependencyLoader] private void load(OsuGameBase game) { - beatmap.BindTo(game.Beatmap); + Beatmap.BindTo(game.Beatmap); } protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) From 7e827c4f11bdf925113bf46fd777deb148798bc1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:45:01 +0900 Subject: [PATCH 104/162] Add amplitude adjust --- osu.Game/Screens/Menu/OsuLogo.cs | 150 ++++++++++++++++++------------- 1 file changed, 86 insertions(+), 64 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 8826f56180..4259165005 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Menu private readonly CircularContainer logoContainer; private readonly Container logoBounceContainer; private readonly Container logoBeatContainer; + private readonly Container logoAmplitudeContainer; private readonly Container logoHoverContainer; private SampleChannel sampleClick; @@ -112,88 +113,95 @@ namespace osu.Game.Screens.Menu } } }, - logoBeatContainer = new Container + logoAmplitudeContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new BufferedContainer + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoContainer = new CircularContainer + new BufferedContainer + { + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + logoContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.88f), + Masking = true, + Children = new Drawable[] + { + colourAndTriangles = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuPink, + }, + new Triangles + { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + }, + } + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = Color4.White, + Alpha = 0, + }, + }, + }, + logo = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + } + }, + impactContainer = new CircularContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Alpha = 0, + BorderColour = Color4.White, RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.88f), + BorderThickness = 10, Masking = true, Children = new Drawable[] { - colourAndTriangles = new Container + new Box { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuPink, - }, - new Triangles - { - TriangleScale = 4, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - }, - } - }, - flashLayer = new Box - { - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = Color4.White, + AlwaysPresent = true, Alpha = 0, - }, - }, + } + } }, - logo = new Sprite + new MenuVisualisation { Anchor = Anchor.Centre, Origin = Anchor.Centre, - }, - } - }, - impactContainer = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0, - BorderColour = Color4.White, - RelativeSizeAxes = Axes.Both, - BorderThickness = 10, - Masking = true, - Children = new Drawable[] - { - new Box - { RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - Alpha = 0, + BlendingMode = BlendingMode.Additive, + Alpha = 0.2f, } } - }, - new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Alpha = 0.2f, } } } @@ -205,43 +213,57 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(TextureStore textures, AudioManager audio) + private void load(TextureStore textures, AudioManager audio, OsuGameBase game) { sampleClick = audio.Sample.Get(@"Menu/menuhit"); logo.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo"); } + private int lastBeatIndex; + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + lastBeatIndex = beatIndex; + var beatLength = timingPoint.BeatLength; + float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); + if (beatIndex < 0) return; - logoBeatContainer.ScaleTo(0.98f, beat_in_time, EasingTypes.Out); + logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); ripple.ClearTransforms(); - ripple.ScaleTo(Vector2.One); - ripple.Alpha = 0.15f; + ripple.ScaleTo(logoAmplitudeContainer.Scale); + ripple.Alpha = 0.15f * amplitudeAdjust; - ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); - ripple.FadeOut(beatLength); + ripple.ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); + ripple.FadeOut(beatLength, EasingTypes.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); - flashLayer.FadeTo(0.14f, beat_in_time, EasingTypes.Out); + flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (flashLayer.BeginDelayedSequence(beat_in_time)) flashLayer.FadeOut(beatLength); } } + protected override void Update() + { + base.Update(); + + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0; + logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) return false; From 84499275ade05987a2b26ebb89b67ebc11c17775 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:58:07 +0900 Subject: [PATCH 105/162] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 79b335e9d4..777996fb97 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 79b335e9d4d6f8ff89524f06dbe324db3cf29513 +Subproject commit 777996fb9731ba1895a5ab1323cbbc97259ff741 From 813b09189c8f77fe272a63d32408b269e62b7e8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 02:09:31 +0900 Subject: [PATCH 106/162] Remove unused parameter --- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 4259165005..f99e7e80c8 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -213,7 +213,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(TextureStore textures, AudioManager audio, OsuGameBase game) + private void load(TextureStore textures, AudioManager audio) { sampleClick = audio.Sample.Get(@"Menu/menuhit"); logo.Texture = textures.Get(@"Menu/logo"); From 9e7f384203862921fc6ea17d807d5137eb667e22 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:18:25 +0900 Subject: [PATCH 107/162] Fix returning incorrect control points for non-timing points. --- .../Beatmaps/ControlPoints/ControlPointInfo.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 9dba9cfa19..38b175eed9 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Lists; @@ -55,7 +56,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, () => TimingPoints[0]); /// /// Finds the maximum BPM represented by any timing control point. @@ -75,14 +76,21 @@ namespace osu.Game.Beatmaps.ControlPoints public double BPMMode => 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; - private T binarySearch(SortedList list, double time) + /// + /// Binary searches one of the control point lists to find the active contro point at . + /// + /// The list to search. + /// The time to find the control point at. + /// The control point to use when is before any control points. + /// + private T binarySearch(SortedList list, double time, Func prePoint = null) where T : ControlPoint, new() { if (list.Count == 0) return new T(); if (time < list[0].Time) - return list[0]; + return prePoint?.Invoke() ?? new T(); int index = list.BinarySearch(new T() { Time = time }); From 2d1df8fd8a7c1eaaf58de8d4e42429222d0a90e4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:22:28 +0900 Subject: [PATCH 108/162] xmldoc fixes. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 38b175eed9..c8e5eba5dd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -77,12 +77,12 @@ namespace osu.Game.Beatmaps.ControlPoints 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; /// - /// Binary searches one of the control point lists to find the active contro point at . + /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. /// The control point to use when is before any control points. - /// + /// The active control point at . private T binarySearch(SortedList list, double time, Func prePoint = null) where T : ControlPoint, new() { From 41824e01796b5f4fbb4986f48a43446500c953d8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:24:10 +0900 Subject: [PATCH 109/162] Add comment. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index c8e5eba5dd..d4f1c8df4b 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -100,6 +100,8 @@ namespace osu.Game.Beatmaps.ControlPoints index = ~index; + // BinarySearch will return the index of the first element _greater_ than the search + // This is the inactive point - the active point is the one before it (index - 1) return list[index - 1]; } } From 4f17a4fe91fdf5f9e78acae54b555fc3c07617e7 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 23 May 2017 14:34:34 -0300 Subject: [PATCH 110/162] Make result counts scroll with the panels --- .../Tests/TestCaseDirect.cs | 4 +- osu.Game/Overlays/Direct/FilterControl.cs | 58 --------------- osu.Game/Overlays/DirectOverlay.cs | 72 +++++++++++++++++-- 3 files changed, 69 insertions(+), 65 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index c68796a9ab..c1f2307f20 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -23,9 +23,9 @@ namespace osu.Desktop.VisualTests.Tests Add(direct = new DirectOverlay()); newBeatmaps(); - direct.ResultCounts = new ResultCounts(1, 432, 3); - AddStep(@"Toggle", direct.ToggleVisibility); + AddStep(@"toggle", direct.ToggleVisibility); + AddStep(@"result counts", () => direct.ResultCounts = new ResultCounts(1, 4, 13)); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 185ab7c321..7d8a4a6a85 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using Container = osu.Framework.Graphics.Containers.Container; @@ -23,34 +22,16 @@ namespace osu.Game.Overlays.Direct { public static readonly float HEIGHT = 35 + 32 + 30 + padding * 2; // search + mode toggle buttons + sort tabs + padding - /// - /// The height of the content below the filter control (tab strip + result count text). - /// - public static readonly float LOWER_HEIGHT = 21; - private const float padding = 10; private readonly Box tabStrip; private readonly FillFlowContainer modeButtons; - private readonly FillFlowContainer resultCountsContainer; - private readonly OsuSpriteText resultCountsText; public readonly SearchTextBox Search; public readonly SortTabControl SortTabs; public readonly OsuEnumDropdown RankStatusDropdown; public readonly Bindable DisplayStyle = new Bindable(); - private ResultCounts resultCounts; - public ResultCounts ResultCounts - { - get { return resultCounts; } - set - { - resultCounts = value; - updateResultCounts(); - } - } - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos); public FilterControl() @@ -127,41 +108,17 @@ namespace osu.Game.Overlays.Direct }, }, }, - resultCountsContainer = new FillFlowContainer - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopLeft, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Left = DirectOverlay.WIDTH_PADDING, Top = 6 }, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = @"Found ", - TextSize = 15, - }, - resultCountsText = new OsuSpriteText - { - TextSize = 15, - Font = @"Exo2.0-Bold", - }, - } - }, }; RankStatusDropdown.Current.Value = RankStatus.RankedApproved; SortTabs.Current.Value = SortCriteria.Title; SortTabs.Current.TriggerChange(); - - updateResultCounts(); } [BackgroundDependencyLoader(true)] private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) { tabStrip.Colour = colours.Yellow; - resultCountsContainer.Colour = colours.Yellow; RankStatusDropdown.AccentColour = colours.BlueDark; var b = new Bindable(); //backup bindable incase the game is null @@ -171,21 +128,6 @@ namespace osu.Game.Overlays.Direct } } - private void updateResultCounts() - { - resultCountsContainer.FadeTo(ResultCounts == null ? 0 : 1, 200, EasingTypes.Out); - if (resultCounts == null) return; - - resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " + - pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + - pluralize(@"Tag", ResultCounts?.Tags ?? 0); - } - - private string pluralize(string prefix, int value) - { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); - } - private class DirectSearchTextBox : SearchTextBox { protected override Color4 BackgroundUnfocused => backgroundColour; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 928ab3b300..368518fc6d 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using OpenTK; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -11,6 +12,7 @@ using osu.Framework.Input; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; namespace osu.Game.Overlays @@ -21,6 +23,8 @@ namespace osu.Game.Overlays private const float panel_padding = 10f; private readonly FilterControl filter; + private readonly FillFlowContainer resultCountsContainer; + private readonly OsuSpriteText resultCountsText; private readonly FillFlowContainer panels; private IEnumerable beatmapSets; @@ -36,10 +40,17 @@ namespace osu.Game.Overlays } } + private ResultCounts resultCounts; public ResultCounts ResultCounts { - get { return filter.ResultCounts; } - set { filter.ResultCounts = value; } + get { return resultCounts; } + set + { + if (value == ResultCounts) return; + resultCounts = value; + + updateResultCounts(); + } } public DirectOverlay() @@ -88,12 +99,40 @@ namespace osu.Game.Overlays ScrollDraggerVisible = false, Children = new Drawable[] { - panels = new FillFlowContainer + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = FilterControl.LOWER_HEIGHT + panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, - Spacing = new Vector2(panel_padding), + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + resultCountsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Left = WIDTH_PADDING, Top = 6 }, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = @"Found ", + TextSize = 15, + }, + resultCountsText = new OsuSpriteText + { + TextSize = 15, + Font = @"Exo2.0-Bold", + }, + } + }, + panels = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Spacing = new Vector2(panel_padding), + }, + }, }, }, }, @@ -115,6 +154,29 @@ namespace osu.Game.Overlays filter.Search.Exit = Hide; filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; filter.DisplayStyle.ValueChanged += recreatePanels; + + updateResultCounts(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + resultCountsContainer.Colour = colours.Yellow; + } + + private void updateResultCounts() + { + resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultCounts == null) return; + + resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " + + pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + + pluralize(@"Tag", ResultCounts?.Tags ?? 0); + } + + private string pluralize(string prefix, int value) + { + return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); } private void recreatePanels(PanelDisplayStyle displayStyle) From 7b9eacc213d181bb57a9feb9add60a60021d243e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 23 May 2017 14:41:30 -0300 Subject: [PATCH 111/162] CI fixes --- osu.Game/Overlays/DirectOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 368518fc6d..0572598380 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -170,13 +170,13 @@ namespace osu.Game.Overlays if (ResultCounts == null) return; resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " + - pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + - pluralize(@"Tag", ResultCounts?.Tags ?? 0); + pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + + pluralize(@"Tag", ResultCounts?.Tags ?? 0); } private string pluralize(string prefix, int value) { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); + return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); } private void recreatePanels(PanelDisplayStyle displayStyle) From aa9a636c3c59e884f475345ff59efcb1d727e6b3 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 23 May 2017 14:42:57 -0300 Subject: [PATCH 112/162] Indentation --- osu.Game/Overlays/DirectOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0572598380..49a3a3abf9 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -170,8 +170,8 @@ namespace osu.Game.Overlays if (ResultCounts == null) return; resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " + - pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + - pluralize(@"Tag", ResultCounts?.Tags ?? 0); + pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + + pluralize(@"Tag", ResultCounts?.Tags ?? 0); } private string pluralize(string prefix, int value) From 7a4b4761218b0d44a7ea36f513763e1e717d3888 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 23 May 2017 14:46:23 -0300 Subject: [PATCH 113/162] Tab character --- osu.Game/Overlays/DirectOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 49a3a3abf9..64b7a1ac28 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -176,7 +176,7 @@ namespace osu.Game.Overlays private string pluralize(string prefix, int value) { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); + return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); } private void recreatePanels(PanelDisplayStyle displayStyle) From 0a385055dc24aae6253de7971e77106c68f7af25 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:53:08 +0900 Subject: [PATCH 114/162] Remove Func'd-ness. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index d4f1c8df4b..76ff86d5c4 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, () => TimingPoints[0]); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); /// /// Finds the maximum BPM represented by any timing control point. @@ -81,16 +81,16 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The list to search. /// The time to find the control point at. - /// The control point to use when is before any control points. + /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, Func prePoint = null) + private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { if (list.Count == 0) return new T(); if (time < list[0].Time) - return prePoint?.Invoke() ?? new T(); + return prePoint ?? new T(); int index = list.BinarySearch(new T() { Time = time }); From b477e5cd9e21dae9d6b6d97641b2777b47017f56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 02:53:21 +0900 Subject: [PATCH 115/162] Fix potential nullref --- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f99e7e80c8..116f7291e2 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -260,7 +260,7 @@ namespace osu.Game.Screens.Menu { base.Update(); - var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0; + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); } @@ -312,4 +312,4 @@ namespace osu.Game.Screens.Menu impactContainer.ScaleTo(1.12f, 250); } } -} \ No newline at end of file +} From be1ae2bd8eafa6b16494b3b4e16eff8675931b58 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 23 May 2017 15:08:02 -0300 Subject: [PATCH 116/162] Remove ??, value can never be null --- osu.Game/Overlays/DirectOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 64b7a1ac28..8fdc591371 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -169,9 +169,9 @@ namespace osu.Game.Overlays resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); if (ResultCounts == null) return; - resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " + - pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " + - pluralize(@"Tag", ResultCounts?.Tags ?? 0); + resultCountsText.Text = pluralize(@"Artist", ResultCounts.Artists) + ", " + + pluralize(@"Song", ResultCounts.Songs) + ", " + + pluralize(@"Tag", ResultCounts.Tags); } private string pluralize(string prefix, int value) From 09adb23591fb4b393dde7ca84d919c0ff3c8aaa7 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:22:30 +0200 Subject: [PATCH 117/162] Fix scheduled task not being canceled --- osu.Game/Screens/Select/SongSelect.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e9ead7c9c0..eb5fb6d258 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -319,7 +319,10 @@ namespace osu.Game.Screens.Select bool beatmapSetChange = false; if (beatmap.Equals(Beatmap?.BeatmapInfo)) + { + selectionChangedDebounce?.Cancel(); return; + } if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -330,7 +333,7 @@ namespace osu.Game.Screens.Select } selectionChangeNoBounce = beatmap; - + selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { From 0616256bd06f32b6199a6e883afca839505eff57 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:23:52 +0200 Subject: [PATCH 118/162] CI fix --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eb5fb6d258..7c45738d59 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -333,7 +333,7 @@ namespace osu.Game.Screens.Select } selectionChangeNoBounce = beatmap; - + selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { From 67774192dd5635c9777c103afc5da6b475cc778f Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:30:32 +0200 Subject: [PATCH 119/162] Formatting fixes --- osu.Game/Screens/Select/SongSelect.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 7c45738d59..d0c5e1adfd 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -316,13 +316,12 @@ namespace osu.Game.Screens.Select /// private void selectionChanged(BeatmapInfo beatmap) { - bool beatmapSetChange = false; + selectionChangedDebounce?.Cancel(); if (beatmap.Equals(Beatmap?.BeatmapInfo)) - { - selectionChangedDebounce?.Cancel(); return; - } + + bool beatmapSetChange = false; if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -334,7 +333,6 @@ namespace osu.Game.Screens.Select selectionChangeNoBounce = beatmap; - selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap); From 24f64c881556e46ef210c76f38d883aed9a79b51 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:38:05 +0200 Subject: [PATCH 120/162] More formatting --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 2d6d212130..130642b9c7 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -170,8 +170,8 @@ namespace osu.Game.Screens.Select List visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden).ToList(); if (visibleGroups.Count < 1) return; - BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; + BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)]; selectGroup(group, panel); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index d0c5e1adfd..41fa53e8a3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -322,7 +322,6 @@ namespace osu.Game.Screens.Select return; bool beatmapSetChange = false; - if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else From 207d6e4ac3f2303000bdb48ed7bbc12a1439071e Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Tue, 23 May 2017 20:01:20 -0500 Subject: [PATCH 121/162] Update to new syntax of OnNewBeat --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index ced6d179d6..0cf1fa54fa 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -3,17 +3,17 @@ using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Game.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Timing; -using System; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; -using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; +using osu.Game.Graphics.Containers; +using System; namespace osu.Game.Screens.Menu { @@ -75,22 +75,20 @@ namespace osu.Game.Screens.Menu rightBox.ColourInfo = ColourInfo.GradientHorizontal(gradientDark, gradientLight); } - protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { - if (newBeat < 0) + if (beatIndex < 0) return; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - flash(leftBox, beatLength, kiai); - if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - flash(rightBox, beatLength, kiai); + if (effectPoint.KiaiMode ? beatIndex % 2 == 0 : beatIndex % (int)timingPoint.TimeSignature == 0) + flash(leftBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes); + if (effectPoint.KiaiMode ? beatIndex % 2 == 1 : beatIndex % (int)timingPoint.TimeSignature == 0) + flash(rightBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes); } - private void flash(Drawable d, double beatLength, bool kiai) + private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) { - TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - - d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amp.LeftChannel : amp.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); using (d.BeginDelayedSequence(box_fade_in_time)) d.FadeOut(beatLength, EasingTypes.In); } From 53f489b447c1108d67d7f666387ac42c00cc3b86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 11:50:12 +0900 Subject: [PATCH 122/162] Remove using --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 76ff86d5c4..acf90931ac 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.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 System; using System.Collections.Generic; using System.Linq; using osu.Framework.Lists; From 247d8e9b21edb038de7a7869c349d5797d34f92e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 00:23:48 -0300 Subject: [PATCH 123/162] Replace "Connected as _" in login form with a UserPanel --- osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs | 4 ++-- .../Overlays/Settings/Sections/General/LoginSettings.cs | 7 +++++-- osu.Game/Users/UserPanel.cs | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index 7c2745ee0f..254c5bc243 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -33,14 +33,14 @@ namespace osu.Desktop.VisualTests.Tests Id = 3103765, Country = new Country { FlagName = @"JP" }, CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg" - }), + }) { Width = 300 }, peppy = new UserPanel(new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }, CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg" - }), + }) { Width = 300 }, }, }); diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 86a47d8a95..73521a31c3 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; using osu.Framework.Input; +using osu.Game.Users; namespace osu.Game.Overlays.Settings.Sections.General { @@ -71,11 +72,12 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: + UserPanel p; Children = new Drawable[] { - new OsuSpriteText + p = new UserPanel(api.LocalUser.Value) { - Text = $"Connected as {api.Username}!", + RelativeSizeAxes = Axes.X, }, new OsuButton { @@ -84,6 +86,7 @@ namespace osu.Game.Overlays.Settings.Sections.General Action = api.Logout } }; + p.Status.Value = new UserStatusOnline(); break; } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 3502443d49..f32158e00b 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -30,7 +30,6 @@ namespace osu.Game.Users public UserPanel(User user) { - Width = 300; Height = height; Masking = true; CornerRadius = 5; From 2be1b00a766d063305575522f345183eb64dd81f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 00:45:56 -0300 Subject: [PATCH 124/162] Hide status bar when Status is null --- .../Tests/TestCaseUserPanel.cs | 1 + .../Settings/Sections/General/LoginSettings.cs | 4 +--- osu.Game/Users/UserPanel.cs | 17 ++++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index 254c5bc243..513bf24e0d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -51,6 +51,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); }); AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); }); AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); }); + AddStep(@"null status", () => { flyte.Status.Value = null; }); } } } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 73521a31c3..d94388ed87 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -72,10 +72,9 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: - UserPanel p; Children = new Drawable[] { - p = new UserPanel(api.LocalUser.Value) + new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X, }, @@ -86,7 +85,6 @@ namespace osu.Game.Overlays.Settings.Sections.General Action = api.Logout } }; - p.Status.Value = new UserStatusOnline(); break; } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index f32158e00b..df37b339c3 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -23,6 +23,7 @@ namespace osu.Game.Users private OsuColour colours; + private readonly Container statusBar; private readonly Box statusBg; private readonly OsuSpriteText statusMessage; @@ -30,7 +31,7 @@ namespace osu.Game.Users public UserPanel(User user) { - Height = height; + Height = height - status_height; Masking = true; CornerRadius = 5; EdgeEffect = new EdgeEffect @@ -54,8 +55,9 @@ namespace osu.Game.Users }, new Container { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = content_padding, Bottom = status_height + content_padding, Left = content_padding, Right = content_padding }, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = content_padding, Left = content_padding, Right = content_padding }, Children = new Drawable[] { new UpdateableAvatar @@ -114,12 +116,12 @@ namespace osu.Game.Users }, }, }, - new Container + statusBar = new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Height = status_height, + Alpha = 0f, Children = new Drawable[] { statusBg = new Box @@ -174,6 +176,11 @@ namespace osu.Game.Users private void displayStatus(UserStatus status) { + statusBar.ResizeHeightTo(status == null ? 0f : status_height, 500, EasingTypes.OutQuint); + statusBar.FadeTo(status == null ? 0f : 1f, 500, EasingTypes.OutQuint); + ResizeHeightTo(status == null ? height - status_height : height, 500, EasingTypes.OutQuint); + if (status == null) return; + statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); statusMessage.Text = status.Message; } From a9d1e54c27f6f5778c208d6c79ec7c866e44931e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:05:11 +0900 Subject: [PATCH 125/162] Adjust triangle movement based on amplitude --- osu.Game/Graphics/Backgrounds/Triangles.cs | 7 ++++++- osu.Game/Screens/Menu/OsuLogo.cs | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 830d0adc97..5cca57be8a 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -44,6 +44,11 @@ namespace osu.Game.Graphics.Backgrounds /// public bool HideAlphaDiscrepancies = true; + /// + /// The relative velocity of the triangles. Default is 1. + /// + public float Velocity = 1; + public float TriangleScale { get { return triangleScale; } @@ -78,7 +83,7 @@ namespace osu.Game.Graphics.Backgrounds foreach (var t in Children) { t.Alpha = adjustedAlpha; - t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale); + t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale * Velocity); if (ExpireOffScreenTriangles && t.DrawPosition.Y + t.DrawSize.Y * t.Scale.Y < 0) t.Expire(); } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 116f7291e2..3bd27073c6 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; @@ -38,6 +39,8 @@ namespace osu.Game.Screens.Menu private readonly Container colourAndTriangles; + private Triangles triangles; + public Action Action; public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.74f; @@ -149,7 +152,7 @@ namespace osu.Game.Screens.Menu RelativeSizeAxes = Axes.Both, Colour = OsuPink, }, - new Triangles + triangles = new Triangles { TriangleScale = 4, ColourLight = OsuColour.FromHex(@"ff7db7"), @@ -260,8 +263,14 @@ namespace osu.Game.Screens.Menu { base.Update(); + const float velocity_adjust_cutoff = 0.98f; var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + + if (maxAmplitude > velocity_adjust_cutoff) + triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50; + else + triangles.Velocity = (float)Interpolation.Damp(triangles.Velocity, 1, 0.995f, Time.Elapsed); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 16d9a677d0b66359c00a82d0962aa17335972e14 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:05:28 +0900 Subject: [PATCH 126/162] Add a low-end cutoff for scale adjust --- osu.Game/Screens/Menu/OsuLogo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 3bd27073c6..b1979063dd 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -263,9 +263,11 @@ namespace osu.Game.Screens.Menu { base.Update(); + const float scale_adjust_cutoff = 0.4f; const float velocity_adjust_cutoff = 0.98f; + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; - logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint); if (maxAmplitude > velocity_adjust_cutoff) triangles.Velocity = 1 + Math.Max(0, maxAmplitude - velocity_adjust_cutoff) * 50; From 03f9a863668e960c235cd955688a19cff3fe0abd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:29:12 +0900 Subject: [PATCH 127/162] Add missing readonly --- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index b1979063dd..44b7b6bceb 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Menu private readonly Container colourAndTriangles; - private Triangles triangles; + private readonly Triangles triangles; public Action Action; From 15ee2b802ee94bbb7306acf4d3b8edc31023be6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:41:07 +0900 Subject: [PATCH 128/162] Hide direct overlay when requested --- osu.Game/OsuGame.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 96e4910f1e..886ff4f8d1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -288,6 +288,7 @@ namespace osu.Game Toolbar.State = Visibility.Hidden; musicController.State = Visibility.Hidden; chat.State = Visibility.Hidden; + direct.State = Visibility.Hidden; } else { From 5e0194077006416718752493291a67f2a07bacaa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 13:43:10 +0900 Subject: [PATCH 129/162] Compare with private field --- osu.Game/Overlays/DirectOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 8fdc591371..62b57d29e3 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays get { return resultCounts; } set { - if (value == ResultCounts) return; + if (value == resultCounts) return; resultCounts = value; updateResultCounts(); From b08668b6d916de4dcedfc366d650066a2915aff2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:19:45 -0300 Subject: [PATCH 130/162] Remove @ from to-be-localized strings --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +-- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 +-- osu.Game/Overlays/Direct/FilterControl.cs | 5 ++-- osu.Game/Overlays/DirectOverlay.cs | 28 ++++++++++----------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 63298052c3..4be68157d7 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = @"mapped by ", + Text = "mapped by ", TextSize = 14, Shadow = false, Colour = colours.Gray5, @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = $@"from {SetInfo.Metadata.Source}", + Text = $"from {SetInfo.Metadata.Source}", TextSize = 14, Shadow = false, Colour = colours.Gray5, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 02930a9e7b..48636a5228 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = @"mapped by ", + Text = "mapped by ", TextSize = 14, }, new OsuSpriteText @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Direct }, new OsuSpriteText { - Text = $@"from {SetInfo.Metadata.Source}", + Text = $"from {SetInfo.Metadata.Source}", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 14, diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 7d8a4a6a85..031ca997b8 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -51,8 +51,7 @@ namespace osu.Game.Overlays.Direct tabStrip = new Box { Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Position = new Vector2(0f, 1f), + Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.X, Height = 1, }, @@ -87,7 +86,7 @@ namespace osu.Game.Overlays.Direct Origin = Anchor.TopRight, Spacing = new Vector2(10f, 0f), Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Top = Height - SlimEnumDropdown.HEIGHT - padding, Right = DirectOverlay.WIDTH_PADDING }, + Margin = new MarginPadding { Top = HEIGHT - SlimEnumDropdown.HEIGHT - padding, Right = DirectOverlay.WIDTH_PADDING }, Children = new Drawable[] { new FillFlowContainer diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 8fdc591371..5485ea3c15 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays private const float panel_padding = 10f; private readonly FilterControl filter; - private readonly FillFlowContainer resultCountsContainer; + private readonly FillFlowContainer resultCountsContainer; private readonly OsuSpriteText resultCountsText; private readonly FillFlowContainer panels; @@ -115,7 +115,7 @@ namespace osu.Game.Overlays { new OsuSpriteText { - Text = @"Found ", + Text = "Found ", TextSize = 15, }, resultCountsText = new OsuSpriteText @@ -164,18 +164,18 @@ namespace osu.Game.Overlays resultCountsContainer.Colour = colours.Yellow; } - private void updateResultCounts() - { - resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); - if (ResultCounts == null) return; - - resultCountsText.Text = pluralize(@"Artist", ResultCounts.Artists) + ", " + - pluralize(@"Song", ResultCounts.Songs) + ", " + - pluralize(@"Tag", ResultCounts.Tags); - } - - private string pluralize(string prefix, int value) - { + private void updateResultCounts() + { + resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultCounts == null) return; + + resultCountsText.Text = pluralize("Artist", ResultCounts.Artists) + ", " + + pluralize("Song", ResultCounts.Songs) + ", " + + pluralize("Tag", ResultCounts.Tags); + } + + private string pluralize(string prefix, int value) + { return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); } From 4490596f5f171f987b0b8a88a8c1f4a93adf5b73 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:37:27 -0300 Subject: [PATCH 131/162] Keep one object per file --- .../Tests/TestCaseDirect.cs | 2 +- osu.Game/Database/RankStatus.cs | 23 ++++++++ osu.Game/Overlays/Direct/FilterControl.cs | 55 +++---------------- osu.Game/Overlays/DirectOverlay.cs | 36 +++++++++--- osu.Game/osu.Game.csproj | 1 + 5 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 osu.Game/Database/RankStatus.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index c1f2307f20..4ddf361087 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -25,7 +25,7 @@ namespace osu.Desktop.VisualTests.Tests newBeatmaps(); AddStep(@"toggle", direct.ToggleVisibility); - AddStep(@"result counts", () => direct.ResultCounts = new ResultCounts(1, 4, 13)); + AddStep(@"result counts", () => direct.ResultAmounts = new DirectOverlay.ResultCounts(1, 4, 13)); } [BackgroundDependencyLoader] diff --git a/osu.Game/Database/RankStatus.cs b/osu.Game/Database/RankStatus.cs new file mode 100644 index 0000000000..b333292a07 --- /dev/null +++ b/osu.Game/Database/RankStatus.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; + +namespace osu.Game.Database +{ + public enum RankStatus + { + Any = 7, + [Description("Ranked & Approved")] + RankedApproved = 0, + Approved = 1, + Loved = 8, + Favourites = 2, + [Description("Mod Requests")] + ModRequests = 3, + Pending = 4, + Graveyard = 5, + [Description("My Maps")] + MyMaps = 6, + } +} diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 031ca997b8..735e14b8c1 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.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 System.ComponentModel; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -14,8 +13,6 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using Container = osu.Framework.Graphics.Containers.Container; - namespace osu.Game.Overlays.Direct { public class FilterControl : Container @@ -30,7 +27,7 @@ namespace osu.Game.Overlays.Direct public readonly SearchTextBox Search; public readonly SortTabControl SortTabs; public readonly OsuEnumDropdown RankStatusDropdown; - public readonly Bindable DisplayStyle = new Bindable(); + public readonly Bindable DisplayStyle = new Bindable(); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos); @@ -38,7 +35,7 @@ namespace osu.Game.Overlays.Direct { RelativeSizeAxes = Axes.X; Height = HEIGHT; - DisplayStyle.Value = PanelDisplayStyle.Grid; + DisplayStyle.Value = DirectOverlay.PanelDisplayStyle.Grid; Children = new Drawable[] { @@ -96,8 +93,8 @@ namespace osu.Game.Overlays.Direct Direction = FillDirection.Horizontal, Children = new[] { - new DisplayStyleToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle), - new DisplayStyleToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.fa_th_large, DirectOverlay.PanelDisplayStyle.Grid, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.fa_list_ul, DirectOverlay.PanelDisplayStyle.List, DisplayStyle), }, }, RankStatusDropdown = new SlimEnumDropdown @@ -195,10 +192,10 @@ namespace osu.Game.Overlays.Direct private class DisplayStyleToggleButton : ClickableContainer { private readonly TextAwesome icon; - private readonly PanelDisplayStyle style; - private readonly Bindable bindable; + private readonly DirectOverlay.PanelDisplayStyle style; + private readonly Bindable bindable; - public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable bindable) + public DisplayStyleToggleButton(FontAwesome icon, DirectOverlay.PanelDisplayStyle style, Bindable bindable) { this.bindable = bindable; this.style = style; @@ -222,7 +219,7 @@ namespace osu.Game.Overlays.Direct Action = () => bindable.Value = this.style; } - private void Bindable_ValueChanged(PanelDisplayStyle style) + private void Bindable_ValueChanged(DirectOverlay.PanelDisplayStyle style) { icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); } @@ -233,40 +230,4 @@ namespace osu.Game.Overlays.Direct } } } - - public class ResultCounts - { - public readonly int Artists; - public readonly int Songs; - public readonly int Tags; - - public ResultCounts(int artists, int songs, int tags) - { - Artists = artists; - Songs = songs; - Tags = tags; - } - } - - public enum RankStatus - { - Any, - [Description("Ranked & Approved")] - RankedApproved, - Approved, - Loved, - Favourites, - [Description("Mod Requests")] - ModRequests, - Pending, - Graveyard, - [Description("My Maps")] - MyMaps, - } - - public enum PanelDisplayStyle - { - Grid, - List, - } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 5485ea3c15..c1a0e1db79 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -15,6 +15,8 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; +using Container = osu.Framework.Graphics.Containers.Container; + namespace osu.Game.Overlays { public class DirectOverlay : WaveOverlayContainer @@ -41,12 +43,12 @@ namespace osu.Game.Overlays } private ResultCounts resultCounts; - public ResultCounts ResultCounts + public ResultCounts ResultAmounts { get { return resultCounts; } set { - if (value == ResultCounts) return; + if (value == ResultAmounts) return; resultCounts = value; updateResultCounts(); @@ -166,12 +168,12 @@ namespace osu.Game.Overlays private void updateResultCounts() { - resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); - if (ResultCounts == null) return; + resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultAmounts == null) return; - resultCountsText.Text = pluralize("Artist", ResultCounts.Artists) + ", " + - pluralize("Song", ResultCounts.Songs) + ", " + - pluralize("Tag", ResultCounts.Tags); + resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + + pluralize("Song", ResultAmounts.Songs) + ", " + + pluralize("Tag", ResultAmounts.Tags); } private string pluralize(string prefix, int value) @@ -204,5 +206,25 @@ namespace osu.Game.Overlays filter.Search.HoldFocus = false; } + + public class ResultCounts + { + public readonly int Artists; + public readonly int Songs; + public readonly int Tags; + + public ResultCounts(int artists, int songs, int tags) + { + Artists = artists; + Songs = songs; + Tags = tags; + } + } + + public enum PanelDisplayStyle + { + Grid, + List, + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1fb2658679..f6779c2701 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -439,6 +439,7 @@ + From e59c1879a272b975bd70c72529412bb333371e9e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:38:55 -0300 Subject: [PATCH 132/162] Remove tabs --- osu.Game/Database/RankStatus.cs | 24 ++++++++++++------------ osu.Game/Overlays/DirectOverlay.cs | 18 +++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/osu.Game/Database/RankStatus.cs b/osu.Game/Database/RankStatus.cs index b333292a07..d18949f5bd 100644 --- a/osu.Game/Database/RankStatus.cs +++ b/osu.Game/Database/RankStatus.cs @@ -7,17 +7,17 @@ namespace osu.Game.Database { public enum RankStatus { - Any = 7, - [Description("Ranked & Approved")] - RankedApproved = 0, - Approved = 1, - Loved = 8, - Favourites = 2, - [Description("Mod Requests")] - ModRequests = 3, - Pending = 4, - Graveyard = 5, - [Description("My Maps")] - MyMaps = 6, + Any = 7, + [Description("Ranked & Approved")] + RankedApproved = 0, + Approved = 1, + Loved = 8, + Favourites = 2, + [Description("Mod Requests")] + ModRequests = 3, + Pending = 4, + Graveyard = 5, + [Description("My Maps")] + MyMaps = 6, } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index c1a0e1db79..f9c76cf80f 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -209,16 +209,16 @@ namespace osu.Game.Overlays public class ResultCounts { - public readonly int Artists; - public readonly int Songs; - public readonly int Tags; + public readonly int Artists; + public readonly int Songs; + public readonly int Tags; - public ResultCounts(int artists, int songs, int tags) - { - Artists = artists; - Songs = songs; - Tags = tags; - } + public ResultCounts(int artists, int songs, int tags) + { + Artists = artists; + Songs = songs; + Tags = tags; + } } public enum PanelDisplayStyle From 72c995921587a38d3abb6ea664e5c549adabe442 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:40:34 -0300 Subject: [PATCH 133/162] resultCounts -> ResultAmounts --- osu.Game/Overlays/DirectOverlay.cs | 460 ++++++++++++++--------------- 1 file changed, 230 insertions(+), 230 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 1f0905bc7c..7517ff2066 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -1,230 +1,230 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using System.Linq; -using OpenTK; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Database; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Direct; - -using Container = osu.Framework.Graphics.Containers.Container; - -namespace osu.Game.Overlays -{ - public class DirectOverlay : WaveOverlayContainer - { - public static readonly int WIDTH_PADDING = 80; - private const float panel_padding = 10f; - - private readonly FilterControl filter; - private readonly FillFlowContainer resultCountsContainer; - private readonly OsuSpriteText resultCountsText; - private readonly FillFlowContainer panels; - - private IEnumerable beatmapSets; - public IEnumerable BeatmapSets - { - get { return beatmapSets; } - set - { - if (beatmapSets?.Equals(value) ?? false) return; - beatmapSets = value; - - recreatePanels(filter.DisplayStyle.Value); - } - } - - private ResultCounts resultCounts; - public ResultCounts ResultAmounts - { - get { return resultCounts; } - set - { - if (value == ResultAmounts) return; - resultCounts = value; - - updateResultCounts(); - } - } - - public DirectOverlay() - { - RelativeSizeAxes = Axes.Both; - - // osu!direct colours are not part of the standard palette - - FirstWaveColour = OsuColour.FromHex(@"19b0e2"); - SecondWaveColour = OsuColour.FromHex(@"2280a2"); - ThirdWaveColour = OsuColour.FromHex(@"005774"); - FourthWaveColour = OsuColour.FromHex(@"003a4e"); - - Header header; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"485e74"), - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new[] - { - new Triangles - { - RelativeSizeAxes = Axes.Both, - TriangleScale = 5, - ColourLight = OsuColour.FromHex(@"465b71"), - ColourDark = OsuColour.FromHex(@"3f5265"), - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, - Children = new[] - { - new ScrollContainer - { - RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, - Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - resultCountsContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Left = WIDTH_PADDING, Top = 6 }, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "Found ", - TextSize = 15, - }, - resultCountsText = new OsuSpriteText - { - TextSize = 15, - Font = @"Exo2.0-Bold", - }, - } - }, - panels = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, - Spacing = new Vector2(panel_padding), - }, - }, - }, - }, - }, - }, - }, - filter = new FilterControl - { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = Header.HEIGHT }, - }, - header = new Header - { - RelativeSizeAxes = Axes.X, - }, - }; - - header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) filter.Search.Current.Value = string.Empty; }; - - filter.Search.Exit = Hide; - filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; - filter.DisplayStyle.ValueChanged += recreatePanels; - - updateResultCounts(); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - resultCountsContainer.Colour = colours.Yellow; - } - - private void updateResultCounts() - { - resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); - if (ResultAmounts == null) return; - - resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + - pluralize("Song", ResultAmounts.Songs) + ", " + - pluralize("Tag", ResultAmounts.Tags); - } - - private string pluralize(string prefix, int value) - { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); - } - - private void recreatePanels(PanelDisplayStyle displayStyle) - { - if (BeatmapSets == null) return; - panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); - } - - protected override bool OnFocus(InputState state) - { - filter.Search.TriggerFocus(); - return false; - } - - protected override void PopIn() - { - base.PopIn(); - - filter.Search.HoldFocus = true; - } - - protected override void PopOut() - { - base.PopOut(); - - filter.Search.HoldFocus = false; - } - - public class ResultCounts - { - public readonly int Artists; - public readonly int Songs; - public readonly int Tags; - - public ResultCounts(int artists, int songs, int tags) - { - Artists = artists; - Songs = songs; - Tags = tags; - } - } - - public enum PanelDisplayStyle - { - Grid, - List, - } - } -} +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Direct; + +using Container = osu.Framework.Graphics.Containers.Container; + +namespace osu.Game.Overlays +{ + public class DirectOverlay : WaveOverlayContainer + { + public static readonly int WIDTH_PADDING = 80; + private const float panel_padding = 10f; + + private readonly FilterControl filter; + private readonly FillFlowContainer resultCountsContainer; + private readonly OsuSpriteText resultCountsText; + private readonly FillFlowContainer panels; + + private IEnumerable beatmapSets; + public IEnumerable BeatmapSets + { + get { return beatmapSets; } + set + { + if (beatmapSets?.Equals(value) ?? false) return; + beatmapSets = value; + + recreatePanels(filter.DisplayStyle.Value); + } + } + + private ResultCounts resultAmounts; + public ResultCounts ResultAmounts + { + get { return resultAmounts; } + set + { + if (value == ResultAmounts) return; + resultAmounts = value; + + updateResultCounts(); + } + } + + public DirectOverlay() + { + RelativeSizeAxes = Axes.Both; + + // osu!direct colours are not part of the standard palette + + FirstWaveColour = OsuColour.FromHex(@"19b0e2"); + SecondWaveColour = OsuColour.FromHex(@"2280a2"); + ThirdWaveColour = OsuColour.FromHex(@"005774"); + FourthWaveColour = OsuColour.FromHex(@"003a4e"); + + Header header; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"485e74"), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 5, + ColourLight = OsuColour.FromHex(@"465b71"), + ColourDark = OsuColour.FromHex(@"3f5265"), + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, + Children = new[] + { + new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + resultCountsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Left = WIDTH_PADDING, Top = 6 }, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Found ", + TextSize = 15, + }, + resultCountsText = new OsuSpriteText + { + TextSize = 15, + Font = @"Exo2.0-Bold", + }, + } + }, + panels = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Spacing = new Vector2(panel_padding), + }, + }, + }, + }, + }, + }, + }, + filter = new FilterControl + { + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = Header.HEIGHT }, + }, + header = new Header + { + RelativeSizeAxes = Axes.X, + }, + }; + + header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) filter.Search.Current.Value = string.Empty; }; + + filter.Search.Exit = Hide; + filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; + filter.DisplayStyle.ValueChanged += recreatePanels; + + updateResultCounts(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + resultCountsContainer.Colour = colours.Yellow; + } + + private void updateResultCounts() + { + resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultAmounts == null) return; + + resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + + pluralize("Song", ResultAmounts.Songs) + ", " + + pluralize("Tag", ResultAmounts.Tags); + } + + private string pluralize(string prefix, int value) + { + return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); + } + + private void recreatePanels(PanelDisplayStyle displayStyle) + { + if (BeatmapSets == null) return; + panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); + } + + protected override bool OnFocus(InputState state) + { + filter.Search.TriggerFocus(); + return false; + } + + protected override void PopIn() + { + base.PopIn(); + + filter.Search.HoldFocus = true; + } + + protected override void PopOut() + { + base.PopOut(); + + filter.Search.HoldFocus = false; + } + + public class ResultCounts + { + public readonly int Artists; + public readonly int Songs; + public readonly int Tags; + + public ResultCounts(int artists, int songs, int tags) + { + Artists = artists; + Songs = songs; + Tags = tags; + } + } + + public enum PanelDisplayStyle + { + Grid, + List, + } + } +} From 4224143136f4136ada12c60e05f4e2d499051b9c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 14:53:28 +0900 Subject: [PATCH 134/162] 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 a25c504965114a69cb3a30bc2a6adc6e8ba805ff Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:41:51 -0300 Subject: [PATCH 135/162] CI fixes --- .../Tests/TestCaseDirect.cs | 1 - osu.Game/Database/RankStatus.cs | 30 +- osu.Game/Overlays/DirectOverlay.cs | 460 +++++++++--------- 3 files changed, 245 insertions(+), 246 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 4ddf361087..4cda14559f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Overlays; -using osu.Game.Overlays.Direct; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Game/Database/RankStatus.cs b/osu.Game/Database/RankStatus.cs index d18949f5bd..f2a7d67a40 100644 --- a/osu.Game/Database/RankStatus.cs +++ b/osu.Game/Database/RankStatus.cs @@ -1,23 +1,23 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; namespace osu.Game.Database { - public enum RankStatus - { - Any = 7, - [Description("Ranked & Approved")] - RankedApproved = 0, - Approved = 1, - Loved = 8, - Favourites = 2, - [Description("Mod Requests")] - ModRequests = 3, - Pending = 4, - Graveyard = 5, - [Description("My Maps")] + public enum RankStatus + { + Any = 7, + [Description("Ranked & Approved")] + RankedApproved = 0, + Approved = 1, + Loved = 8, + Favourites = 2, + [Description("Mod Requests")] + ModRequests = 3, + Pending = 4, + Graveyard = 5, + [Description("My Maps")] MyMaps = 6, } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 7517ff2066..0930c825b6 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -1,230 +1,230 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using System.Linq; -using OpenTK; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Game.Database; -using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Direct; - -using Container = osu.Framework.Graphics.Containers.Container; - -namespace osu.Game.Overlays -{ - public class DirectOverlay : WaveOverlayContainer - { - public static readonly int WIDTH_PADDING = 80; - private const float panel_padding = 10f; - - private readonly FilterControl filter; - private readonly FillFlowContainer resultCountsContainer; - private readonly OsuSpriteText resultCountsText; - private readonly FillFlowContainer panels; - - private IEnumerable beatmapSets; - public IEnumerable BeatmapSets - { - get { return beatmapSets; } - set - { - if (beatmapSets?.Equals(value) ?? false) return; - beatmapSets = value; - - recreatePanels(filter.DisplayStyle.Value); - } - } - - private ResultCounts resultAmounts; - public ResultCounts ResultAmounts - { - get { return resultAmounts; } - set - { - if (value == ResultAmounts) return; - resultAmounts = value; - - updateResultCounts(); - } - } - - public DirectOverlay() - { - RelativeSizeAxes = Axes.Both; - - // osu!direct colours are not part of the standard palette - - FirstWaveColour = OsuColour.FromHex(@"19b0e2"); - SecondWaveColour = OsuColour.FromHex(@"2280a2"); - ThirdWaveColour = OsuColour.FromHex(@"005774"); - FourthWaveColour = OsuColour.FromHex(@"003a4e"); - - Header header; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"485e74"), - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new[] - { - new Triangles - { - RelativeSizeAxes = Axes.Both, - TriangleScale = 5, - ColourLight = OsuColour.FromHex(@"465b71"), - ColourDark = OsuColour.FromHex(@"3f5265"), - }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, - Children = new[] - { - new ScrollContainer - { - RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, - Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - resultCountsContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Left = WIDTH_PADDING, Top = 6 }, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "Found ", - TextSize = 15, - }, - resultCountsText = new OsuSpriteText - { - TextSize = 15, - Font = @"Exo2.0-Bold", - }, - } - }, - panels = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, - Spacing = new Vector2(panel_padding), - }, - }, - }, - }, - }, - }, - }, - filter = new FilterControl - { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = Header.HEIGHT }, - }, - header = new Header - { - RelativeSizeAxes = Axes.X, - }, - }; - - header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) filter.Search.Current.Value = string.Empty; }; - - filter.Search.Exit = Hide; - filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; - filter.DisplayStyle.ValueChanged += recreatePanels; - - updateResultCounts(); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - resultCountsContainer.Colour = colours.Yellow; - } - - private void updateResultCounts() - { - resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); - if (ResultAmounts == null) return; - - resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + - pluralize("Song", ResultAmounts.Songs) + ", " + - pluralize("Tag", ResultAmounts.Tags); - } - - private string pluralize(string prefix, int value) - { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); - } - - private void recreatePanels(PanelDisplayStyle displayStyle) - { - if (BeatmapSets == null) return; - panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); - } - - protected override bool OnFocus(InputState state) - { - filter.Search.TriggerFocus(); - return false; - } - - protected override void PopIn() - { - base.PopIn(); - - filter.Search.HoldFocus = true; - } - - protected override void PopOut() - { - base.PopOut(); - - filter.Search.HoldFocus = false; - } - - public class ResultCounts - { - public readonly int Artists; - public readonly int Songs; - public readonly int Tags; - - public ResultCounts(int artists, int songs, int tags) - { - Artists = artists; - Songs = songs; - Tags = tags; - } - } - - public enum PanelDisplayStyle - { - Grid, - List, - } - } -} +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Direct; + +using Container = osu.Framework.Graphics.Containers.Container; + +namespace osu.Game.Overlays +{ + public class DirectOverlay : WaveOverlayContainer + { + public static readonly int WIDTH_PADDING = 80; + private const float panel_padding = 10f; + + private readonly FilterControl filter; + private readonly FillFlowContainer resultCountsContainer; + private readonly OsuSpriteText resultCountsText; + private readonly FillFlowContainer panels; + + private IEnumerable beatmapSets; + public IEnumerable BeatmapSets + { + get { return beatmapSets; } + set + { + if (beatmapSets?.Equals(value) ?? false) return; + beatmapSets = value; + + recreatePanels(filter.DisplayStyle.Value); + } + } + + private ResultCounts resultAmounts; + public ResultCounts ResultAmounts + { + get { return resultAmounts; } + set + { + if (value == ResultAmounts) return; + resultAmounts = value; + + updateResultCounts(); + } + } + + public DirectOverlay() + { + RelativeSizeAxes = Axes.Both; + + // osu!direct colours are not part of the standard palette + + FirstWaveColour = OsuColour.FromHex(@"19b0e2"); + SecondWaveColour = OsuColour.FromHex(@"2280a2"); + ThirdWaveColour = OsuColour.FromHex(@"005774"); + FourthWaveColour = OsuColour.FromHex(@"003a4e"); + + Header header; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"485e74"), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 5, + ColourLight = OsuColour.FromHex(@"465b71"), + ColourDark = OsuColour.FromHex(@"3f5265"), + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, + Children = new[] + { + new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + resultCountsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Left = WIDTH_PADDING, Top = 6 }, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Found ", + TextSize = 15, + }, + resultCountsText = new OsuSpriteText + { + TextSize = 15, + Font = @"Exo2.0-Bold", + }, + } + }, + panels = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Spacing = new Vector2(panel_padding), + }, + }, + }, + }, + }, + }, + }, + filter = new FilterControl + { + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = Header.HEIGHT }, + }, + header = new Header + { + RelativeSizeAxes = Axes.X, + }, + }; + + header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) filter.Search.Current.Value = string.Empty; }; + + filter.Search.Exit = Hide; + filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; }; + filter.DisplayStyle.ValueChanged += recreatePanels; + + updateResultCounts(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + resultCountsContainer.Colour = colours.Yellow; + } + + private void updateResultCounts() + { + resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultAmounts == null) return; + + resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + + pluralize("Song", ResultAmounts.Songs) + ", " + + pluralize("Tag", ResultAmounts.Tags); + } + + private string pluralize(string prefix, int value) + { + return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); + } + + private void recreatePanels(PanelDisplayStyle displayStyle) + { + if (BeatmapSets == null) return; + panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); + } + + protected override bool OnFocus(InputState state) + { + filter.Search.TriggerFocus(); + return false; + } + + protected override void PopIn() + { + base.PopIn(); + + filter.Search.HoldFocus = true; + } + + protected override void PopOut() + { + base.PopOut(); + + filter.Search.HoldFocus = false; + } + + public class ResultCounts + { + public readonly int Artists; + public readonly int Songs; + public readonly int Tags; + + public ResultCounts(int artists, int songs, int tags) + { + Artists = artists; + Songs = songs; + Tags = tags; + } + } + + public enum PanelDisplayStyle + { + Grid, + List, + } + } +} From 445b469e47fe81acc9a99b2d2f2d375eec4ed1d3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 15:22:46 +0900 Subject: [PATCH 136/162] 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 137/162] 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 138/162] 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 139/162] 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 7c6540b008b568b5647cf330194342c20f3ee7c1 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 03:49:06 -0300 Subject: [PATCH 140/162] Cleanup status transition code --- osu.Game/Users/UserPanel.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index df37b339c3..7a6fdda825 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -176,13 +176,23 @@ namespace osu.Game.Users private void displayStatus(UserStatus status) { - statusBar.ResizeHeightTo(status == null ? 0f : status_height, 500, EasingTypes.OutQuint); - statusBar.FadeTo(status == null ? 0f : 1f, 500, EasingTypes.OutQuint); - ResizeHeightTo(status == null ? height - status_height : height, 500, EasingTypes.OutQuint); - if (status == null) return; + float transition_duration = 500; - statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); - statusMessage.Text = status.Message; + if (status == null) + { + statusBar.ResizeHeightTo(0f, transition_duration, EasingTypes.OutQuint); + statusBar.FadeOut(transition_duration, EasingTypes.OutQuint); + ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); + } + else + { + statusBar.ResizeHeightTo(status_height, transition_duration, EasingTypes.OutQuint); + statusBar.FadeIn(transition_duration, EasingTypes.OutQuint); + ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); + + statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint); + statusMessage.Text = status.Message; + } } private class CoverBackgroundSprite : Sprite From a7914dc1e837f4e47c7f07766067e64e24321845 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 04:00:39 -0300 Subject: [PATCH 141/162] Convert transition_duration to const --- osu.Game/Users/UserPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 7a6fdda825..f7714fd819 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -176,7 +176,7 @@ namespace osu.Game.Users private void displayStatus(UserStatus status) { - float transition_duration = 500; + const float transition_duration = 500; if (status == null) { From ca6a9b1b71432f3ed68f9cdf3185687b69d6fd28 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 04:21:34 -0300 Subject: [PATCH 142/162] Inline cover --- osu.Game/Users/UserPanel.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index f7714fd819..c78a69dac8 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -41,13 +41,15 @@ namespace osu.Game.Users Radius = 4, }; - Container cover; Children = new Drawable[] { - cover = new Container + new AsyncLoadWrapper(new CoverBackgroundSprite(user) { - RelativeSizeAxes = Axes.Both, - }, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(200), + }) { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, @@ -157,14 +159,6 @@ namespace osu.Game.Users }, }; - cover.Add(new AsyncLoadWrapper(new CoverBackgroundSprite(user) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(200), - }) { RelativeSizeAxes = Axes.Both }); - Status.ValueChanged += displayStatus; } From 391134b1d3f328640fcb89f3b5d2228b4fc4750b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 17:15:51 +0900 Subject: [PATCH 143/162] 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 144/162] 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 145/162] 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 146/162] 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); + } } } From b57a3f20562530877fe4520db08f6a1dee3dd4cd Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 19:44:48 -0300 Subject: [PATCH 147/162] Initial layout of user panel and user dropdown --- .../Graphics/UserInterface/OsuDropdown.cs | 10 +- .../Sections/General/LoginSettings.cs | 163 ++++++++++++++++-- 2 files changed, 158 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 9c1799c04c..9d11b8074d 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -42,7 +42,7 @@ namespace osu.Game.Graphics.UserInterface protected override DropdownMenuItem CreateMenuItem(string text, T value) => new OsuDropdownMenuItem(text, value) { AccentColour = AccentColour }; - private class OsuDropdownMenuItem : DropdownMenuItem + public class OsuDropdownMenuItem : DropdownMenuItem { public OsuDropdownMenuItem(string text, T current) : base(text, current) { @@ -115,11 +115,11 @@ namespace osu.Game.Graphics.UserInterface public class OsuDropdownHeader : DropdownHeader { - private readonly SpriteText label; + protected readonly SpriteText Text; protected override string Label { - get { return label.Text; } - set { label.Text = value; } + get { return Text.Text; } + set { Text.Text = value; } } protected readonly TextAwesome Icon; @@ -146,7 +146,7 @@ namespace osu.Game.Graphics.UserInterface Foreground.Children = new Drawable[] { - label = new OsuSpriteText + Text = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index d94388ed87..da07f55be0 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -13,16 +13,20 @@ using osu.Game.Online.API; using OpenTK; using osu.Framework.Input; using osu.Game.Users; +using System.ComponentModel; +using osu.Game.Graphics; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; + +using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Overlays.Settings.Sections.General { - public class LoginSettings : SettingsSubsection, IOnlineComponent + public class LoginSettings : FillFlowContainer, IOnlineComponent { private bool bounding = true; private LoginForm form; - protected override string Header => "Account"; - public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty; public bool Bounding @@ -35,6 +39,14 @@ namespace osu.Game.Overlays.Settings.Sections.General } } + public LoginSettings() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Direction = FillDirection.Vertical; + Spacing = new Vector2(0f, 5f); + } + [BackgroundDependencyLoader(permitNulls: true)] private void load(APIAccess api) { @@ -50,6 +62,12 @@ namespace osu.Game.Overlays.Settings.Sections.General case APIState.Offline: Children = new Drawable[] { + new OsuSpriteText + { + Text = "LOG IN", + Margin = new MarginPadding { Bottom = 10 }, + Font = @"Exo2.0-Black", + }, form = new LoginForm() }; break; @@ -67,23 +85,52 @@ namespace osu.Game.Overlays.Settings.Sections.General { new OsuSpriteText { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Text = "Connecting...", + Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, }; break; case APIState.Online: Children = new Drawable[] { - new UserPanel(api.LocalUser.Value) + new FillFlowContainer { RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Left = 20, Right = 20 }, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 10f), + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "Signed in", + TextSize = 18, + Font = @"Exo2.0-Bold", + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + }, + }, + }, + new UserPanel(api.LocalUser.Value) + { + RelativeSizeAxes = Axes.X, + }, + new UserDropdown + { + RelativeSizeAxes = Axes.X, + }, + }, }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Sign out", - Action = api.Logout - } }; break; } @@ -171,5 +218,101 @@ namespace osu.Game.Overlays.Settings.Sections.General return base.OnFocus(state); } } + + private class UserDropdown : OsuEnumDropdown + { + protected override DropdownHeader CreateHeader() => new UserDropdownHeader { AccentColour = AccentColour }; + protected override Menu CreateMenu() => new UserDropdownMenu(); + protected override DropdownMenuItem CreateMenuItem(string text, UserAction value) => new UserDropdownMenuItem(text, value) { AccentColour = AccentColour }; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AccentColour = colours.Gray5; + } + + private class UserDropdownHeader : OsuDropdownHeader + { + protected readonly TextAwesome statusIcon; + + public UserDropdownHeader() + { + Foreground.Padding = new MarginPadding { Left = 10, Right = 10 }; + Margin = new MarginPadding { Bottom = 5 }; + Masking = true; + CornerRadius = 5; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }; + + Icon.TextSize = 14; + Icon.Margin = new MarginPadding(0); + + Foreground.Add(statusIcon = new TextAwesome + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Icon = FontAwesome.fa_circle_o, + TextSize = 14, + }); + + //todo: Magic number + Text.Margin = new MarginPadding { Left = 20 }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BackgroundColour = colours.Gray3; + } + + public void SetStatusColour(Color4 colour) => statusIcon.FadeColour(colour, 500, EasingTypes.OutQuint); + } + + private class UserDropdownMenu : OsuMenu + { + public UserDropdownMenu() + { + CornerRadius = 5; + ItemsContainer.Padding = new MarginPadding(0); + Masking = true; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 4, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Background.Colour = colours.Gray3; + } + } + + private class UserDropdownMenuItem : OsuDropdownMenuItem + { + public UserDropdownMenuItem(string text, UserAction current) : base(text, current) + { + Foreground.Padding = new MarginPadding(5); + CornerRadius = 5; + } + } + } + + private enum UserAction + { + Online, + [Description(@"Do not disturb")] + DoNotDisturb, + [Description(@"Appear offline")] + AppearOffline, + [Description(@"Sign out")] + SignOut, + } } } From efd4c574312824258a973622ec6f2105e937f952 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 21:09:18 -0300 Subject: [PATCH 148/162] Dropdown actions, +User.Status, +UserStatusDoNotDisturb, properly align UserDropdownMenuItem --- .../Sections/General/LoginSettings.cs | 54 ++++++++++++++++--- osu.Game/Users/User.cs | 3 ++ osu.Game/Users/UserStatus.cs | 6 +++ 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index da07f55be0..b740aa282a 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -26,6 +26,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { private bool bounding = true; private LoginForm form; + private OsuColour colours; public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty; @@ -48,8 +49,9 @@ namespace osu.Game.Overlays.Settings.Sections.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api) + private void load(OsuColour colours, APIAccess api) { + this.colours = colours; api?.Register(this); } @@ -93,6 +95,8 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: + UserDropdown dropdown; + UserPanel panel; Children = new Drawable[] { new FillFlowContainer @@ -121,17 +125,40 @@ namespace osu.Game.Overlays.Settings.Sections.General }, }, }, - new UserPanel(api.LocalUser.Value) + panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X, }, - new UserDropdown + dropdown = new UserDropdown { RelativeSizeAxes = Axes.X, }, }, }, }; + panel.Status.BindTo(api.LocalUser.Value.Status); + dropdown.Current.ValueChanged += newValue => + { + switch (newValue) + { + case UserAction.Online: + api.LocalUser.Value.Status.Value = new UserStatusOnline(); + dropdown.StatusColour = colours.Green; + break; + case UserAction.DoNotDisturb: + api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); + dropdown.StatusColour = colours.Red; + break; + case UserAction.AppearOffline: + api.LocalUser.Value.Status.Value = new UserStatusOffline(); + dropdown.StatusColour = colours.Gray7; + break; + case UserAction.SignOut: + api.Logout(); + break; + } + }; + dropdown.Current.TriggerChange(); break; } @@ -225,6 +252,14 @@ namespace osu.Game.Overlays.Settings.Sections.General protected override Menu CreateMenu() => new UserDropdownMenu(); protected override DropdownMenuItem CreateMenuItem(string text, UserAction value) => new UserDropdownMenuItem(text, value) { AccentColour = AccentColour }; + public Color4 StatusColour + { + set + { + (Header as UserDropdownHeader).StatusColour = value; + } + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -235,6 +270,14 @@ namespace osu.Game.Overlays.Settings.Sections.General { protected readonly TextAwesome statusIcon; + public Color4 StatusColour + { + set + { + statusIcon.FadeColour(value, 500, EasingTypes.OutQuint); + } + } + public UserDropdownHeader() { Foreground.Padding = new MarginPadding { Left = 10, Right = 10 }; @@ -268,8 +311,6 @@ namespace osu.Game.Overlays.Settings.Sections.General { BackgroundColour = colours.Gray3; } - - public void SetStatusColour(Color4 colour) => statusIcon.FadeColour(colour, 500, EasingTypes.OutQuint); } private class UserDropdownMenu : OsuMenu @@ -298,7 +339,8 @@ namespace osu.Game.Overlays.Settings.Sections.General { public UserDropdownMenuItem(string text, UserAction current) : base(text, current) { - Foreground.Padding = new MarginPadding(5); + //todo: Another magic number + Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 19, Right = 5 }; CornerRadius = 5; } } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 1361eefcff..93933c8fe9 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; +using osu.Framework.Configuration; namespace osu.Game.Users { @@ -19,6 +20,8 @@ namespace osu.Game.Users [JsonProperty(@"country")] public Country Country; + public Bindable Status = new Bindable(); + //public Team Team; [JsonProperty(@"profile_colour")] diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index dcb5ccbd8f..15e6c4fb60 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -58,4 +58,10 @@ namespace osu.Game.Users public override string Message => @"Modding a map"; public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } + + public class UserStatusDoNotDisturb : UserStatus + { + public override string Message => @"Do not disturb"; + public override Color4 GetAppropriateColour(OsuColour colours) => colours.RedDark; + } } From 9b863f60ab5e91dd366d64f4272eaeac7b29ec81 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 21:32:46 -0300 Subject: [PATCH 149/162] Adjust dropdown layout --- osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index b740aa282a..435c6cf9bb 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -317,6 +317,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { public UserDropdownMenu() { + Margin = new MarginPadding { Bottom = 5 }; CornerRadius = 5; ItemsContainer.Padding = new MarginPadding(0); Masking = true; From 8e09b738b0177e98a56bcdfdd373601a7c742682 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 21:51:00 -0300 Subject: [PATCH 150/162] Remove magic numbers --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 6 +++--- .../Settings/Sections/General/LoginSettings.cs | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 9d11b8074d..14483f3bfb 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -60,7 +60,7 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Y, Children = new Drawable[] { - chevron = new TextAwesome + Chevron = new TextAwesome { AlwaysPresent = true, Icon = FontAwesome.fa_chevron_right, @@ -84,12 +84,12 @@ namespace osu.Game.Graphics.UserInterface private Color4? accentColour; - private readonly TextAwesome chevron; + protected readonly TextAwesome Chevron; protected override void FormatForeground(bool hover = false) { base.FormatForeground(hover); - chevron.Alpha = hover ? 1 : 0; + Chevron.Alpha = hover ? 1 : 0; } public Color4 AccentColour diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 435c6cf9bb..a4b54a52a2 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -268,6 +268,8 @@ namespace osu.Game.Overlays.Settings.Sections.General private class UserDropdownHeader : OsuDropdownHeader { + public static readonly float LABEL_LEFT_MARGIN = 20; + protected readonly TextAwesome statusIcon; public Color4 StatusColour @@ -301,9 +303,8 @@ namespace osu.Game.Overlays.Settings.Sections.General Icon = FontAwesome.fa_circle_o, TextSize = 14, }); - - //todo: Magic number - Text.Margin = new MarginPadding { Left = 20 }; + + Text.Margin = new MarginPadding { Left = LABEL_LEFT_MARGIN }; } [BackgroundDependencyLoader] @@ -340,8 +341,8 @@ namespace osu.Game.Overlays.Settings.Sections.General { public UserDropdownMenuItem(string text, UserAction current) : base(text, current) { - //todo: Another magic number - Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 19, Right = 5 }; + Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = UserDropdownHeader.LABEL_LEFT_MARGIN, Right = 5 }; + Chevron.Margin = new MarginPadding { Left = 2, Right = 3 }; CornerRadius = 5; } } From 9cad34440183384270888a2767289d5d9c820a90 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 22:02:32 -0300 Subject: [PATCH 151/162] Revert back header for login form, fix incorrect spacing on header --- osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index a4b54a52a2..51b95a4d8e 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -66,8 +66,8 @@ namespace osu.Game.Overlays.Settings.Sections.General { new OsuSpriteText { - Text = "LOG IN", - Margin = new MarginPadding { Bottom = 10 }, + Text = "ACCOUNT", + Margin = new MarginPadding { Bottom = 5 }, Font = @"Exo2.0-Black", }, form = new LoginForm() From ec3c92fc3c31bfd4c9764cbf05621e0fbdb1a702 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 22:26:48 -0300 Subject: [PATCH 152/162] Trim whitespace --- osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs | 2 +- osu.Game/Users/UserStatus.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 51b95a4d8e..c2a4e4c833 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -303,7 +303,7 @@ namespace osu.Game.Overlays.Settings.Sections.General Icon = FontAwesome.fa_circle_o, TextSize = 14, }); - + Text.Margin = new MarginPadding { Left = LABEL_LEFT_MARGIN }; } diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 15e6c4fb60..461008db0f 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -58,7 +58,7 @@ namespace osu.Game.Users public override string Message => @"Modding a map"; public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark; } - + public class UserStatusDoNotDisturb : UserStatus { public override string Message => @"Do not disturb"; From e22eb1f20578ababb88cd4e834ab434167248fd2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 22:39:07 -0300 Subject: [PATCH 153/162] CI fixes --- .../Overlays/Settings/Sections/General/LoginSettings.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index c2a4e4c833..501618be7f 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -256,7 +256,9 @@ namespace osu.Game.Overlays.Settings.Sections.General { set { - (Header as UserDropdownHeader).StatusColour = value; + var h = Header as UserDropdownHeader; + if (h == null) return; + h.StatusColour = value; } } @@ -268,10 +270,9 @@ namespace osu.Game.Overlays.Settings.Sections.General private class UserDropdownHeader : OsuDropdownHeader { - public static readonly float LABEL_LEFT_MARGIN = 20; - - protected readonly TextAwesome statusIcon; + public const float LABEL_LEFT_MARGIN = 20; + private readonly TextAwesome statusIcon; public Color4 StatusColour { set From be81346573dc4e3f6b94258c4442a42d16129458 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 14:47:25 +0900 Subject: [PATCH 154/162] Attempt to fix inner scope warning --- .../Sections/General/LoginSettings.cs | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 501618be7f..2c92e8653e 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -95,8 +95,33 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: - UserDropdown dropdown; - UserPanel panel; + UserDropdown dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }; + dropdown.Current.ValueChanged += newValue => + { + switch (newValue) + { + case UserAction.Online: + api.LocalUser.Value.Status.Value = new UserStatusOnline(); + dropdown.StatusColour = colours.Green; + break; + case UserAction.DoNotDisturb: + api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); + dropdown.StatusColour = colours.Red; + break; + case UserAction.AppearOffline: + api.LocalUser.Value.Status.Value = new UserStatusOffline(); + dropdown.StatusColour = colours.Gray7; + break; + case UserAction.SignOut: + api.Logout(); + break; + } + }; + dropdown.Current.TriggerChange(); + + UserPanel panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X }; + panel.Status.BindTo(api.LocalUser.Value.Status); + Children = new Drawable[] { new FillFlowContainer @@ -125,40 +150,11 @@ namespace osu.Game.Overlays.Settings.Sections.General }, }, }, - panel = new UserPanel(api.LocalUser.Value) - { - RelativeSizeAxes = Axes.X, - }, - dropdown = new UserDropdown - { - RelativeSizeAxes = Axes.X, - }, + panel, + dropdown, }, }, }; - panel.Status.BindTo(api.LocalUser.Value.Status); - dropdown.Current.ValueChanged += newValue => - { - switch (newValue) - { - case UserAction.Online: - api.LocalUser.Value.Status.Value = new UserStatusOnline(); - dropdown.StatusColour = colours.Green; - break; - case UserAction.DoNotDisturb: - api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); - dropdown.StatusColour = colours.Red; - break; - case UserAction.AppearOffline: - api.LocalUser.Value.Status.Value = new UserStatusOffline(); - dropdown.StatusColour = colours.Gray7; - break; - case UserAction.SignOut: - api.Logout(); - break; - } - }; - dropdown.Current.TriggerChange(); break; } From d7fa6933be18d192bbaf097dfb032606ec8f719c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 16:31:56 +0900 Subject: [PATCH 155/162] Fix potential nullref --- osu.Game/Users/UserPanel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index c78a69dac8..bdfe6d1c8e 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -158,14 +158,19 @@ namespace osu.Game.Users }, }, }; - - Status.ValueChanged += displayStatus; } [BackgroundDependencyLoader] private void load(OsuColour colours) { this.colours = colours; + Status.ValueChanged += displayStatus; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Status.TriggerChange(); } private void displayStatus(UserStatus status) From 1a255fdf4818358f2478e674601a7fe6399ddce6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 19:47:18 +0900 Subject: [PATCH 156/162] Fix display order regression --- .../Sections/General/LoginSettings.cs | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 2c92e8653e..d8db44607a 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -28,6 +28,9 @@ namespace osu.Game.Overlays.Settings.Sections.General private LoginForm form; private OsuColour colours; + private UserPanel panel; + private UserDropdown dropdown; + public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty; public bool Bounding @@ -95,33 +98,6 @@ namespace osu.Game.Overlays.Settings.Sections.General }; break; case APIState.Online: - UserDropdown dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }; - dropdown.Current.ValueChanged += newValue => - { - switch (newValue) - { - case UserAction.Online: - api.LocalUser.Value.Status.Value = new UserStatusOnline(); - dropdown.StatusColour = colours.Green; - break; - case UserAction.DoNotDisturb: - api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); - dropdown.StatusColour = colours.Red; - break; - case UserAction.AppearOffline: - api.LocalUser.Value.Status.Value = new UserStatusOffline(); - dropdown.StatusColour = colours.Gray7; - break; - case UserAction.SignOut: - api.Logout(); - break; - } - }; - dropdown.Current.TriggerChange(); - - UserPanel panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X }; - panel.Status.BindTo(api.LocalUser.Value.Status); - Children = new Drawable[] { new FillFlowContainer @@ -150,11 +126,36 @@ namespace osu.Game.Overlays.Settings.Sections.General }, }, }, - panel, - dropdown, + panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X }, + dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }, }, }, }; + + panel.Status.BindTo(api.LocalUser.Value.Status); + + dropdown.Current.TriggerChange(); + dropdown.Current.ValueChanged += newValue => + { + switch (newValue) + { + case UserAction.Online: + api.LocalUser.Value.Status.Value = new UserStatusOnline(); + dropdown.StatusColour = colours.Green; + break; + case UserAction.DoNotDisturb: + api.LocalUser.Value.Status.Value = new UserStatusDoNotDisturb(); + dropdown.StatusColour = colours.Red; + break; + case UserAction.AppearOffline: + api.LocalUser.Value.Status.Value = new UserStatusOffline(); + dropdown.StatusColour = colours.Gray7; + break; + case UserAction.SignOut: + api.Logout(); + break; + } + }; break; } From 97e57178a77af3fee0c8cd448df623f042115846 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 25 May 2017 21:33:04 +0900 Subject: [PATCH 157/162] Make triangles use raw vertices instead of sprites. --- osu-framework | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 211 ++++++++++++++++----- 2 files changed, 166 insertions(+), 47 deletions(-) diff --git a/osu-framework b/osu-framework index 777996fb97..3e989ae630 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 777996fb9731ba1895a5ab1323cbbc97259ff741 +Subproject commit 3e989ae63031a75e622225d6f4d14c6e26170b97 diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 5cca57be8a..28e57eb470 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -5,16 +5,28 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using OpenTK; using OpenTK.Graphics; using System; +using System.Runtime.InteropServices; +using osu.Framework.Graphics.OpenGL; +using osu.Framework.Graphics.Shaders; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.OpenGL.Buffers; +using OpenTK.Graphics.ES30; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Allocation; +using System.Collections.Generic; +using osu.Framework.Graphics.Batches; namespace osu.Game.Graphics.Backgrounds { - public class Triangles : Container + public class Triangles : Drawable { + private const float triangle_size = 100; + public override bool HandleInput => false; public Color4 ColourLight = Color4.White; @@ -49,6 +61,28 @@ namespace osu.Game.Graphics.Backgrounds /// public float Velocity = 1; + private readonly List parts = new List(); + + private Shader shader; + private readonly Texture texture; + + public Triangles() + { + texture = Texture.WhitePixel; + } + + [BackgroundDependencyLoader] + private void load(ShaderManager shaders) + { + shader = shaders?.Load("Triangles", FragmentShaderDescriptor.TEXTURE_ROUNDED); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + addTriangles(true); + } + public float TriangleScale { get { return triangleScale; } @@ -57,42 +91,69 @@ namespace osu.Game.Graphics.Backgrounds float change = value / triangleScale; triangleScale = value; - if (change != 1) - Children.ForEach(t => t.Scale *= change); + for (int i = 0; i < parts.Count; i++) + { + TriangleParticle newParticle = parts[i]; + newParticle.Scale *= change; + parts[i] = newParticle; + } } } - protected override void LoadComplete() - { - base.LoadComplete(); - - addTriangles(true); - } - - private int aimTriangleCount => (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio); - protected override void Update() { base.Update(); - float adjustedAlpha = HideAlphaDiscrepancies ? - // Cubically scale alpha to make it drop off more sharply. - (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : - 1; + Invalidate(Invalidation.DrawNode, shallPropagate: false); - foreach (var t in Children) + for (int i = 0; i < parts.Count; i++) { - t.Alpha = adjustedAlpha; - t.Position -= new Vector2(0, (float)(t.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale * Velocity); - if (ExpireOffScreenTriangles && t.DrawPosition.Y + t.DrawSize.Y * t.Scale.Y < 0) - t.Expire(); - } + TriangleParticle newParticle = parts[i]; - if (CreateNewTriangles) - addTriangles(false); + newParticle.Position += new Vector2(0, -(float)(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); + + float adjustedAlpha = HideAlphaDiscrepancies ? + // Cubically scale alpha to make it drop off more sharply. + (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : + 1; + + newParticle.Colour.A = adjustedAlpha; + + parts[i] = newParticle; + + if (!CreateNewTriangles) + continue; + + float bottomPos = parts[i].Position.Y + triangle_size * parts[i].Scale * 0.866f / DrawHeight; + + if (bottomPos < 0) + parts[i] = createTriangle(false); + } } - protected virtual Triangle CreateTriangle() + private void addTriangles(bool randomY) + { + int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio); + + for (int i = 0; i < aimTriangleCount; i++) + parts.Add(createTriangle(randomY)); + } + + private TriangleParticle createTriangle(bool randomY) + { + var particle = CreateTriangle(); + + particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1); + particle.Colour = CreateTriangleShade(); + + return particle; + } + + /// + /// Creates a triangle particle with a random scale. + /// + /// The triangle particle. + protected virtual TriangleParticle CreateTriangle() { const float std_dev = 0.16f; const float mean = 0.5f; @@ -102,32 +163,90 @@ namespace osu.Game.Graphics.Backgrounds float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1) var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) - const float size = 100; - - return new EquilateralTriangle - { - Origin = Anchor.TopCentre, - RelativePositionAxes = Axes.Both, - Size = new Vector2(size), - Scale = new Vector2(scale), - EdgeSmoothness = new Vector2(1), - Colour = GetTriangleShade(), - Depth = scale, - }; + return new TriangleParticle { Scale = scale }; } - protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); + /// + /// Creates a shade of colour for the triangles. + /// + /// The colour. + protected virtual Color4 CreateTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); - private void addTriangles(bool randomY) + protected override DrawNode CreateDrawNode() => new TrianglesDrawNode(); + + private TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData(); + protected override void ApplyDrawNode(DrawNode node) { - int addCount = aimTriangleCount - Children.Count(); - for (int i = 0; i < addCount; i++) + base.ApplyDrawNode(node); + + var trianglesNode = node as TrianglesDrawNode; + + trianglesNode.Shader = shader; + trianglesNode.Texture = texture; + trianglesNode.Size = DrawSize; + trianglesNode.Shared = sharedData; + + trianglesNode.Parts.Clear(); + trianglesNode.Parts.AddRange(parts); + } + + public class TrianglesDrawNodeSharedData + { + public LinearBatch VertexBatch = new LinearBatch(100 * 3, 10, PrimitiveType.Triangles); + } + + public class TrianglesDrawNode : DrawNode + { + public Shader Shader; + public Texture Texture; + + public float Time; + public TrianglesDrawNodeSharedData Shared; + + public readonly List Parts = new List(); + public Vector2 Size; + + public override void Draw(Action vertexAction) { - var sprite = CreateTriangle(); - float triangleHeight = sprite.DrawHeight / DrawHeight; - sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); - Add(sprite); + base.Draw(vertexAction); + + Shader.Bind(); + Texture.TextureGL.Bind(); + + int updateStart = -1, updateEnd = 0; + for (int i = 0; i < Parts.Count; ++i) + { + if (updateStart == -1) + updateStart = i; + updateEnd = i + 1; + + TriangleParticle particle = Parts[i]; + + Vector2 offset = new Vector2(particle.Scale * 0.5f, particle.Scale * 0.866f); + + var triangle = new Triangle( + (particle.Position * Size) * DrawInfo.Matrix, + (particle.Position * Size + offset * triangle_size) * DrawInfo.Matrix, + (particle.Position * Size + new Vector2(-offset.X, offset.Y) * triangle_size) * DrawInfo.Matrix + ); + + int index = i * 6; + + ColourInfo colourInfo = DrawInfo.Colour; + colourInfo.ApplyChild(particle.Colour); + + Texture.DrawTriangle(triangle, colourInfo, null, Shared.VertexBatch.Add); + } + + Shader.Unbind(); } } + + public struct TriangleParticle + { + public Vector2 Position; + public Color4 Colour; + public float Scale; + } } } From 86f6db2d31da91beb0734e72b46426875ae6dfc0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 25 May 2017 21:33:49 +0900 Subject: [PATCH 158/162] Cleanup. --- osu-framework | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 27 ++++++---------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/osu-framework b/osu-framework index 3e989ae630..4c84c0ef14 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 3e989ae63031a75e622225d6f4d14c6e26170b97 +Subproject commit 4c84c0ef14ca1fab6098d900c036dff4c85987a5 diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 28e57eb470..702dd7585b 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -1,19 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using OpenTK; using OpenTK.Graphics; using System; -using System.Runtime.InteropServices; using osu.Framework.Graphics.OpenGL; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.OpenGL.Buffers; using OpenTK.Graphics.ES30; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Primitives; @@ -74,7 +70,7 @@ namespace osu.Game.Graphics.Backgrounds [BackgroundDependencyLoader] private void load(ShaderManager shaders) { - shader = shaders?.Load("Triangles", FragmentShaderDescriptor.TEXTURE_ROUNDED); + shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); } protected override void LoadComplete() @@ -110,7 +106,7 @@ namespace osu.Game.Graphics.Backgrounds { TriangleParticle newParticle = parts[i]; - newParticle.Position += new Vector2(0, -(float)(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); + newParticle.Position += new Vector2(0, -(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); float adjustedAlpha = HideAlphaDiscrepancies ? // Cubically scale alpha to make it drop off more sharply. @@ -174,12 +170,12 @@ namespace osu.Game.Graphics.Backgrounds protected override DrawNode CreateDrawNode() => new TrianglesDrawNode(); - private TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData(); + private readonly TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData(); protected override void ApplyDrawNode(DrawNode node) { base.ApplyDrawNode(node); - var trianglesNode = node as TrianglesDrawNode; + var trianglesNode = (TrianglesDrawNode)node; trianglesNode.Shader = shader; trianglesNode.Texture = texture; @@ -213,25 +209,16 @@ namespace osu.Game.Graphics.Backgrounds Shader.Bind(); Texture.TextureGL.Bind(); - int updateStart = -1, updateEnd = 0; - for (int i = 0; i < Parts.Count; ++i) + foreach (TriangleParticle particle in Parts) { - if (updateStart == -1) - updateStart = i; - updateEnd = i + 1; - - TriangleParticle particle = Parts[i]; - - Vector2 offset = new Vector2(particle.Scale * 0.5f, particle.Scale * 0.866f); + var offset = new Vector2(particle.Scale * 0.5f, particle.Scale * 0.866f); var triangle = new Triangle( - (particle.Position * Size) * DrawInfo.Matrix, + particle.Position * Size * DrawInfo.Matrix, (particle.Position * Size + offset * triangle_size) * DrawInfo.Matrix, (particle.Position * Size + new Vector2(-offset.X, offset.Y) * triangle_size) * DrawInfo.Matrix ); - int index = i * 6; - ColourInfo colourInfo = DrawInfo.Colour; colourInfo.ApplyChild(particle.Colour); From 91dba765c2f572dcb1b5979ef8e506209441aeed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 25 May 2017 22:03:36 +0900 Subject: [PATCH 159/162] Add back the concept of triangle ordering by size. --- osu.Game/Graphics/Backgrounds/Triangles.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 702dd7585b..6cc7857fa9 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Allocation; using System.Collections.Generic; using osu.Framework.Graphics.Batches; +using osu.Framework.Lists; namespace osu.Game.Graphics.Backgrounds { @@ -57,7 +58,7 @@ namespace osu.Game.Graphics.Backgrounds /// public float Velocity = 1; - private readonly List parts = new List(); + private readonly SortedList parts = new SortedList(Comparer.Default); private Shader shader; private readonly Texture texture; @@ -123,15 +124,17 @@ namespace osu.Game.Graphics.Backgrounds float bottomPos = parts[i].Position.Y + triangle_size * parts[i].Scale * 0.866f / DrawHeight; if (bottomPos < 0) - parts[i] = createTriangle(false); + parts.RemoveAt(i); } + + addTriangles(false); } private void addTriangles(bool randomY) { int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio); - for (int i = 0; i < aimTriangleCount; i++) + for (int i = 0; i < aimTriangleCount - parts.Count; i++) parts.Add(createTriangle(randomY)); } @@ -229,11 +232,20 @@ namespace osu.Game.Graphics.Backgrounds } } - public struct TriangleParticle + public struct TriangleParticle : IComparable { public Vector2 Position; public Color4 Colour; public float Scale; + + /// + /// Compares two s. This is a reverse comparer because when the + /// triangles are added to the particles list, they should be drawn from largest to smallest + /// such that the smaller triangles appear on top. + /// + /// + /// + public int CompareTo(TriangleParticle other) => other.Scale.CompareTo(Scale); } } } From c8cf387f5ff1d6fc41d02d166ad37759bc5fffca Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 25 May 2017 22:09:02 +0900 Subject: [PATCH 160/162] A bit more cleanup. --- osu.Game/Graphics/Backgrounds/Triangles.cs | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 6cc7857fa9..9a19819af8 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -107,13 +107,13 @@ namespace osu.Game.Graphics.Backgrounds { TriangleParticle newParticle = parts[i]; - newParticle.Position += new Vector2(0, -(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); - float adjustedAlpha = HideAlphaDiscrepancies ? // Cubically scale alpha to make it drop off more sharply. (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : 1; + + newParticle.Position += new Vector2(0, -(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); newParticle.Colour.A = adjustedAlpha; parts[i] = newParticle; @@ -140,7 +140,7 @@ namespace osu.Game.Graphics.Backgrounds private TriangleParticle createTriangle(bool randomY) { - var particle = CreateTriangle(); + TriangleParticle particle = CreateTriangle(); particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1); particle.Colour = CreateTriangleShade(); @@ -189,17 +189,16 @@ namespace osu.Game.Graphics.Backgrounds trianglesNode.Parts.AddRange(parts); } - public class TrianglesDrawNodeSharedData + private class TrianglesDrawNodeSharedData { - public LinearBatch VertexBatch = new LinearBatch(100 * 3, 10, PrimitiveType.Triangles); + public readonly LinearBatch VertexBatch = new LinearBatch(100 * 3, 10, PrimitiveType.Triangles); } - public class TrianglesDrawNode : DrawNode + private class TrianglesDrawNode : DrawNode { public Shader Shader; public Texture Texture; - public float Time; public TrianglesDrawNodeSharedData Shared; public readonly List Parts = new List(); @@ -232,10 +231,21 @@ namespace osu.Game.Graphics.Backgrounds } } - public struct TriangleParticle : IComparable + protected struct TriangleParticle : IComparable { + /// + /// The position of the top vertex of the triangle. + /// public Vector2 Position; + + /// + /// The colour of the triangle. + /// public Color4 Colour; + + /// + /// The scale of the triangle. + /// public float Scale; /// From 9eec2edd30a56ed2281687a63980bf0a311b36b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 22:43:33 +0900 Subject: [PATCH 161/162] Fix initial login state not being reflected in user panel --- osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index d8db44607a..561f81d6c3 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -134,7 +134,6 @@ namespace osu.Game.Overlays.Settings.Sections.General panel.Status.BindTo(api.LocalUser.Value.Status); - dropdown.Current.TriggerChange(); dropdown.Current.ValueChanged += newValue => { switch (newValue) @@ -156,6 +155,8 @@ namespace osu.Game.Overlays.Settings.Sections.General break; } }; + dropdown.Current.TriggerChange(); + break; } From ec8f49df0fce0b4bdca9c31915a523ffb0f8dc6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 May 2017 22:46:50 +0900 Subject: [PATCH 162/162] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 4c84c0ef14..8baad1b948 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4c84c0ef14ca1fab6098d900c036dff4c85987a5 +Subproject commit 8baad1b9484b9f35724e2f965c18cfe710907d80