From 4490596f5f171f987b0b8a88a8c1f4a93adf5b73 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 24 May 2017 02:37:27 -0300 Subject: [PATCH] Keep one object per file --- .../Tests/TestCaseDirect.cs | 2 +- osu.Game/Database/RankStatus.cs | 23 ++++++++ osu.Game/Overlays/Direct/FilterControl.cs | 55 +++---------------- osu.Game/Overlays/DirectOverlay.cs | 36 +++++++++--- osu.Game/osu.Game.csproj | 1 + 5 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 osu.Game/Database/RankStatus.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index c1f2307f20..4ddf361087 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -25,7 +25,7 @@ namespace osu.Desktop.VisualTests.Tests newBeatmaps(); AddStep(@"toggle", direct.ToggleVisibility); - AddStep(@"result counts", () => direct.ResultCounts = new ResultCounts(1, 4, 13)); + AddStep(@"result counts", () => direct.ResultAmounts = new DirectOverlay.ResultCounts(1, 4, 13)); } [BackgroundDependencyLoader] diff --git a/osu.Game/Database/RankStatus.cs b/osu.Game/Database/RankStatus.cs new file mode 100644 index 0000000000..b333292a07 --- /dev/null +++ b/osu.Game/Database/RankStatus.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; + +namespace osu.Game.Database +{ + public enum RankStatus + { + Any = 7, + [Description("Ranked & Approved")] + RankedApproved = 0, + Approved = 1, + Loved = 8, + Favourites = 2, + [Description("Mod Requests")] + ModRequests = 3, + Pending = 4, + Graveyard = 5, + [Description("My Maps")] + MyMaps = 6, + } +} diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 031ca997b8..735e14b8c1 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -14,8 +13,6 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using Container = osu.Framework.Graphics.Containers.Container; - namespace osu.Game.Overlays.Direct { public class FilterControl : Container @@ -30,7 +27,7 @@ namespace osu.Game.Overlays.Direct public readonly SearchTextBox Search; public readonly SortTabControl SortTabs; public readonly OsuEnumDropdown RankStatusDropdown; - public readonly Bindable DisplayStyle = new Bindable(); + public readonly Bindable DisplayStyle = new Bindable(); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos); @@ -38,7 +35,7 @@ namespace osu.Game.Overlays.Direct { RelativeSizeAxes = Axes.X; Height = HEIGHT; - DisplayStyle.Value = PanelDisplayStyle.Grid; + DisplayStyle.Value = DirectOverlay.PanelDisplayStyle.Grid; Children = new Drawable[] { @@ -96,8 +93,8 @@ namespace osu.Game.Overlays.Direct Direction = FillDirection.Horizontal, Children = new[] { - new DisplayStyleToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle), - new DisplayStyleToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.fa_th_large, DirectOverlay.PanelDisplayStyle.Grid, DisplayStyle), + new DisplayStyleToggleButton(FontAwesome.fa_list_ul, DirectOverlay.PanelDisplayStyle.List, DisplayStyle), }, }, RankStatusDropdown = new SlimEnumDropdown @@ -195,10 +192,10 @@ namespace osu.Game.Overlays.Direct private class DisplayStyleToggleButton : ClickableContainer { private readonly TextAwesome icon; - private readonly PanelDisplayStyle style; - private readonly Bindable bindable; + private readonly DirectOverlay.PanelDisplayStyle style; + private readonly Bindable bindable; - public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable bindable) + public DisplayStyleToggleButton(FontAwesome icon, DirectOverlay.PanelDisplayStyle style, Bindable bindable) { this.bindable = bindable; this.style = style; @@ -222,7 +219,7 @@ namespace osu.Game.Overlays.Direct Action = () => bindable.Value = this.style; } - private void Bindable_ValueChanged(PanelDisplayStyle style) + private void Bindable_ValueChanged(DirectOverlay.PanelDisplayStyle style) { icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); } @@ -233,40 +230,4 @@ namespace osu.Game.Overlays.Direct } } } - - public class ResultCounts - { - public readonly int Artists; - public readonly int Songs; - public readonly int Tags; - - public ResultCounts(int artists, int songs, int tags) - { - Artists = artists; - Songs = songs; - Tags = tags; - } - } - - public enum RankStatus - { - Any, - [Description("Ranked & Approved")] - RankedApproved, - Approved, - Loved, - Favourites, - [Description("Mod Requests")] - ModRequests, - Pending, - Graveyard, - [Description("My Maps")] - MyMaps, - } - - public enum PanelDisplayStyle - { - Grid, - List, - } } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 5485ea3c15..c1a0e1db79 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -15,6 +15,8 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Direct; +using Container = osu.Framework.Graphics.Containers.Container; + namespace osu.Game.Overlays { public class DirectOverlay : WaveOverlayContainer @@ -41,12 +43,12 @@ namespace osu.Game.Overlays } private ResultCounts resultCounts; - public ResultCounts ResultCounts + public ResultCounts ResultAmounts { get { return resultCounts; } set { - if (value == ResultCounts) return; + if (value == ResultAmounts) return; resultCounts = value; updateResultCounts(); @@ -166,12 +168,12 @@ namespace osu.Game.Overlays private void updateResultCounts() { - resultCountsContainer.FadeTo(ResultCounts == null ? 0f : 1f, 200, EasingTypes.Out); - if (ResultCounts == null) return; + resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out); + if (ResultAmounts == null) return; - resultCountsText.Text = pluralize("Artist", ResultCounts.Artists) + ", " + - pluralize("Song", ResultCounts.Songs) + ", " + - pluralize("Tag", ResultCounts.Tags); + resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + + pluralize("Song", ResultAmounts.Songs) + ", " + + pluralize("Tag", ResultAmounts.Tags); } private string pluralize(string prefix, int value) @@ -204,5 +206,25 @@ namespace osu.Game.Overlays filter.Search.HoldFocus = false; } + + public class ResultCounts + { + public readonly int Artists; + public readonly int Songs; + public readonly int Tags; + + public ResultCounts(int artists, int songs, int tags) + { + Artists = artists; + Songs = songs; + Tags = tags; + } + } + + public enum PanelDisplayStyle + { + Grid, + List, + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1fb2658679..f6779c2701 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -439,6 +439,7 @@ +