From 8fca0fddb374cc15410eb11945480ce5d7076a4f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 00:52:01 -0300 Subject: [PATCH 01/36] Abstract DirectOverlay layout into base class for Social and osu!direct - BrowseOverlay, initial layout of social browser --- .../Tests/TestCaseSocial.cs | 23 +++ .../osu.Desktop.VisualTests.csproj | 1 + .../UserInterface/PageTabControl.cs} | 24 +-- .../Overlays/Browse/BrowseFilterControl.cs | 111 +++++++++++ osu.Game/Overlays/Browse/BrowseHeader.cs | 96 ++++++++++ osu.Game/Overlays/Browse/BrowseOverlay.cs | 126 +++++++++++++ .../Overlays/Browse/DisplayStyleControl.cs | 102 ++++++++++ osu.Game/Overlays/Browse/HeaderTabControl.cs | 28 +++ .../{Direct => Browse}/SlimEnumDropdown.cs | 6 +- osu.Game/Overlays/Direct/FilterControl.cs | 175 +++--------------- osu.Game/Overlays/Direct/Header.cs | 98 +--------- osu.Game/Overlays/DirectOverlay.cs | 142 ++++---------- osu.Game/Overlays/Social/FilterControl.cs | 15 ++ osu.Game/Overlays/Social/Header.cs | 51 +++++ osu.Game/Overlays/SocialOverlay.cs | 44 +++++ osu.Game/osu.Game.csproj | 12 +- 16 files changed, 683 insertions(+), 371 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseSocial.cs rename osu.Game/{Overlays/Direct/SortTabControl.cs => Graphics/UserInterface/PageTabControl.cs} (80%) create mode 100644 osu.Game/Overlays/Browse/BrowseFilterControl.cs create mode 100644 osu.Game/Overlays/Browse/BrowseHeader.cs create mode 100644 osu.Game/Overlays/Browse/BrowseOverlay.cs create mode 100644 osu.Game/Overlays/Browse/DisplayStyleControl.cs create mode 100644 osu.Game/Overlays/Browse/HeaderTabControl.cs rename osu.Game/Overlays/{Direct => Browse}/SlimEnumDropdown.cs (89%) create mode 100644 osu.Game/Overlays/Social/FilterControl.cs create mode 100644 osu.Game/Overlays/Social/Header.cs create mode 100644 osu.Game/Overlays/SocialOverlay.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs new file mode 100644 index 0000000000..8fee8e6887 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.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 osu.Framework.Testing; +using osu.Game.Overlays; + +namespace osu.Desktop.VisualTests.Tests +{ + public class TestCaseSocial : TestCase + { + public override string Description => @"social browser overlay"; + + public override void Reset() + { + base.Reset(); + + SocialOverlay s = new SocialOverlay(); + Add(s); + + AddStep(@"toggle", s.ToggleVisibility); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 7b7997063b..0b8b4f2105 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -223,6 +223,7 @@ + diff --git a/osu.Game/Overlays/Direct/SortTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs similarity index 80% rename from osu.Game/Overlays/Direct/SortTabControl.cs rename to osu.Game/Graphics/UserInterface/PageTabControl.cs index 4d4e02d875..8bf455b099 100644 --- a/osu.Game/Overlays/Direct/SortTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -10,22 +10,20 @@ 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 +namespace osu.Game.Graphics.UserInterface { - public class SortTabControl : OsuTabControl + public class PageTabControl : OsuTabControl { - protected override TabItem CreateTabItem(SortCriteria value) => new SortTabItem(value); + protected override TabItem CreateTabItem(T value) => new PageTabItem(value); - public SortTabControl() + public PageTabControl() { Height = 30; } - private class SortTabItem : TabItem + private class PageTabItem : TabItem { private const float transition_duration = 100; @@ -46,7 +44,7 @@ namespace osu.Game.Overlays.Direct } } - public SortTabItem(SortCriteria value) : base(value) + public PageTabItem(T value) : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; @@ -104,14 +102,4 @@ namespace osu.Game.Overlays.Direct } } } - - public enum SortCriteria - { - Title, - Artist, - Creator, - Difficulty, - Ranked, - Rating, - } } diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/Browse/BrowseFilterControl.cs new file mode 100644 index 0000000000..fe61771f5b --- /dev/null +++ b/osu.Game/Overlays/Browse/BrowseFilterControl.cs @@ -0,0 +1,111 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Browse +{ + public abstract class BrowseFilterControl : Container + { + private const float padding = 10; + + private readonly Box tabStrip; + + public readonly SearchTextBox Search; + public readonly PageTabControl Tabs; + + protected abstract Color4 BackgroundColour { get; } + protected abstract T DefaultTab { get; } + protected virtual Drawable CreateControls() => new Container(); //todo: naming + + public BrowseFilterControl() + { + if (!typeof(T).IsEnum) + throw new InvalidOperationException("BrowseFilterControl only supports enums as the generic type argument"); + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = BackgroundColour, + }, + tabStrip = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = 1, + Alpha = 0.9f, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Top = padding, Horizontal = BrowseOverlay.WIDTH_PADDING }, + Children = new Drawable[] + { + Search = new FilterSearchTextBox + { + RelativeSizeAxes = Axes.X, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = padding }, //todo: margin is still applied without any controls + Children = new[] + { + CreateControls(), + }, + }, + Tabs = new PageTabControl + { + RelativeSizeAxes = Axes.X, + }, + new Box //keep the tab strip part of autosize, but don't put it in the flow container + { + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = Color4.White.Opacity(0), + }, + }, + }, + }; + + Tabs.Current.Value = DefaultTab; + Tabs.Current.TriggerChange(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + tabStrip.Colour = colours.Yellow; + } + + private class FilterSearchTextBox : SearchTextBox + { + protected override Color4 BackgroundUnfocused => backgroundColour; + protected override Color4 BackgroundFocused => backgroundColour; + + private Color4 backgroundColour; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + backgroundColour = colours.Gray2.Opacity(0.9f); + } + } + } +} diff --git a/osu.Game/Overlays/Browse/BrowseHeader.cs b/osu.Game/Overlays/Browse/BrowseHeader.cs new file mode 100644 index 0000000000..47f2d6d8c2 --- /dev/null +++ b/osu.Game/Overlays/Browse/BrowseHeader.cs @@ -0,0 +1,96 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +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.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Browse +{ + public abstract class BrowseHeader : Container + { + public static readonly float HEIGHT = 90; + + private readonly Box tabStrip; + + public readonly HeaderTabControl Tabs; + + protected abstract Color4 BackgroundColour { get; } + protected abstract float TabStripWidth { get; } //can be removed once (if?) TabControl support auto sizing + protected abstract T DefaultTab { get; } + protected abstract Drawable CreateHeaderText(); + + public BrowseHeader() + { + if (!typeof(T).IsEnum) + throw new InvalidOperationException("BrowseHeader only supports enums as the generic type argument"); + + RelativeSizeAxes = Axes.X; + Height = HEIGHT; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = BackgroundColour, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = BrowseOverlay.WIDTH_PADDING, Right = BrowseOverlay.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, + }, + CreateHeaderText(), + }, + }, + tabStrip = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Width = TabStripWidth, + Height = 1, + }, + Tabs = new HeaderTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }; + + Tabs.Current.Value = DefaultTab; + Tabs.Current.TriggerChange(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + tabStrip.Colour = colours.Green; + } + } +} diff --git a/osu.Game/Overlays/Browse/BrowseOverlay.cs b/osu.Game/Overlays/Browse/BrowseOverlay.cs new file mode 100644 index 0000000000..dc5732b58f --- /dev/null +++ b/osu.Game/Overlays/Browse/BrowseOverlay.cs @@ -0,0 +1,126 @@ +// 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.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; + +namespace osu.Game.Overlays.Browse +{ + public abstract class BrowseOverlay : WaveOverlayContainer + { + public static readonly float WIDTH_PADDING = 80; + } + + //todo: naming + //todo: crash when pressing tab + public abstract class BrowseOverlay : BrowseOverlay + { + private readonly Container scrollContainer; + + protected readonly BrowseHeader Header; + protected readonly BrowseFilterControl Filter; + protected readonly FillFlowContainer ScrollFlow; + + protected abstract Color4 BackgroundColour { get; } + protected abstract Color4 TrianglesColourLight { get; } + protected abstract Color4 TrianglesColourDark { get; } + protected abstract BrowseHeader CreateHeader(); + protected abstract BrowseFilterControl CreateFilterControl(); + + public BrowseOverlay() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = BackgroundColour, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] + { + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 5, + ColourLight = TrianglesColourLight, + ColourDark = TrianglesColourDark, + }, + }, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + Header = CreateHeader(), + Filter = CreateFilterControl(), + }, + }, + scrollContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, + Children = new[] + { + ScrollFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = BrowseOverlay.WIDTH_PADDING }, + Direction = FillDirection.Vertical, + }, + }, + }, + }, + }, + }; + + Filter.Search.Exit = Hide; + } + + protected override void Update() + { + base.Update(); + + scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height }; + } + + 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; + } + } +} diff --git a/osu.Game/Overlays/Browse/DisplayStyleControl.cs b/osu.Game/Overlays/Browse/DisplayStyleControl.cs new file mode 100644 index 0000000000..ae9397eca7 --- /dev/null +++ b/osu.Game/Overlays/Browse/DisplayStyleControl.cs @@ -0,0 +1,102 @@ +// 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.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Browse +{ + public class DisplayStyleControl : Container + { + public readonly SlimEnumDropdown Dropdown; + public readonly Bindable DisplayStyle = new Bindable(); + + public DisplayStyleControl() + { + AutoSizeAxes = Axes.Both; + + Children = new[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Spacing = new Vector2(10f, 0f), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(5f, 0f), + Direction = FillDirection.Horizontal, + Children = new[] + { + new DisplayStyleToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle), + }, + }, + Dropdown = new SlimEnumDropdown + { + RelativeSizeAxes = Axes.None, + Width = 160f, + }, + }, + }, + }; + + DisplayStyle.Value = PanelDisplayStyle.Grid; + } + + private class DisplayStyleToggleButton : ClickableContainer + { + private readonly TextAwesome icon; + private readonly PanelDisplayStyle style; + private readonly Bindable bindable; + + public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable bindable) + { + this.bindable = bindable; + this.style = style; + Size = new Vector2(25f); + + Children = new Drawable[] + { + this.icon = new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = icon, + TextSize = 18, + UseFullGlyphHeight = false, + Alpha = 0.5f, + }, + }; + + bindable.ValueChanged += Bindable_ValueChanged; + Bindable_ValueChanged(bindable.Value); + Action = () => bindable.Value = this.style; + } + + private void Bindable_ValueChanged(PanelDisplayStyle style) + { + icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); + } + + protected override void Dispose(bool isDisposing) + { + bindable.ValueChanged -= Bindable_ValueChanged; + } + } + } + + public enum PanelDisplayStyle + { + Grid, + List, + } +} diff --git a/osu.Game/Overlays/Browse/HeaderTabControl.cs b/osu.Game/Overlays/Browse/HeaderTabControl.cs new file mode 100644 index 0000000000..afe3f2cb5e --- /dev/null +++ b/osu.Game/Overlays/Browse/HeaderTabControl.cs @@ -0,0 +1,28 @@ +// 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.Framework.Graphics.UserInterface; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Browse +{ + public class HeaderTabControl : OsuTabControl + { + protected override TabItem CreateTabItem(T value) => new HeaderTabItem(value); + + public HeaderTabControl() + { + Height = 26; + AccentColour = Color4.White; + } + + private class HeaderTabItem : OsuTabItem + { + public HeaderTabItem(T value) : base(value) + { + Text.TextSize = 16; + } + } + } +} diff --git a/osu.Game/Overlays/Direct/SlimEnumDropdown.cs b/osu.Game/Overlays/Browse/SlimEnumDropdown.cs similarity index 89% rename from osu.Game/Overlays/Direct/SlimEnumDropdown.cs rename to osu.Game/Overlays/Browse/SlimEnumDropdown.cs index 1d12b8477b..a3687174a0 100644 --- a/osu.Game/Overlays/Direct/SlimEnumDropdown.cs +++ b/osu.Game/Overlays/Browse/SlimEnumDropdown.cs @@ -7,12 +7,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Direct +namespace osu.Game.Overlays.Browse { public class SlimEnumDropdown : OsuEnumDropdown { - public const float HEIGHT = 25; - protected override DropdownHeader CreateHeader() => new SlimDropdownHeader { AccentColour = AccentColour }; protected override Menu CreateMenu() => new SlimMenu(); @@ -20,7 +18,7 @@ namespace osu.Game.Overlays.Direct { public SlimDropdownHeader() { - Height = HEIGHT; + Height = 25; Icon.TextSize = 16; Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4, Left = 8, Right = 4 }; } diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 735e14b8c1..20e9eb4aa1 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -5,117 +5,47 @@ 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.Game.Database; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Browse; namespace osu.Game.Overlays.Direct { - public class FilterControl : Container + public class FilterControl : BrowseFilterControl { - public static readonly float HEIGHT = 35 + 32 + 30 + padding * 2; // search + mode toggle buttons + sort tabs + padding + private FillFlowContainer modeButtons; - private const float padding = 10; + public readonly DisplayStyleControl DisplayStyleControl; //todo: naming - private readonly Box tabStrip; - private readonly FillFlowContainer modeButtons; + protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); + protected override DirectSortCritera DefaultTab => DirectSortCritera.Title; + protected override Drawable CreateControls() + { + modeButtons = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(10f, 0f), + }; - public readonly SearchTextBox Search; - public readonly SortTabControl SortTabs; - public readonly OsuEnumDropdown RankStatusDropdown; - public readonly Bindable DisplayStyle = new Bindable(); - - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos); + return modeButtons; + } public FilterControl() { - RelativeSizeAxes = Axes.X; - Height = HEIGHT; - DisplayStyle.Value = DirectOverlay.PanelDisplayStyle.Grid; - - Children = new Drawable[] + Add(DisplayStyleControl = new DisplayStyleControl { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"384552"), - Alpha = 0.9f, - }, - tabStrip = new Box - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = 1, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Left = DirectOverlay.WIDTH_PADDING, Right = DirectOverlay.WIDTH_PADDING }, - Children = new Drawable[] - { - Search = new DirectSearchTextBox - { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = padding }, - }, - modeButtons = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Spacing = new Vector2(padding, 0f), - Margin = new MarginPadding { Top = padding }, - }, - SortTabs = new SortTabControl - { - RelativeSizeAxes = Axes.X, - }, - }, - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - Spacing = new Vector2(10f, 0f), - Direction = FillDirection.Horizontal, - Margin = new MarginPadding { Top = HEIGHT - SlimEnumDropdown.HEIGHT - padding, Right = DirectOverlay.WIDTH_PADDING }, - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Spacing = new Vector2(5f, 0f), - Direction = FillDirection.Horizontal, - Children = new[] - { - new DisplayStyleToggleButton(FontAwesome.fa_th_large, DirectOverlay.PanelDisplayStyle.Grid, DisplayStyle), - new DisplayStyleToggleButton(FontAwesome.fa_list_ul, DirectOverlay.PanelDisplayStyle.List, DisplayStyle), - }, - }, - RankStatusDropdown = new SlimEnumDropdown - { - RelativeSizeAxes = Axes.None, - Width = 160f, - }, - }, - }, - }; - - RankStatusDropdown.Current.Value = RankStatus.RankedApproved; - SortTabs.Current.Value = SortCriteria.Title; - SortTabs.Current.TriggerChange(); + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { Bottom = 5, Right = BrowseOverlay.WIDTH_PADDING }, + }); } [BackgroundDependencyLoader(true)] private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) { - tabStrip.Colour = colours.Yellow; - RankStatusDropdown.AccentColour = colours.BlueDark; + DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; var b = new Bindable(); //backup bindable incase the game is null foreach (var r in rulesets.AllRulesets) @@ -124,20 +54,6 @@ namespace osu.Game.Overlays.Direct } } - private class DirectSearchTextBox : SearchTextBox - { - protected override Color4 BackgroundUnfocused => backgroundColour; - protected override Color4 BackgroundFocused => backgroundColour; - - private Color4 backgroundColour; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - backgroundColour = colours.Gray2.Opacity(0.9f); - } - } - private class RulesetToggleButton : ClickableContainer { private readonly TextAwesome icon; @@ -188,46 +104,15 @@ namespace osu.Game.Overlays.Direct base.Dispose(isDisposing); } } + } - private class DisplayStyleToggleButton : ClickableContainer - { - private readonly TextAwesome icon; - private readonly DirectOverlay.PanelDisplayStyle style; - private readonly Bindable bindable; - - public DisplayStyleToggleButton(FontAwesome icon, DirectOverlay.PanelDisplayStyle style, Bindable bindable) - { - this.bindable = bindable; - this.style = style; - Size = new Vector2(SlimEnumDropdown.HEIGHT); - - Children = new Drawable[] - { - this.icon = new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Icon = icon, - TextSize = 18, - UseFullGlyphHeight = false, - Alpha = 0.5f, - }, - }; - - bindable.ValueChanged += Bindable_ValueChanged; - Bindable_ValueChanged(bindable.Value); - Action = () => bindable.Value = this.style; - } - - private void Bindable_ValueChanged(DirectOverlay.PanelDisplayStyle style) - { - icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); - } - - protected override void Dispose(bool isDisposing) - { - bindable.ValueChanged -= Bindable_ValueChanged; - } - } + public enum DirectSortCritera + { + Title, + Artist, + Creator, + Difficulty, + Ranked, + Rating, } } diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index 8e4ede48d5..b8b06580c2 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -2,113 +2,27 @@ // 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.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; +using osu.Game.Overlays.Browse; namespace osu.Game.Overlays.Direct { - public class Header : Container + public class Header : BrowseHeader { - public static readonly float HEIGHT = 90; + protected override Color4 BackgroundColour => OsuColour.FromHex(@"252f3a"); + protected override float TabStripWidth => 298; - private readonly Box tabStrip; - - public readonly OsuTabControl Tabs; + protected override DirectTab DefaultTab => DirectTab.Search; + protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", TextSize = 25, }; public Header() { - Height = HEIGHT; - - 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.Value = DirectTab.Search; Tabs.Current.TriggerChange(); } - - [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 : OsuTabItem - { - public DirectTabItem(DirectTab value) : base(value) - { - Text.TextSize = 15; - } - } - } } public enum DirectTab diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0930c825b6..e57a556461 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -7,28 +7,33 @@ 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 osu.Game.Overlays.Browse; +using OpenTK.Graphics; +using System.ComponentModel; using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Overlays { - public class DirectOverlay : WaveOverlayContainer + public class DirectOverlay : BrowseOverlay { - 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; + protected override Color4 BackgroundColour => OsuColour.FromHex(@"485e74"); + protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"465b71"); + protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); + + protected override BrowseHeader CreateHeader() => new Header(); + protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); + private IEnumerable beatmapSets; public IEnumerable BeatmapSets { @@ -38,7 +43,7 @@ namespace osu.Game.Overlays if (beatmapSets?.Equals(value) ?? false) return; beatmapSets = value; - recreatePanels(filter.DisplayStyle.Value); + recreatePanels((Filter as FilterControl).DisplayStyleControl.DisplayStyle.Value); //todo: potential nullref } } @@ -66,96 +71,39 @@ namespace osu.Game.Overlays ThirdWaveColour = OsuColour.FromHex(@"005774"); FourthWaveColour = OsuColour.FromHex(@"003a4e"); - Header header; - Children = new Drawable[] + ScrollFlow.Children = new Drawable[] { - new Box + resultCountsContainer = new FillFlowContainer { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"485e74"), - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new[] + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Top = 5 }, + Children = new Drawable[] { - new Triangles + new OsuSpriteText { - RelativeSizeAxes = Axes.Both, - TriangleScale = 5, - ColourLight = OsuColour.FromHex(@"465b71"), - ColourDark = OsuColour.FromHex(@"3f5265"), + Text = "Found ", + TextSize = 15, }, - }, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = Header.HEIGHT + FilterControl.HEIGHT }, - Children = new[] - { - new ScrollContainer + resultCountsText = new OsuSpriteText { - 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), - }, - }, - }, - }, + TextSize = 15, + Font = @"Exo2.0-Bold", }, - }, + } }, - filter = new FilterControl - { - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = Header.HEIGHT }, - }, - header = new Header + panels = new FillFlowContainer { RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(panel_padding), + Margin = new MarginPadding { Top = 10 }, }, }; - 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; + Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; + Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; + (Filter as FilterControl).DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; //todo: potential nullref updateResultCounts(); } @@ -187,26 +135,6 @@ namespace osu.Game.Overlays 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; @@ -220,11 +148,5 @@ namespace osu.Game.Overlays Tags = tags; } } - - public enum PanelDisplayStyle - { - Grid, - List, - } } } diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs new file mode 100644 index 0000000000..a5dcddad00 --- /dev/null +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -0,0 +1,15 @@ +// 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; +using osu.Game.Overlays.Browse; + +namespace osu.Game.Overlays.Social +{ + public class FilterControl : BrowseFilterControl + { + protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); + protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; + } +} diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs new file mode 100644 index 0000000000..b540bd9a18 --- /dev/null +++ b/osu.Game/Overlays/Social/Header.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Overlays.Browse; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Framework.Allocation; + +namespace osu.Game.Overlays.Social +{ + public class Header : BrowseHeader + { + private OsuSpriteText browser; + + protected override Color4 BackgroundColour => OsuColour.FromHex(@"672b51"); + protected override float TabStripWidth => 438; + protected override SocialTab DefaultTab => SocialTab.OnlinePlayers; + + protected override Drawable CreateHeaderText() + { + return new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = "social ", + TextSize = 25, + }, + browser = new OsuSpriteText + { + Text = "browser", + TextSize = 25, + Font = @"Exo2.0-Light", + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + browser.Colour = colours.Pink; + } + } +} diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs new file mode 100644 index 0000000000..571d0b7130 --- /dev/null +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -0,0 +1,44 @@ +// 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.Graphics; +using osu.Game.Graphics; +using osu.Game.Overlays.Browse; +using osu.Game.Overlays.Social; + +namespace osu.Game.Overlays +{ + public class SocialOverlay : BrowseOverlay + { + protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); + protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); + protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); + + protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); + protected override BrowseHeader CreateHeader() => new Header(); + } + + public enum SocialTab + { + [Description("Online Players")] + OnlinePlayers, + [Description("Online Friends")] + OnlineFriends, + [Description("Online Team Members")] + OnlineTeamMembers, + [Description("Chat Channels")] + ChatChannels, + } + + public enum SocialSortCriteria + { + Name, + Rank, + Location, + [Description("Time Zone")] + TimeZone, + [Description("World Map")] + WorldMap, + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25b692151f..fb1db37f65 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -440,16 +440,24 @@ - - + + + + + + + + + + From 63313045d93fd66137483d0662e9795b43195d10 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 00:58:18 -0300 Subject: [PATCH 02/36] Add SocialOverlay to OsuGame --- osu.Game/OsuGame.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 886ff4f8d1..850e736edb 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -43,6 +43,8 @@ namespace osu.Game private DirectOverlay direct; + private SocialOverlay social; + private Intro intro { get @@ -165,6 +167,7 @@ namespace osu.Game //overlay elements LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); + LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(musicController = new MusicController @@ -234,6 +237,9 @@ namespace osu.Game case Key.F8: chat.ToggleVisibility(); return true; + case Key.F9: + social.ToggleVisibility(); + return true; case Key.PageUp: case Key.PageDown: var swClock = (Clock as ThrottledFrameClock)?.Source as StopwatchClock; From 2d3995b85c13a55f1fe4c49310e08fd38acdb313 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 01:32:20 -0300 Subject: [PATCH 03/36] Fix filter controls having margin when no controls given, add DisplayStyleControl to social, misc cleanups --- .../Overlays/Browse/BrowseFilterControl.cs | 13 +++-- osu.Game/Overlays/Browse/BrowseOverlay.cs | 1 - osu.Game/Overlays/Social/FilterControl.cs | 12 +++++ osu.Game/Overlays/Social/Header.cs | 13 +++++ osu.Game/Overlays/SocialOverlay.cs | 47 +++++++++++-------- 5 files changed, 58 insertions(+), 28 deletions(-) diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/Browse/BrowseFilterControl.cs index fe61771f5b..1eeadfb6d3 100644 --- a/osu.Game/Overlays/Browse/BrowseFilterControl.cs +++ b/osu.Game/Overlays/Browse/BrowseFilterControl.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Browse protected abstract Color4 BackgroundColour { get; } protected abstract T DefaultTab { get; } - protected virtual Drawable CreateControls() => new Container(); //todo: naming + protected virtual Drawable CreateControls() => null; //todo: naming public BrowseFilterControl() { @@ -34,6 +34,8 @@ namespace osu.Game.Overlays.Browse RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + var controls = CreateControls(); + Container controlsContainer; Children = new Drawable[] { new Box @@ -60,15 +62,11 @@ namespace osu.Game.Overlays.Browse { RelativeSizeAxes = Axes.X, }, - new Container + controlsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = padding }, //todo: margin is still applied without any controls - Children = new[] - { - CreateControls(), - }, + Margin = new MarginPadding { Top = controls != null ? padding : 0 }, }, Tabs = new PageTabControl { @@ -84,6 +82,7 @@ namespace osu.Game.Overlays.Browse }, }; + if (controls != null) controlsContainer.Children = new[] { controls }; Tabs.Current.Value = DefaultTab; Tabs.Current.TriggerChange(); } diff --git a/osu.Game/Overlays/Browse/BrowseOverlay.cs b/osu.Game/Overlays/Browse/BrowseOverlay.cs index dc5732b58f..412662c67b 100644 --- a/osu.Game/Overlays/Browse/BrowseOverlay.cs +++ b/osu.Game/Overlays/Browse/BrowseOverlay.cs @@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Browse } //todo: naming - //todo: crash when pressing tab public abstract class BrowseOverlay : BrowseOverlay { private readonly Container scrollContainer; diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index a5dcddad00..9e15cf4fe9 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.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.ComponentModel; using OpenTK.Graphics; using osu.Game.Graphics; using osu.Game.Overlays.Browse; @@ -12,4 +13,15 @@ namespace osu.Game.Overlays.Social protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; } + + public enum SocialSortCriteria + { + Name, + Rank, + Location, + [Description("Time Zone")] + TimeZone, + [Description("World Map")] + WorldMap, + } } diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index b540bd9a18..47ddc61453 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Framework.Allocation; +using System.ComponentModel; namespace osu.Game.Overlays.Social { @@ -48,4 +49,16 @@ namespace osu.Game.Overlays.Social browser.Colour = colours.Pink; } } + + public enum SocialTab + { + [Description("Online Players")] + OnlinePlayers, + [Description("Online Friends")] + OnlineFriends, + [Description("Online Team Members")] + OnlineTeamMembers, + [Description("Chat Channels")] + ChatChannels, + } } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 571d0b7130..19dfa6f182 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -3,10 +3,13 @@ using System.ComponentModel; using OpenTK.Graphics; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Overlays.Browse; using osu.Game.Overlays.Social; +using Container = osu.Framework.Graphics.Containers.Container; + namespace osu.Game.Overlays { public class SocialOverlay : BrowseOverlay @@ -17,28 +20,32 @@ namespace osu.Game.Overlays protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); protected override BrowseHeader CreateHeader() => new Header(); + + public SocialOverlay() + { + ScrollFlow.Children = new[] + { + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Vertical = 10 }, + Children = new[] + { + new DisplayStyleControl + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + }; + } } - public enum SocialTab + public enum SortDirection { - [Description("Online Players")] - OnlinePlayers, - [Description("Online Friends")] - OnlineFriends, - [Description("Online Team Members")] - OnlineTeamMembers, - [Description("Chat Channels")] - ChatChannels, - } - - public enum SocialSortCriteria - { - Name, - Rank, - Location, - [Description("Time Zone")] - TimeZone, - [Description("World Map")] - WorldMap, + Ascending, + Descending, } } From 5c0d0cb7e7cc68cb468b95d08bd572f085d86a05 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 01:34:30 -0300 Subject: [PATCH 04/36] Alpha on wrong object --- osu.Game/Overlays/Browse/BrowseFilterControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/Browse/BrowseFilterControl.cs index 1eeadfb6d3..9819ea4330 100644 --- a/osu.Game/Overlays/Browse/BrowseFilterControl.cs +++ b/osu.Game/Overlays/Browse/BrowseFilterControl.cs @@ -42,6 +42,7 @@ namespace osu.Game.Overlays.Browse { RelativeSizeAxes = Axes.Both, Colour = BackgroundColour, + Alpha = 0.9f, }, tabStrip = new Box { @@ -49,7 +50,6 @@ namespace osu.Game.Overlays.Browse Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Height = 1, - Alpha = 0.9f, }, new FillFlowContainer { From e19a4f5e6f62d6383c20e7217c6af1e216ce657d Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:00:38 -0300 Subject: [PATCH 05/36] Add displaying users --- .../Tests/TestCaseSocial.cs | 64 ++++++++++++++++++- osu.Game/Overlays/SocialOverlay.cs | 33 +++++++++- 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index 8fee8e6887..8f4ae0dbfe 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs @@ -3,6 +3,7 @@ using osu.Framework.Testing; using osu.Game.Overlays; +using osu.Game.Users; namespace osu.Desktop.VisualTests.Tests { @@ -14,7 +15,68 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - SocialOverlay s = new SocialOverlay(); + SocialOverlay s = new SocialOverlay + { + Users = new[] + { + new User + { + Username = @"flyte", + Id = 3103765, + Country = new Country { FlagName = @"JP" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg", + }, + new User + { + Username = @"Cookiezi", + Id = 124493, + Country = new Country { FlagName = @"KR" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", + }, + new User + { + Username = @"Angelism", + Id = 1777162, + Country = new Country { FlagName = @"KR" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", + }, + new User + { + Username = @"Rafis", + Id = 2558286, + Country = new Country { FlagName = @"PL" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg", + }, + new User + { + Username = @"hvick225", + Id = 50265, + Country = new Country { FlagName = @"TW" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/50265/cb79df0d6ddd04b57d057623417aa55c505810d8e73b1a96d6e665e0e18e5770.jpeg", + }, + new User + { + Username = @"peppy", + Id = 2, + Country = new Country { FlagName = @"AU" }, + CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/615362d26dc37cc4d46e61a08a2537e7cdf0e0e00f40574b18bf90156ad0280f.jpeg" + }, + new User + { + Username = @"filsdelama", + Id = 2831793, + Country = new Country { FlagName = @"FR" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg" + }, + new User + { + Username = @"_index", + Id = 652457, + Country = new Country { FlagName = @"RU" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg" + }, + }, + }; Add(s); AddStep(@"toggle", s.ToggleVisibility); diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 19dfa6f182..17cd587d1f 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -1,12 +1,17 @@ // 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.ComponentModel; +using System.Linq; +using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Overlays.Browse; using osu.Game.Overlays.Social; +using osu.Game.Users; using Container = osu.Framework.Graphics.Containers.Container; @@ -14,6 +19,26 @@ namespace osu.Game.Overlays { public class SocialOverlay : BrowseOverlay { + private readonly FillFlowContainer panelFlow; + + private IEnumerable users; + public IEnumerable Users + { + get { return users; } + set + { + if (users == value) return; + users = value; + + panelFlow.Children = users.Select(u => + { + var p = new UserPanel(u) { Width = 300 }; + p.Status.BindTo(u.Status); + return p; + }); + } + } + protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); @@ -23,7 +48,7 @@ namespace osu.Game.Overlays public SocialOverlay() { - ScrollFlow.Children = new[] + ScrollFlow.Children = new Drawable[] { new Container { @@ -39,6 +64,12 @@ namespace osu.Game.Overlays }, }, }, + panelFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Spacing = new Vector2(10f), + }, }; } } From fc67582c3f3a3c13303b3dfd4602f45a3c53b8fa Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:16:56 -0300 Subject: [PATCH 06/36] Cleanup --- osu.Desktop.VisualTests/Tests/TestCaseSocial.cs | 2 +- osu.Game/Overlays/Browse/BrowseFilterControl.cs | 3 ++- osu.Game/Overlays/Browse/BrowseHeader.cs | 4 +--- osu.Game/Overlays/Browse/BrowseOverlay.cs | 3 +-- osu.Game/Overlays/Browse/DisplayStyleControl.cs | 2 +- osu.Game/Overlays/Browse/HeaderTabControl.cs | 2 +- osu.Game/Overlays/Direct/Header.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 3 --- osu.Game/Overlays/SocialOverlay.cs | 17 +++++++---------- 9 files changed, 15 insertions(+), 23 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index 8f4ae0dbfe..37d85ce0c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.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 osu.Framework.Testing; diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/Browse/BrowseFilterControl.cs index 9819ea4330..d21c36bd5c 100644 --- a/osu.Game/Overlays/Browse/BrowseFilterControl.cs +++ b/osu.Game/Overlays/Browse/BrowseFilterControl.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 System; @@ -83,6 +83,7 @@ namespace osu.Game.Overlays.Browse }; if (controls != null) controlsContainer.Children = new[] { controls }; + Tabs.Current.Value = DefaultTab; Tabs.Current.TriggerChange(); } diff --git a/osu.Game/Overlays/Browse/BrowseHeader.cs b/osu.Game/Overlays/Browse/BrowseHeader.cs index 47f2d6d8c2..450245bde5 100644 --- a/osu.Game/Overlays/Browse/BrowseHeader.cs +++ b/osu.Game/Overlays/Browse/BrowseHeader.cs @@ -1,8 +1,7 @@ -// 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; -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -10,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Browse { diff --git a/osu.Game/Overlays/Browse/BrowseOverlay.cs b/osu.Game/Overlays/Browse/BrowseOverlay.cs index 412662c67b..ba8262ef06 100644 --- a/osu.Game/Overlays/Browse/BrowseOverlay.cs +++ b/osu.Game/Overlays/Browse/BrowseOverlay.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; @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; -using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Overlays.Browse diff --git a/osu.Game/Overlays/Browse/DisplayStyleControl.cs b/osu.Game/Overlays/Browse/DisplayStyleControl.cs index ae9397eca7..5570d60bb7 100644 --- a/osu.Game/Overlays/Browse/DisplayStyleControl.cs +++ b/osu.Game/Overlays/Browse/DisplayStyleControl.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; diff --git a/osu.Game/Overlays/Browse/HeaderTabControl.cs b/osu.Game/Overlays/Browse/HeaderTabControl.cs index afe3f2cb5e..cdac8d2dd9 100644 --- a/osu.Game/Overlays/Browse/HeaderTabControl.cs +++ b/osu.Game/Overlays/Browse/HeaderTabControl.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; diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index b8b06580c2..a1daa0a2b4 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Direct protected override float TabStripWidth => 298; protected override DirectTab DefaultTab => DirectTab.Search; - protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", TextSize = 25, }; + protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", TextSize = 25 }; public Header() { diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index e57a556461..9ab19aa6f9 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -13,9 +13,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; using osu.Game.Overlays.Browse; using OpenTK.Graphics; -using System.ComponentModel; - -using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 17cd587d1f..e744e4ca13 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using OpenTK; using OpenTK.Graphics; @@ -13,14 +12,19 @@ using osu.Game.Overlays.Browse; using osu.Game.Overlays.Social; using osu.Game.Users; -using Container = osu.Framework.Graphics.Containers.Container; - namespace osu.Game.Overlays { public class SocialOverlay : BrowseOverlay { private readonly FillFlowContainer panelFlow; + protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); + protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); + protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); + + protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); + protected override BrowseHeader CreateHeader() => new Header(); + private IEnumerable users; public IEnumerable Users { @@ -39,13 +43,6 @@ namespace osu.Game.Overlays } } - protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); - protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); - protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); - - protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); - protected override BrowseHeader CreateHeader() => new Header(); - public SocialOverlay() { ScrollFlow.Children = new Drawable[] From 5831da69788c3d43ed0ca9f701293e4420eb3bb5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:32:01 -0300 Subject: [PATCH 07/36] Autohide social when entering a screen that doesn't allow overlays, fix potential nullrefs in DirectOverlay, CreateControls -> CreateSupplementaryControls --- osu.Game/OsuGame.cs | 1 + osu.Game/Overlays/Browse/BrowseFilterControl.cs | 4 ++-- osu.Game/Overlays/Direct/FilterControl.cs | 4 ++-- osu.Game/Overlays/DirectOverlay.cs | 13 +++++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 850e736edb..224d944ac4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -295,6 +295,7 @@ namespace osu.Game musicController.State = Visibility.Hidden; chat.State = Visibility.Hidden; direct.State = Visibility.Hidden; + social.State = Visibility.Hidden; } else { diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/Browse/BrowseFilterControl.cs index d21c36bd5c..a395c1c01d 100644 --- a/osu.Game/Overlays/Browse/BrowseFilterControl.cs +++ b/osu.Game/Overlays/Browse/BrowseFilterControl.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Browse protected abstract Color4 BackgroundColour { get; } protected abstract T DefaultTab { get; } - protected virtual Drawable CreateControls() => null; //todo: naming + protected virtual Drawable CreateSupplementaryControls() => null; public BrowseFilterControl() { @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Browse RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - var controls = CreateControls(); + var controls = CreateSupplementaryControls(); Container controlsContainer; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 20e9eb4aa1..bc82352c33 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -17,11 +17,11 @@ namespace osu.Game.Overlays.Direct { private FillFlowContainer modeButtons; - public readonly DisplayStyleControl DisplayStyleControl; //todo: naming + public readonly DisplayStyleControl DisplayStyleControl; protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); protected override DirectSortCritera DefaultTab => DirectSortCritera.Title; - protected override Drawable CreateControls() + protected override Drawable CreateSupplementaryControls() { modeButtons = new FillFlowContainer { diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 9ab19aa6f9..d4522e227b 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; using osu.Game.Overlays.Browse; using OpenTK.Graphics; +using System; namespace osu.Game.Overlays { @@ -40,7 +41,9 @@ namespace osu.Game.Overlays if (beatmapSets?.Equals(value) ?? false) return; beatmapSets = value; - recreatePanels((Filter as FilterControl).DisplayStyleControl.DisplayStyle.Value); //todo: potential nullref + var s = PanelDisplayStyle.Grid; + withDisplayStyleControl(c => s = c.DisplayStyle.Value); + recreatePanels(s); } } @@ -100,7 +103,7 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; - (Filter as FilterControl).DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; //todo: potential nullref + withDisplayStyleControl(c => c.DisplayStyle.ValueChanged += recreatePanels); updateResultCounts(); } @@ -132,6 +135,12 @@ namespace osu.Game.Overlays panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } + private void withDisplayStyleControl(Action> action) + { + var f = (Filter as FilterControl); + if (f != null) action.Invoke(f.DisplayStyleControl); + } + public class ResultCounts { public readonly int Artists; From 68377494f728a0863800ffa389fb16cb5e33b292 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:44:09 -0300 Subject: [PATCH 08/36] Browser - SearchableList --- osu.Game/Overlays/Direct/FilterControl.cs | 6 +++--- osu.Game/Overlays/Direct/Header.cs | 4 ++-- osu.Game/Overlays/DirectOverlay.cs | 8 ++++---- .../DisplayStyleControl.cs | 2 +- .../HeaderTabControl.cs | 2 +- .../SearchableListFilterControl.cs} | 8 ++++---- .../SearchableListHeader.cs} | 8 ++++---- .../SearchableListOverlay.cs} | 18 +++++++++--------- .../SlimEnumDropdown.cs | 2 +- osu.Game/Overlays/Social/FilterControl.cs | 4 ++-- osu.Game/Overlays/Social/Header.cs | 4 ++-- osu.Game/Overlays/SocialOverlay.cs | 8 ++++---- osu.Game/osu.Game.csproj | 12 ++++++------ 13 files changed, 43 insertions(+), 43 deletions(-) rename osu.Game/Overlays/{Browse => SearchableList}/DisplayStyleControl.cs (96%) rename osu.Game/Overlays/{Browse => SearchableList}/HeaderTabControl.cs (91%) rename osu.Game/Overlays/{Browse/BrowseFilterControl.cs => SearchableList/SearchableListFilterControl.cs} (92%) rename osu.Game/Overlays/{Browse/BrowseHeader.cs => SearchableList/SearchableListHeader.cs} (89%) rename osu.Game/Overlays/{Browse/BrowseOverlay.cs => SearchableList/SearchableListOverlay.cs} (84%) rename osu.Game/Overlays/{Browse => SearchableList}/SlimEnumDropdown.cs (93%) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index bc82352c33..05b7597e67 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -9,11 +9,11 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct { - public class FilterControl : BrowseFilterControl + public class FilterControl : SearchableListFilterControl { private FillFlowContainer modeButtons; @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Direct { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Margin = new MarginPadding { Bottom = 5, Right = BrowseOverlay.WIDTH_PADDING }, + Margin = new MarginPadding { Bottom = 5, Right = SearchableListOverlay.WIDTH_PADDING }, }); } diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index a1daa0a2b4..e5b7c7f149 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -6,11 +6,11 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct { - public class Header : BrowseHeader + public class Header : SearchableListHeader { protected override Color4 BackgroundColour => OsuColour.FromHex(@"252f3a"); protected override float TabStripWidth => 298; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index d4522e227b..0aeec4397a 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -11,13 +11,13 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; using OpenTK.Graphics; using System; namespace osu.Game.Overlays { - public class DirectOverlay : BrowseOverlay + public class DirectOverlay : SearchableListOverlay { private const float panel_padding = 10f; @@ -29,8 +29,8 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"465b71"); protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); - protected override BrowseHeader CreateHeader() => new Header(); - protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListHeader CreateHeader() => new Header(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable beatmapSets; public IEnumerable BeatmapSets diff --git a/osu.Game/Overlays/Browse/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs similarity index 96% rename from osu.Game/Overlays/Browse/DisplayStyleControl.cs rename to osu.Game/Overlays/SearchableList/DisplayStyleControl.cs index 5570d60bb7..b37b0db139 100644 --- a/osu.Game/Overlays/Browse/DisplayStyleControl.cs +++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { public class DisplayStyleControl : Container { diff --git a/osu.Game/Overlays/Browse/HeaderTabControl.cs b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs similarity index 91% rename from osu.Game/Overlays/Browse/HeaderTabControl.cs rename to osu.Game/Overlays/SearchableList/HeaderTabControl.cs index cdac8d2dd9..56569fcca5 100644 --- a/osu.Game/Overlays/Browse/HeaderTabControl.cs +++ b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { public class HeaderTabControl : OsuTabControl { diff --git a/osu.Game/Overlays/Browse/BrowseFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs similarity index 92% rename from osu.Game/Overlays/Browse/BrowseFilterControl.cs rename to osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index a395c1c01d..4d4855b3c9 100644 --- a/osu.Game/Overlays/Browse/BrowseFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -11,9 +11,9 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { - public abstract class BrowseFilterControl : Container + public abstract class SearchableListFilterControl : Container { private const float padding = 10; @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Browse protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; - public BrowseFilterControl() + public SearchableListFilterControl() { if (!typeof(T).IsEnum) throw new InvalidOperationException("BrowseFilterControl only supports enums as the generic type argument"); @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Browse { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = padding, Horizontal = BrowseOverlay.WIDTH_PADDING }, + Padding = new MarginPadding { Top = padding, Horizontal = SearchableListOverlay.WIDTH_PADDING }, Children = new Drawable[] { Search = new FilterSearchTextBox diff --git a/osu.Game/Overlays/Browse/BrowseHeader.cs b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs similarity index 89% rename from osu.Game/Overlays/Browse/BrowseHeader.cs rename to osu.Game/Overlays/SearchableList/SearchableListHeader.cs index 450245bde5..4ea908a8c2 100644 --- a/osu.Game/Overlays/Browse/BrowseHeader.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs @@ -10,9 +10,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { - public abstract class BrowseHeader : Container + public abstract class SearchableListHeader : Container { public static readonly float HEIGHT = 90; @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Browse protected abstract T DefaultTab { get; } protected abstract Drawable CreateHeaderText(); - public BrowseHeader() + public SearchableListHeader() { if (!typeof(T).IsEnum) throw new InvalidOperationException("BrowseHeader only supports enums as the generic type argument"); @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Browse new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = BrowseOverlay.WIDTH_PADDING, Right = BrowseOverlay.WIDTH_PADDING },  + Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING },  Children = new Drawable[] { new FillFlowContainer diff --git a/osu.Game/Overlays/Browse/BrowseOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs similarity index 84% rename from osu.Game/Overlays/Browse/BrowseOverlay.cs rename to osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index ba8262ef06..c2981bb350 100644 --- a/osu.Game/Overlays/Browse/BrowseOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -8,29 +8,29 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Backgrounds; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { - public abstract class BrowseOverlay : WaveOverlayContainer + public abstract class SearchableListOverlay : WaveOverlayContainer { public static readonly float WIDTH_PADDING = 80; } //todo: naming - public abstract class BrowseOverlay : BrowseOverlay + public abstract class SearchableListOverlay : SearchableListOverlay { private readonly Container scrollContainer; - protected readonly BrowseHeader Header; - protected readonly BrowseFilterControl Filter; + protected readonly SearchableListHeader Header; + protected readonly SearchableListFilterControl Filter; protected readonly FillFlowContainer ScrollFlow; protected abstract Color4 BackgroundColour { get; } protected abstract Color4 TrianglesColourLight { get; } protected abstract Color4 TrianglesColourDark { get; } - protected abstract BrowseHeader CreateHeader(); - protected abstract BrowseFilterControl CreateFilterControl(); + protected abstract SearchableListHeader CreateHeader(); + protected abstract SearchableListFilterControl CreateFilterControl(); - public BrowseOverlay() + public SearchableListOverlay() { RelativeSizeAxes = Axes.Both; @@ -82,7 +82,7 @@ namespace osu.Game.Overlays.Browse { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = BrowseOverlay.WIDTH_PADDING }, + Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Direction = FillDirection.Vertical, }, }, diff --git a/osu.Game/Overlays/Browse/SlimEnumDropdown.cs b/osu.Game/Overlays/SearchableList/SlimEnumDropdown.cs similarity index 93% rename from osu.Game/Overlays/Browse/SlimEnumDropdown.cs rename to osu.Game/Overlays/SearchableList/SlimEnumDropdown.cs index a3687174a0..6c0887b5df 100644 --- a/osu.Game/Overlays/Browse/SlimEnumDropdown.cs +++ b/osu.Game/Overlays/SearchableList/SlimEnumDropdown.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Browse +namespace osu.Game.Overlays.SearchableList { public class SlimEnumDropdown : OsuEnumDropdown { diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index 9e15cf4fe9..848041c7c2 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -4,11 +4,11 @@ using System.ComponentModel; using OpenTK.Graphics; using osu.Game.Graphics; -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Social { - public class FilterControl : BrowseFilterControl + public class FilterControl : SearchableListFilterControl { protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 47ddc61453..1e23a0866d 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; @@ -12,7 +12,7 @@ using System.ComponentModel; namespace osu.Game.Overlays.Social { - public class Header : BrowseHeader + public class Header : SearchableListHeader { private OsuSpriteText browser; diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index e744e4ca13..c18fc0479d 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -8,13 +8,13 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Overlays.Browse; +using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; namespace osu.Game.Overlays { - public class SocialOverlay : BrowseOverlay + public class SocialOverlay : SearchableListOverlay { private readonly FillFlowContainer panelFlow; @@ -22,8 +22,8 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourLight => OsuColour.FromHex(@"672b51"); protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); - protected override BrowseFilterControl CreateFilterControl() => new FilterControl(); - protected override BrowseHeader CreateHeader() => new Header(); + protected override SearchableListHeader CreateHeader() => new Header(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable users; public IEnumerable Users diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fb1db37f65..b1bb5e5828 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -448,16 +448,16 @@ - - + + - - + + - - + + From 8359f6ced0e02441b702a7e8ce8587c4d7b5969f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:49:04 -0300 Subject: [PATCH 09/36] Incorrect colour --- osu.Game/Overlays/Social/Header.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index 1e23a0866d..bad0e73327 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Social { private OsuSpriteText browser; - protected override Color4 BackgroundColour => OsuColour.FromHex(@"672b51"); + protected override Color4 BackgroundColour => OsuColour.FromHex(@"38202e"); protected override float TabStripWidth => 438; protected override SocialTab DefaultTab => SocialTab.OnlinePlayers; From 28ee00109d00da4f5bb25b3303c4afb7ff5aed61 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 02:55:25 -0300 Subject: [PATCH 10/36] Wave colours --- osu.Game/Overlays/SocialOverlay.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index c18fc0479d..816e50dd60 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -45,6 +45,11 @@ namespace osu.Game.Overlays public SocialOverlay() { + FirstWaveColour = OsuColour.FromHex(@"CB5FA0"); + SecondWaveColour = OsuColour.FromHex(@"B04384"); + ThirdWaveColour = OsuColour.FromHex(@"9B2B6E"); + FourthWaveColour = OsuColour.FromHex(@"6D214D"); + ScrollFlow.Children = new Drawable[] { new Container From 5785715ad5870958b7d703234cfcf8a6c70f58ac Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 03:10:36 -0300 Subject: [PATCH 11/36] CI fixes --- osu.Game/Overlays/DirectOverlay.cs | 2 +- .../SearchableList/SearchableListFilterControl.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListHeader.cs | 8 +++----- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 4 ++-- osu.Game/Overlays/SocialOverlay.cs | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0aeec4397a..f494d4605d 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -137,7 +137,7 @@ namespace osu.Game.Overlays private void withDisplayStyleControl(Action> action) { - var f = (Filter as FilterControl); + var f = Filter as FilterControl; if (f != null) action.Invoke(f.DisplayStyleControl); } diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 4d4855b3c9..4984546d8d 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; - public SearchableListFilterControl() + protected SearchableListFilterControl() { if (!typeof(T).IsEnum) throw new InvalidOperationException("BrowseFilterControl only supports enums as the generic type argument"); diff --git a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs index 4ea908a8c2..b65e031488 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs @@ -14,8 +14,6 @@ namespace osu.Game.Overlays.SearchableList { public abstract class SearchableListHeader : Container { - public static readonly float HEIGHT = 90; - private readonly Box tabStrip; public readonly HeaderTabControl Tabs; @@ -25,13 +23,13 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected abstract Drawable CreateHeaderText(); - public SearchableListHeader() + protected SearchableListHeader() { if (!typeof(T).IsEnum) throw new InvalidOperationException("BrowseHeader only supports enums as the generic type argument"); RelativeSizeAxes = Axes.X; - Height = HEIGHT; + Height = 90; Children = new Drawable[] { @@ -54,7 +52,7 @@ namespace osu.Game.Overlays.SearchableList AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), - Children = new Drawable[] + Children = new[] { new TextAwesome { diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index c2981bb350..ea4ce029e5 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.SearchableList protected abstract SearchableListHeader CreateHeader(); protected abstract SearchableListFilterControl CreateFilterControl(); - public SearchableListOverlay() + protected SearchableListOverlay() { RelativeSizeAxes = Axes.Both; @@ -82,7 +82,7 @@ namespace osu.Game.Overlays.SearchableList { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, + Padding = new MarginPadding { Horizontal = WIDTH_PADDING }, Direction = FillDirection.Vertical, }, }, diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 816e50dd60..18f9dab8f4 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays get { return users; } set { - if (users == value) return; + if (users?.Equals(value) ?? false) return; users = value; panelFlow.Children = users.Select(u => From 12f6276e050878d8c4e630ee0b3b27721b16d3be Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 06:05:05 -0300 Subject: [PATCH 12/36] Move DisplayStyleControl to all FilterControls --- osu.Game/Overlays/Direct/FilterControl.cs | 14 +------------ osu.Game/Overlays/DirectOverlay.cs | 16 ++++---------- .../SearchableListFilterControl.cs | 9 +++++++- .../SearchableList/SearchableListOverlay.cs | 7 +++---- osu.Game/Overlays/Social/FilterControl.cs | 9 +++++++- osu.Game/Overlays/SocialOverlay.cs | 21 ++++--------------- 6 files changed, 28 insertions(+), 48 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 05b7597e67..6aa45d8321 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -13,12 +13,10 @@ using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { private FillFlowContainer modeButtons; - public readonly DisplayStyleControl DisplayStyleControl; - protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552"); protected override DirectSortCritera DefaultTab => DirectSortCritera.Title; protected override Drawable CreateSupplementaryControls() @@ -32,16 +30,6 @@ namespace osu.Game.Overlays.Direct return modeButtons; } - public FilterControl() - { - Add(DisplayStyleControl = new DisplayStyleControl - { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding { Bottom = 5, Right = SearchableListOverlay.WIDTH_PADDING }, - }); - } - [BackgroundDependencyLoader(true)] private void load(OsuGame game, RulesetDatabase rulesets, OsuColour colours) { diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index f494d4605d..0d39e6bf73 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -17,7 +17,7 @@ using System; namespace osu.Game.Overlays { - public class DirectOverlay : SearchableListOverlay + public class DirectOverlay : SearchableListOverlay { private const float panel_padding = 10f; @@ -30,7 +30,7 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable beatmapSets; public IEnumerable BeatmapSets @@ -41,9 +41,7 @@ namespace osu.Game.Overlays if (beatmapSets?.Equals(value) ?? false) return; beatmapSets = value; - var s = PanelDisplayStyle.Grid; - withDisplayStyleControl(c => s = c.DisplayStyle.Value); - recreatePanels(s); + recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); } } @@ -103,7 +101,7 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; - withDisplayStyleControl(c => c.DisplayStyle.ValueChanged += recreatePanels); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; updateResultCounts(); } @@ -135,12 +133,6 @@ namespace osu.Game.Overlays panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } - private void withDisplayStyleControl(Action> action) - { - var f = Filter as FilterControl; - if (f != null) action.Invoke(f.DisplayStyleControl); - } - public class ResultCounts { public readonly int Artists; diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 4984546d8d..54863e0219 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.SearchableList { - public abstract class SearchableListFilterControl : Container + public abstract class SearchableListFilterControl : Container { private const float padding = 10; @@ -21,6 +21,7 @@ namespace osu.Game.Overlays.SearchableList public readonly SearchTextBox Search; public readonly PageTabControl Tabs; + public readonly DisplayStyleControl DisplayStyleControl; protected abstract Color4 BackgroundColour { get; } protected abstract T DefaultTab { get; } @@ -80,6 +81,12 @@ namespace osu.Game.Overlays.SearchableList }, }, }, + DisplayStyleControl = new DisplayStyleControl + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { Bottom = 5, Right = SearchableListOverlay.WIDTH_PADDING }, + }, }; if (controls != null) controlsContainer.Children = new[] { controls }; diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index ea4ce029e5..7e0be0ff92 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -15,20 +15,19 @@ namespace osu.Game.Overlays.SearchableList public static readonly float WIDTH_PADDING = 80; } - //todo: naming - public abstract class SearchableListOverlay : SearchableListOverlay + public abstract class SearchableListOverlay : SearchableListOverlay { private readonly Container scrollContainer; protected readonly SearchableListHeader Header; - protected readonly SearchableListFilterControl Filter; + protected readonly SearchableListFilterControl Filter; protected readonly FillFlowContainer ScrollFlow; protected abstract Color4 BackgroundColour { get; } protected abstract Color4 TrianglesColourLight { get; } protected abstract Color4 TrianglesColourDark { get; } protected abstract SearchableListHeader CreateHeader(); - protected abstract SearchableListFilterControl CreateFilterControl(); + protected abstract SearchableListFilterControl CreateFilterControl(); protected SearchableListOverlay() { diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index 848041c7c2..30470097e6 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -3,15 +3,22 @@ using System.ComponentModel; using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Social { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; + + public FilterControl() + { + Tabs.Margin = new MarginPadding { Top = 10 }; + } } public enum SocialSortCriteria diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 18f9dab8f4..64ad26b137 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -14,7 +14,7 @@ using osu.Game.Users; namespace osu.Game.Overlays { - public class SocialOverlay : SearchableListOverlay + public class SocialOverlay : SearchableListOverlay { private readonly FillFlowContainer panelFlow; @@ -23,7 +23,7 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable users; public IEnumerable Users @@ -50,26 +50,13 @@ namespace osu.Game.Overlays ThirdWaveColour = OsuColour.FromHex(@"9B2B6E"); FourthWaveColour = OsuColour.FromHex(@"6D214D"); - ScrollFlow.Children = new Drawable[] + ScrollFlow.Children = new[] { - new Container - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Vertical = 10 }, - Children = new[] - { - new DisplayStyleControl - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - }, - }, - }, panelFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(10f), }, }; From c0999c7fc117b4b41b38d42585c523d9197a30f5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 26 May 2017 06:12:22 -0300 Subject: [PATCH 13/36] Unused using directives --- osu.Game/Overlays/DirectOverlay.cs | 1 - osu.Game/Overlays/Social/FilterControl.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0d39e6bf73..916c774ecc 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -13,7 +13,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; using osu.Game.Overlays.SearchableList; using OpenTK.Graphics; -using System; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index 30470097e6..feb3c737f0 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.SearchableList; From 7bdbd3713adc236fe3119d282ecde3d079eb2ce7 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 27 May 2017 17:23:14 -0300 Subject: [PATCH 14/36] More reliable test data --- osu.Desktop.VisualTests/Tests/TestCaseSocial.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index 37d85ce0c9..1f2f655a5a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs @@ -24,14 +24,14 @@ namespace osu.Desktop.VisualTests.Tests Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/3103765/5b012e13611d5761caa7e24fecb3d3a16e1cf48fc2a3032cfd43dd444af83d82.jpeg", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", }, new User { Username = @"Cookiezi", Id = 124493, Country = new Country { FlagName = @"KR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg", }, new User { @@ -45,35 +45,35 @@ namespace osu.Desktop.VisualTests.Tests Username = @"Rafis", Id = 2558286, Country = new Country { FlagName = @"PL" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg", }, new User { Username = @"hvick225", Id = 50265, Country = new Country { FlagName = @"TW" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/50265/cb79df0d6ddd04b57d057623417aa55c505810d8e73b1a96d6e665e0e18e5770.jpeg", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg", }, new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }, - CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/615362d26dc37cc4d46e61a08a2537e7cdf0e0e00f40574b18bf90156ad0280f.jpeg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, new User { Username = @"filsdelama", Id = 2831793, Country = new Country { FlagName = @"FR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg" }, new User { Username = @"_index", Id = 652457, Country = new Country { FlagName = @"RU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg" + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c8.jpg" }, }, }; From 239472c451c010067d6bcc72c1e5889f4e48b2b6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 27 May 2017 18:35:46 -0300 Subject: [PATCH 15/36] Lowercase hex colours --- osu.Game/Overlays/SocialOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 64ad26b137..2b4dfe9198 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -45,10 +45,10 @@ namespace osu.Game.Overlays public SocialOverlay() { - FirstWaveColour = OsuColour.FromHex(@"CB5FA0"); - SecondWaveColour = OsuColour.FromHex(@"B04384"); - ThirdWaveColour = OsuColour.FromHex(@"9B2B6E"); - FourthWaveColour = OsuColour.FromHex(@"6D214D"); + FirstWaveColour = OsuColour.FromHex(@"cb5fa0"); + SecondWaveColour = OsuColour.FromHex(@"b04384"); + ThirdWaveColour = OsuColour.FromHex(@"9b2b6e"); + FourthWaveColour = OsuColour.FromHex(@"6d214d"); ScrollFlow.Children = new[] { From 816caf86eabe5d5a7a7471a740a212da2e7ad969 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 27 May 2017 18:49:55 -0300 Subject: [PATCH 16/36] Better exception for SearchableListFilterControl's generic type argument not being an enum --- osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 54863e0219..50011e4b8e 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.SearchableList protected SearchableListFilterControl() { if (!typeof(T).IsEnum) - throw new InvalidOperationException("BrowseFilterControl only supports enums as the generic type argument"); + throw new InvalidOperationException("SearchableListFilterControl's sort tabs only support enums as the generic type argument"); RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; From 8994c57f3c4f54e389d35a2b67af6ab17baa97ea Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sun, 28 May 2017 15:14:22 -0300 Subject: [PATCH 17/36] Update with framework changes --- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 7e0be0ff92..7a32b74032 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.SearchableList protected override bool OnFocus(InputState state) { - Filter.Search.TriggerFocus(); + Filter.Search.TriggerOnFocus(); return false; } From b6cb9d32298e70dc77764466286420ac1b006e50 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 29 May 2017 22:39:59 -0300 Subject: [PATCH 18/36] Fix display style dropdown scaling the filter control --- .../SearchableListFilterControl.cs | 84 +++++++++++-------- .../SearchableList/SearchableListOverlay.cs | 23 ++--- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 50011e4b8e..95651833d3 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -2,6 +2,7 @@ // 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.Color4Extensions; @@ -17,6 +18,7 @@ namespace osu.Game.Overlays.SearchableList { private const float padding = 10; + private readonly Container filterContainer; private readonly Box tabStrip; public readonly SearchTextBox Search; @@ -27,65 +29,73 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; + protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); + protected SearchableListFilterControl() { if (!typeof(T).IsEnum) throw new InvalidOperationException("SearchableListFilterControl's sort tabs only support enums as the generic type argument"); RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; var controls = CreateSupplementaryControls(); Container controlsContainer; Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = BackgroundColour, - Alpha = 0.9f, - }, - tabStrip = new Box - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 1, - }, - new FillFlowContainer + filterContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = padding, Horizontal = SearchableListOverlay.WIDTH_PADDING }, Children = new Drawable[] { - Search = new FilterSearchTextBox + new Box { - RelativeSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Both, + Colour = BackgroundColour, + Alpha = 0.9f, }, - controlsContainer = new Container + tabStrip = new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = 1, + }, + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Margin = new MarginPadding { Top = controls != null ? padding : 0 }, - }, - Tabs = new PageTabControl - { - RelativeSizeAxes = Axes.X, - }, - new Box //keep the tab strip part of autosize, but don't put it in the flow container - { - RelativeSizeAxes = Axes.X, - Height = 1, - Colour = Color4.White.Opacity(0), + Padding = new MarginPadding { Top = padding, Horizontal = SearchableListOverlay.WIDTH_PADDING }, + Children = new Drawable[] + { + Search = new FilterSearchTextBox + { + RelativeSizeAxes = Axes.X, + }, + controlsContainer = new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = controls != null ? padding : 0 }, + }, + Tabs = new PageTabControl + { + RelativeSizeAxes = Axes.X, + }, + new Box //keep the tab strip part of autosize, but don't put it in the flow container + { + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = Color4.White.Opacity(0), + }, + }, }, }, }, DisplayStyleControl = new DisplayStyleControl { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding { Bottom = 5, Right = SearchableListOverlay.WIDTH_PADDING }, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, }, }; @@ -101,6 +111,14 @@ namespace osu.Game.Overlays.SearchableList tabStrip.Colour = colours.Yellow; } + protected override void Update() + { + base.Update(); + + Height = filterContainer.Height; + DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING }; + } + private class FilterSearchTextBox : SearchTextBox { protected override Color4 BackgroundUnfocused => backgroundColour; diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 7a32b74032..4f96807eb7 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -55,17 +55,6 @@ namespace osu.Game.Overlays.SearchableList }, }, }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - Header = CreateHeader(), - Filter = CreateFilterControl(), - }, - }, scrollContainer = new Container { RelativeSizeAxes = Axes.Both, @@ -88,6 +77,18 @@ namespace osu.Game.Overlays.SearchableList }, }, }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + AlwaysReceiveInput = true, + Children = new Drawable[] + { + Header = CreateHeader(), + Filter = CreateFilterControl(), + }, + }, }; Filter.Search.Exit = Hide; From a1453eb9e1f0c6b14990f50ec8febedc00311379 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 29 May 2017 22:52:38 -0300 Subject: [PATCH 19/36] Fix filter text box input --- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 4f96807eb7..7f9aed3939 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -103,7 +103,7 @@ namespace osu.Game.Overlays.SearchableList protected override bool OnFocus(InputState state) { - Filter.Search.TriggerOnFocus(); + InputManager.ChangeFocus(Filter.Search); return false; } From 9942733b63ea3b3753441bb7f79629c791cea860 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 31 May 2017 05:22:54 -0300 Subject: [PATCH 20/36] Trim whitespace --- 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 281d27b7c1..916c774ecc 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -131,7 +131,7 @@ namespace osu.Game.Overlays if (BeatmapSets == null) return; panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); } - + public class ResultCounts { public readonly int Artists; From ec8a88c96a1b5dfee6d98febd17f2547b22c856f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 31 May 2017 05:28:50 -0300 Subject: [PATCH 21/36] Update with framework changes --- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 7f9aed3939..7705fa0582 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.SearchableList new ScrollContainer { RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, + ScrollbarVisible = false, Children = new[] { ScrollFlow = new FillFlowContainer @@ -101,10 +101,9 @@ namespace osu.Game.Overlays.SearchableList scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height }; } - protected override bool OnFocus(InputState state) + protected override void OnFocus(InputState state) { InputManager.ChangeFocus(Filter.Search); - return false; } protected override void PopIn() From 0439b15728bb42051dc496dbcc7a260b2e7d5cde Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 31 May 2017 21:29:50 -0300 Subject: [PATCH 22/36] Generic type argument formatting --- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 4 ++-- osu.Game/Overlays/Social/FilterControl.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 6aa45d8321..455d0ab77b 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -13,7 +13,7 @@ using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Direct { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { private FillFlowContainer modeButtons; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 916c774ecc..93c440384b 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -16,7 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Overlays { - public class DirectOverlay : SearchableListOverlay + public class DirectOverlay : SearchableListOverlay { private const float panel_padding = 10f; @@ -29,7 +29,7 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable beatmapSets; public IEnumerable BeatmapSets diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index feb3c737f0..789c7b6a64 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/FilterControl.cs @@ -9,7 +9,7 @@ using osu.Game.Overlays.SearchableList; namespace osu.Game.Overlays.Social { - public class FilterControl : SearchableListFilterControl + public class FilterControl : SearchableListFilterControl { protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 2b4dfe9198..448539607d 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -14,7 +14,7 @@ using osu.Game.Users; namespace osu.Game.Overlays { - public class SocialOverlay : SearchableListOverlay + public class SocialOverlay : SearchableListOverlay { private readonly FillFlowContainer panelFlow; @@ -23,7 +23,7 @@ namespace osu.Game.Overlays protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"5c2648"); protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); + protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable users; public IEnumerable Users From c9403c520033e0cef8e7b2ad5c1c3ed2e5dc7d5c Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 31 May 2017 21:32:50 -0300 Subject: [PATCH 23/36] Incorrect test data spelling --- osu.Desktop.VisualTests/Tests/TestCaseSocial.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index 1f2f655a5a..eb7df96355 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs @@ -35,7 +35,7 @@ namespace osu.Desktop.VisualTests.Tests }, new User { - Username = @"Angelism", + Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", From 5568df1aee9fc495ea81cdb95b66fe42151706ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Jun 2017 17:15:04 +0900 Subject: [PATCH 24/36] Remove StandardHUDOverlay This class hierarchy was originally when we had different HUDs for rulesets, but this is no longer the case. Skins will be able to build off the base (new) HUDOverlay without issue, so there is no real need for the abstract class for now. We can add it back if a need for it arises; for the moment I'd like to avoid as many Standard* classes as possible. --- osu.Game/Screens/Play/HUDOverlay.cs | 113 ++++++++++++++++---- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/StandardHUDOverlay.cs | 105 ------------------ osu.Game/osu.Game.csproj | 1 - 4 files changed, 95 insertions(+), 126 deletions(-) delete mode 100644 osu.Game/Screens/Play/StandardHUDOverlay.cs diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 616b28fa99..3248495b61 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -7,21 +7,24 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play.HUD; +using OpenTK; using OpenTK.Input; namespace osu.Game.Screens.Play { - public abstract class HUDOverlay : Container + public class HUDOverlay : Container { private const int duration = 100; private readonly Container content; + public readonly KeyCounterCollection KeyCounter; public readonly RollingCounter ComboCounter; public readonly ScoreCounter ScoreCounter; @@ -35,16 +38,7 @@ namespace osu.Game.Screens.Play private static bool hasShownNotificationOnce; - protected abstract KeyCounterCollection CreateKeyCounter(); - protected abstract RollingCounter CreateComboCounter(); - protected abstract RollingCounter CreateAccuracyCounter(); - protected abstract ScoreCounter CreateScoreCounter(); - protected abstract HealthDisplay CreateHealthDisplay(); - protected abstract SongProgress CreateProgress(); - protected abstract ModDisplay CreateModsContainer(); - //protected abstract ReplaySettingsOverlay CreateReplaySettingsOverlay(); - - protected HUDOverlay() + public HUDOverlay() { RelativeSizeAxes = Axes.Both; @@ -67,7 +61,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuConfigManager config, NotificationManager notificationManager) + private void load(OsuConfigManager config, NotificationManager notificationManager, OsuColour colours) { showHud = config.GetBindable(OsuSetting.ShowInterface); showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); @@ -82,14 +76,18 @@ namespace osu.Game.Screens.Play Text = @"The score overlay is currently disabled. You can toggle this by pressing Shift+Tab." }); } - } - public virtual void BindProcessor(ScoreProcessor processor) - { - ScoreCounter?.Current.BindTo(processor.TotalScore); - AccuracyCounter?.Current.BindTo(processor.Accuracy); - ComboCounter?.Current.BindTo(processor.Combo); - HealthDisplay?.Current.BindTo(processor.Health); + // todo: the stuff below should probably not be in this base implementation, but in each individual class. + ComboCounter.AccentColour = colours.BlueLighter; + AccuracyCounter.AccentColour = colours.BlueLighter; + ScoreCounter.AccentColour = colours.BlueLighter; + + var shd = HealthDisplay as StandardHealthDisplay; + if (shd != null) + { + shd.AccentColour = colours.BlueLighter; + shd.GlowColour = colours.BlueDarker; + } } public virtual void BindHitRenderer(HitRenderer hitRenderer) @@ -122,5 +120,82 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } + + protected virtual RollingCounter CreateAccuracyCounter() => new PercentageCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopRight, + Position = new Vector2(0, 35), + TextSize = 20, + Margin = new MarginPadding { Right = 140 }, + }; + + protected virtual RollingCounter CreateComboCounter() => new SimpleComboCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft, + Position = new Vector2(0, 35), + Margin = new MarginPadding { Left = 140 }, + TextSize = 20, + }; + + protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay + { + Size = new Vector2(1, 5), + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = 20 } + }; + + protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + { + IsCounting = true, + FadeTime = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding(10), + Y = -TwoLayerButton.SIZE_RETRACTED.Y, + }; + + protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 40, + Position = new Vector2(0, 30), + }; + + protected virtual SongProgress CreateProgress() => new SongProgress + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + + protected virtual ModDisplay CreateModsContainer() => new ModDisplay + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Top = 20, Right = 10 }, + }; + + //protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay + //{ + // Anchor = Anchor.TopRight, + // Origin = Anchor.TopRight, + // Margin = new MarginPadding { Top = 100, Right = 10 }, + //}; + + public virtual void BindProcessor(ScoreProcessor processor) + { + ScoreCounter?.Current.BindTo(processor.TotalScore); + AccuracyCounter?.Current.BindTo(processor.Accuracy); + ComboCounter?.Current.BindTo(processor.Combo); + HealthDisplay?.Current.BindTo(processor.Health); + + var shd = HealthDisplay as StandardHealthDisplay; + if (shd != null) + processor.NewJudgement += shd.Flash; + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 707d026e2b..d4b8445ed9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play HitRenderer, } }, - hudOverlay = new StandardHUDOverlay + hudOverlay = new HUDOverlay { Anchor = Anchor.Centre, Origin = Anchor.Centre diff --git a/osu.Game/Screens/Play/StandardHUDOverlay.cs b/osu.Game/Screens/Play/StandardHUDOverlay.cs deleted file mode 100644 index 50add4a19b..0000000000 --- a/osu.Game/Screens/Play/StandardHUDOverlay.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Scoring; -using osu.Game.Screens.Play.HUD; -using OpenTK; - -namespace osu.Game.Screens.Play -{ - public class StandardHUDOverlay : HUDOverlay - { - protected override RollingCounter CreateAccuracyCounter() => new PercentageCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopRight, - Position = new Vector2(0, 35), - TextSize = 20, - Margin = new MarginPadding { Right = 140 }, - }; - - protected override RollingCounter CreateComboCounter() => new SimpleComboCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopLeft, - Position = new Vector2(0, 35), - Margin = new MarginPadding { Left = 140 }, - TextSize = 20, - }; - - protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay - { - Size = new Vector2(1, 5), - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = 20 } - }; - - protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection - { - IsCounting = true, - FadeTime = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding(10), - Y = -TwoLayerButton.SIZE_RETRACTED.Y, - }; - - protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 40, - Position = new Vector2(0, 30), - }; - - protected override SongProgress CreateProgress() => new SongProgress - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - }; - - protected override ModDisplay CreateModsContainer() => new ModDisplay - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = 20, Right = 10 }, - }; - - //protected override ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay - //{ - // Anchor = Anchor.TopRight, - // Origin = Anchor.TopRight, - // Margin = new MarginPadding { Top = 100, Right = 10 }, - //}; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - ComboCounter.AccentColour = colours.BlueLighter; - AccuracyCounter.AccentColour = colours.BlueLighter; - ScoreCounter.AccentColour = colours.BlueLighter; - - var shd = HealthDisplay as StandardHealthDisplay; - if (shd != null) - { - shd.AccentColour = colours.BlueLighter; - shd.GlowColour = colours.BlueDarker; - } - } - - public override void BindProcessor(ScoreProcessor processor) - { - base.BindProcessor(processor); - - var shd = HealthDisplay as StandardHealthDisplay; - if (shd != null) - processor.NewJudgement += shd.Flash; - } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25504f44d7..e6dd7ba1c4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -253,7 +253,6 @@ - From fac16bdebd3c4bfc01afc1a03a60775807420da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 5 Jun 2017 18:07:28 +0200 Subject: [PATCH 25/36] Do not release focus of the chat text box when sending a message --- osu-framework | 2 +- osu.Game/Overlays/ChatOverlay.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 925bbe42ba..4e82d99cbe 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 925bbe42bab95078b9d33189205b5b1b76bf8e01 +Subproject commit 4e82d99cbe1c9e60ca99beff91c7dbe84fee7897 diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 2e6f143e74..c32199f881 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -134,6 +134,7 @@ namespace osu.Game.Overlays PlaceholderText = "type your message", Exit = () => State = Visibility.Hidden, OnCommit = postMessage, + ReleaseFocusOnCommit = false, HoldFocus = true, } } From 141c53c50624fbf830dff0e4c5ab71eb8760f96d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Jun 2017 13:54:16 +0900 Subject: [PATCH 26/36] Update resource again (fixes filesize increase) --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index a5199500cc..b348c1e540 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit a5199500cc3ba96101fd858e0f78f36e538697b1 +Subproject commit b348c1e540edbb3325a8da9bca452c9dce2938d6 From e7271951872a0bb5d005c0fe6510e46ae3863e7f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Jun 2017 22:06:43 +0900 Subject: [PATCH 27/36] Treat inspectcode warnings as errors (CI) There are many instances we accidentally merge pull requests with outstanding warnings, as the fact warnings exists is not made obvious. This forces all `inspectcode` warnings to an error level. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cc6dfb9c88..b26a895788 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,4 +20,4 @@ build: verbosity: minimal after_build: - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln - - cmd: NVika parsereport "inspectcodereport.xml" \ No newline at end of file + - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file From 5f537780cf061019ee650cadadf4fde66667164b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 15:32:50 +0900 Subject: [PATCH 28/36] Bring framework up-to-date --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs | 4 ++-- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs | 2 +- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 4 ++-- osu.Game/Overlays/Music/PlaylistItem.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu-framework b/osu-framework index 4e82d99cbe..3ad1dd52ae 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4e82d99cbe1c9e60ca99beff91c7dbe84fee7897 +Subproject commit 3ad1dd52ae511b816fb928f70ef811ec605c5c18 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs index 3113b63db1..c66b0b4db4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests { Name = "Timing section", RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, 10000), + RelativeChildSize = new Vector2(1, 10000), Children = new[] { new DrawableNote(new Note { StartTime = 5000 }) { AccentColour = Color4.Red }, @@ -62,7 +62,7 @@ namespace osu.Desktop.VisualTests.Tests { Name = "Timing section", RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, 10000), + RelativeChildSize = new Vector2(1, 10000), Children = new[] { new DrawableHoldNote(new HoldNote diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 5d7f3314cd..1d751b0293 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables tickContainer = new Container { RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration) + RelativeChildSize = new Vector2(1, (float)HitObject.Duration) }, head = new DrawableHeadNote(this, key) { diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index 0a8bc2d44a..2619ce150c 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.Timing // Adjust our height to account for the speed changes Height = (float)(1000 / timingChange.BeatLength / timingChange.SpeedMultiplier); - RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan); + RelativeChildSize = new Vector2(1, (float)parent.TimeSpan); // Scroll the content content.Y = (float)(timingChange.Time - Time.Current); @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Mania.Timing float height = Children.Select(child => child.Y + child.Height).Max(); Height = height; - RelativeCoordinateSpace = new Vector2(1, height); + RelativeChildSize = new Vector2(1, height); base.InvalidateFromChild(invalidation); } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 0618f96cac..789e45adfc 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Music private Color4 artistColour; private TextAwesome handle; - private Paragraph text; + private TextFlowContainer text; private IEnumerable titleSprites; private UnicodeBindableString titleBind; private UnicodeBindableString artistBind; @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Music Margin = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Top = 2 }, }, - text = new Paragraph + text = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From 6a12173175ffc00ae67059aa54e286180fd36055 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:05:43 +0900 Subject: [PATCH 29/36] Add very temporary data source for social browser --- .../Online/API/Requests/GetUsersRequest.cs | 24 +++++++++ osu.Game/Overlays/SocialOverlay.cs | 51 ++++++++++++++++--- osu.Game/osu.Game.csproj | 1 + 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetUsersRequest.cs diff --git a/osu.Game/Online/API/Requests/GetUsersRequest.cs b/osu.Game/Online/API/Requests/GetUsersRequest.cs new file mode 100644 index 0000000000..96d0bccb2d --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUsersRequest.cs @@ -0,0 +1,24 @@ +// 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 Newtonsoft.Json; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class GetUsersRequest : APIRequest> + { + public GetUsersRequest() + { + } + + protected override string Target => $@"rankings/osu/performance"; + } + + public class RankingEntry + { + [JsonProperty] + public User User; + } +} diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 448539607d..b0602a3c67 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -3,18 +3,21 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework.Allocation; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; namespace osu.Game.Overlays { - public class SocialOverlay : SearchableListOverlay + public class SocialOverlay : SearchableListOverlay, IOnlineComponent { private readonly FillFlowContainer panelFlow; @@ -34,12 +37,17 @@ namespace osu.Game.Overlays if (users?.Equals(value) ?? false) return; users = value; - panelFlow.Children = users.Select(u => + if (users == null) + panelFlow.Clear(); + else { - var p = new UserPanel(u) { Width = 300 }; - p.Status.BindTo(u.Status); - return p; - }); + panelFlow.Children = users.Select(u => + { + var p = new UserPanel(u) { Width = 300 }; + p.Status.BindTo(u.Status); + return p; + }); + } } } @@ -61,11 +69,40 @@ namespace osu.Game.Overlays }, }; } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + reloadUsers(api); + } + + private void reloadUsers(APIAccess api) + { + Users = null; + + // no this is not the correct data source, but it's something. + var request = new GetUsersRequest(); + request.Success += res => Users = res.Select(e => e.User); + api.Queue(request); + } + + public void APIStateChanged(APIAccess api, APIState state) + { + switch (state) + { + case APIState.Online: + reloadUsers(api); + break; + default: + Users = null; + break; + } + } } public enum SortDirection { - Ascending, Descending, + Ascending, } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 20aa765502..f7412ade5b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,6 +76,7 @@ + From fc2d9816dfe6311810181be8e7809c518d2443de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:06:02 +0900 Subject: [PATCH 30/36] Make SearchableListHeader icon customisable --- osu.Game/Overlays/Direct/Header.cs | 1 + .../SearchableList/SearchableListHeader.cs | 5 +++-- osu.Game/Overlays/Social/FilterControl.cs | 14 ++++++-------- osu.Game/Overlays/Social/Header.cs | 13 +++++++------ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index e5b7c7f149..000ef473cc 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -17,6 +17,7 @@ namespace osu.Game.Overlays.Direct protected override DirectTab DefaultTab => DirectTab.Search; protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", TextSize = 25 }; + protected override FontAwesome Icon => FontAwesome.fa_osu_chevron_down_o; public Header() { diff --git a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs index b65e031488..26dc9b03c8 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListHeader.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListHeader.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.SearchableList protected abstract float TabStripWidth { get; } //can be removed once (if?) TabControl support auto sizing protected abstract T DefaultTab { get; } protected abstract Drawable CreateHeaderText(); + protected abstract FontAwesome Icon { get; } protected SearchableListHeader() { @@ -41,7 +42,7 @@ namespace osu.Game.Overlays.SearchableList new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING },  + Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING }, Children = new Drawable[] { new FillFlowContainer @@ -57,7 +58,7 @@ namespace osu.Game.Overlays.SearchableList new TextAwesome { TextSize = 25, - Icon = FontAwesome.fa_osu_chevron_down_o, + Icon = Icon, }, CreateHeaderText(), }, diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs index 789c7b6a64..cf4097643e 100644 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ b/osu.Game/Overlays/Social/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.Graphics; using osu.Framework.Graphics; using osu.Game.Graphics; @@ -12,7 +11,7 @@ namespace osu.Game.Overlays.Social public class FilterControl : SearchableListFilterControl { protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a"); - protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name; + protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Rank; public FilterControl() { @@ -22,12 +21,11 @@ namespace osu.Game.Overlays.Social public enum SocialSortCriteria { - Name, Rank, - Location, - [Description("Time Zone")] - TimeZone, - [Description("World Map")] - WorldMap, + //Location, + //[Description("Time Zone")] + //TimeZone, + //[Description("World Map")] + //WorldMap, } } diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index bad0e73327..2674854327 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -19,6 +19,7 @@ namespace osu.Game.Overlays.Social protected override Color4 BackgroundColour => OsuColour.FromHex(@"38202e"); protected override float TabStripWidth => 438; protected override SocialTab DefaultTab => SocialTab.OnlinePlayers; + protected override FontAwesome Icon => FontAwesome.fa_users; protected override Drawable CreateHeaderText() { @@ -54,11 +55,11 @@ namespace osu.Game.Overlays.Social { [Description("Online Players")] OnlinePlayers, - [Description("Online Friends")] - OnlineFriends, - [Description("Online Team Members")] - OnlineTeamMembers, - [Description("Chat Channels")] - ChatChannels, + //[Description("Online Friends")] + //OnlineFriends, + //[Description("Online Team Members")] + //OnlineTeamMembers, + //[Description("Chat Channels")] + //ChatChannels, } } From 97db4856fca37cb60fedfa41fc53ca54274b21bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:15:58 +0900 Subject: [PATCH 31/36] Add toolbar toggle button Also ensure chat is hidden when social is displayed and vice-versa. --- osu.Game/OsuGame.cs | 5 +++++ osu.Game/Overlays/Toolbar/Toolbar.cs | 1 + .../Overlays/Toolbar/ToolbarSocialButton.cs | 22 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 29 insertions(+) create mode 100644 osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ea22d9e97d..ed244a7b48 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -201,11 +201,16 @@ namespace osu.Game }; Dependencies.Cache(settings); + Dependencies.Cache(social); Dependencies.Cache(chat); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); + // ensure both overlays aren't presented at the same time + chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State; + social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State; + LoadComponentAsync(Toolbar = new Toolbar { Depth = -3, diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 43c3cd32f2..158992fef8 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -63,6 +63,7 @@ namespace osu.Game.Overlays.Toolbar AutoSizeAxes = Axes.X, Children = new Drawable[] { + new ToolbarSocialButton(), new ToolbarChatButton(), new ToolbarMusicButton(), new ToolbarButton diff --git a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs new file mode 100644 index 0000000000..ed36fd8f9e --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Toolbar +{ + internal class ToolbarSocialButton : ToolbarOverlayToggleButton + { + public ToolbarSocialButton() + { + Icon = FontAwesome.fa_users; + } + + [BackgroundDependencyLoader] + private void load(SocialOverlay chat) + { + StateContainer = chat; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f7412ade5b..1ebbb4adf3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -89,6 +89,7 @@ + From 94c961ddb8db98551000d5252418055e9ac81c23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:16:34 +0900 Subject: [PATCH 32/36] CI Fixes --- osu.Game/Online/API/Requests/GetUsersRequest.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUsersRequest.cs b/osu.Game/Online/API/Requests/GetUsersRequest.cs index 96d0bccb2d..5fb8606e1e 100644 --- a/osu.Game/Online/API/Requests/GetUsersRequest.cs +++ b/osu.Game/Online/API/Requests/GetUsersRequest.cs @@ -9,11 +9,7 @@ namespace osu.Game.Online.API.Requests { public class GetUsersRequest : APIRequest> { - public GetUsersRequest() - { - } - - protected override string Target => $@"rankings/osu/performance"; + protected override string Target => @"rankings/osu/performance"; } public class RankingEntry From 8d434e88ee82ea6446a2fa5eabc9607e395d5899 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:20:22 +0900 Subject: [PATCH 33/36] Fix VisualTest not using placeholder data --- osu.Game/Overlays/SocialOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index b0602a3c67..97c27a9ea9 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -73,7 +73,8 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(APIAccess api) { - reloadUsers(api); + if (Users == null) + reloadUsers(api); } private void reloadUsers(APIAccess api) From 59bed2b16ee6f963dd8c8b4684cbabcf704836d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 20:44:54 +0900 Subject: [PATCH 34/36] Add missing spaces --- .../Overlays/SearchableList/SearchableListFilterControl.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 95651833d3..dfc2dbe49a 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -14,7 +14,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.SearchableList { - public abstract class SearchableListFilterControl : Container + public abstract class SearchableListFilterControl : Container { private const float padding = 10; diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 7705fa0582..5b24da1dbe 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -15,19 +15,19 @@ namespace osu.Game.Overlays.SearchableList public static readonly float WIDTH_PADDING = 80; } - public abstract class SearchableListOverlay : SearchableListOverlay + public abstract class SearchableListOverlay : SearchableListOverlay { private readonly Container scrollContainer; protected readonly SearchableListHeader Header; - protected readonly SearchableListFilterControl Filter; + protected readonly SearchableListFilterControl Filter; protected readonly FillFlowContainer ScrollFlow; protected abstract Color4 BackgroundColour { get; } protected abstract Color4 TrianglesColourLight { get; } protected abstract Color4 TrianglesColourDark { get; } protected abstract SearchableListHeader CreateHeader(); - protected abstract SearchableListFilterControl CreateFilterControl(); + protected abstract SearchableListFilterControl CreateFilterControl(); protected SearchableListOverlay() { From e51b4bc4ee8f5d180e5ae1ef1ca8525e2e62a47e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 7 Jun 2017 21:16:41 +0900 Subject: [PATCH 35/36] Fix resources getting rolled back --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 9f46a456dc..b348c1e540 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 9f46a456dc3a56dcbff09671a3f588b16a464106 +Subproject commit b348c1e540edbb3325a8da9bca452c9dce2938d6 From 0b204bd157140c5c57f4d274667a97b6fb9d7bca Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 10:11:10 -0300 Subject: [PATCH 36/36] Add padding to the bottom of SearchableListOverlay's ScrollFlow --- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 5b24da1dbe..093750bcc0 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.SearchableList { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = WIDTH_PADDING }, + Padding = new MarginPadding { Horizontal = WIDTH_PADDING, Bottom = 50 }, Direction = FillDirection.Vertical, }, },