diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index 898e461bde..bc0ae3d264 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Rankings; using osu.Game.Rulesets; @@ -37,20 +38,20 @@ public TestSceneRankingsHeader() Ruleset = { BindTarget = ruleset }, Spotlights = new[] { - new Spotlight + new APISpotlight { Id = 1, - Text = "Spotlight 1" + Name = "Spotlight 1" }, - new Spotlight + new APISpotlight { Id = 2, - Text = "Spotlight 2" + Name = "Spotlight 2" }, - new Spotlight + new APISpotlight { Id = 3, - Text = "Spotlight 3" + Name = "Spotlight 3" } } }); diff --git a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs index 94afe4e5a5..41722034b6 100644 --- a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs +++ b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs @@ -8,21 +8,20 @@ using osu.Game.Users; using System.Collections.Generic; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Allocation; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Rankings { public class RankingsOverlayHeader : TabControlOverlayHeader { public readonly Bindable Ruleset = new Bindable(); - public readonly Bindable Spotlight = new Bindable(); + public readonly Bindable Spotlight = new Bindable(); public readonly Bindable Country = new Bindable(); - public IEnumerable Spotlights + public IEnumerable Spotlights { - get => spotlightsContainer.Spotlights; - set => spotlightsContainer.Spotlights = value; + get => spotlightSelector.Spotlights; + set => spotlightSelector.Spotlights = value; } protected override ScreenTitle CreateTitle() => new RankingsTitle @@ -35,7 +34,7 @@ public IEnumerable Spotlights Current = Ruleset }; - private SpotlightsContainer spotlightsContainer; + private SpotlightSelector spotlightSelector; protected override Drawable CreateContent() => new FillFlowContainer { @@ -48,9 +47,9 @@ public IEnumerable Spotlights { Current = Country }, - spotlightsContainer = new SpotlightsContainer + spotlightSelector = new SpotlightSelector { - Spotlight = { BindTarget = Spotlight } + Current = { BindTarget = Spotlight } } } }; @@ -62,7 +61,7 @@ protected override void LoadComplete() } private void onCurrentChanged(ValueChangedEvent scope) => - spotlightsContainer.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); + spotlightSelector.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); private class RankingsTitle : ScreenTitle { @@ -81,48 +80,6 @@ protected override void LoadComplete() protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/rankings"); } - - private class SpotlightsContainer : CompositeDrawable - { - public readonly Bindable Spotlight = new Bindable(); - - public IEnumerable Spotlights - { - get => dropdown.Items; - set => dropdown.Items = value; - } - - private readonly OsuDropdown dropdown; - private readonly Box background; - - public SpotlightsContainer() - { - Height = 100; - RelativeSizeAxes = Axes.X; - InternalChildren = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - dropdown = new OsuDropdown - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Width = 0.8f, - Current = Spotlight, - Y = 20, - } - }; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - background.Colour = colourProvider.Dark3; - } - } } public enum RankingsScope diff --git a/osu.Game/Overlays/Rankings/Spotlight.cs b/osu.Game/Overlays/Rankings/Spotlight.cs deleted file mode 100644 index e956b4f449..0000000000 --- a/osu.Game/Overlays/Rankings/Spotlight.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using Newtonsoft.Json; - -namespace osu.Game.Overlays.Rankings -{ - public class Spotlight - { - [JsonProperty("id")] - public int Id; - - [JsonProperty("text")] - public string Text; - - public override string ToString() => Text; - } -}