diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs index 7ac65181f9..79862deb16 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsCountryFilter.cs @@ -11,6 +11,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osu.Framework.Allocation; namespace osu.Game.Tests.Visual.Online { @@ -22,6 +24,9 @@ namespace osu.Game.Tests.Visual.Online typeof(CountryPill) }; + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + public TestSceneRankingsCountryFilter() { var countryBindable = new Bindable(); diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsDismissableFlag.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsDismissableFlag.cs deleted file mode 100644 index cd954cd6bd..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsDismissableFlag.cs +++ /dev/null @@ -1,66 +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 System; -using System.Collections.Generic; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Rankings; -using osu.Game.Users; -using osuTK; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneRankingsDismissableFlag : OsuTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(DismissableFlag), - }; - - public TestSceneRankingsDismissableFlag() - { - DismissableFlag flag; - SpriteText text; - - var countryA = new Country - { - FlagName = "BY", - FullName = "Belarus" - }; - - var countryB = new Country - { - FlagName = "US", - FullName = "United States" - }; - - AddRange(new Drawable[] - { - flag = new DismissableFlag - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(30, 20), - Country = countryA, - }, - text = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Invoked", - Font = OsuFont.GetFont(size: 30), - Alpha = 0, - } - }); - - flag.Action += () => text.FadeIn().Then().FadeOut(1000, Easing.OutQuint); - - AddStep("Trigger click", () => flag.Click()); - AddStep("Change to country 2", () => flag.Country = countryB); - AddStep("Change to country 1", () => flag.Country = countryA); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs index e708934bc3..898e461bde 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs @@ -3,8 +3,9 @@ using System; using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Graphics; +using osu.Game.Overlays; using osu.Game.Overlays.Rankings; using osu.Game.Rulesets; using osu.Game.Users; @@ -15,24 +16,23 @@ namespace osu.Game.Tests.Visual.Online { public override IReadOnlyList RequiredTypes => new[] { - typeof(DismissableFlag), - typeof(HeaderTitle), - typeof(RankingsRulesetSelector), - typeof(RankingsScopeSelector), - typeof(RankingsHeader), + typeof(RankingsOverlayHeader), + typeof(CountryFilter), + typeof(CountryPill) }; + [Cached] + private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green); + public TestSceneRankingsHeader() { var countryBindable = new Bindable(); var ruleset = new Bindable(); var scope = new Bindable(); - Add(new RankingsHeader + Add(new RankingsOverlayHeader { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scope = { BindTarget = scope }, + Current = { BindTarget = scope }, Country = { BindTarget = countryBindable }, Ruleset = { BindTarget = ruleset }, Spotlights = new[] diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeaderTitle.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsHeaderTitle.cs deleted file mode 100644 index 0edf104da0..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsHeaderTitle.cs +++ /dev/null @@ -1,55 +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 System; -using System.Collections.Generic; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Game.Overlays.Rankings; -using osu.Game.Users; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneRankingsHeaderTitle : OsuTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(DismissableFlag), - typeof(HeaderTitle), - }; - - public TestSceneRankingsHeaderTitle() - { - var countryBindable = new Bindable(); - var scope = new Bindable(); - - Add(new HeaderTitle - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Country = { BindTarget = countryBindable }, - Scope = { BindTarget = scope }, - }); - - var countryA = new Country - { - FlagName = "BY", - FullName = "Belarus" - }; - - var countryB = new Country - { - FlagName = "US", - FullName = "United States" - }; - - AddStep("Set country 1", () => countryBindable.Value = countryA); - AddStep("Set country 2", () => countryBindable.Value = countryB); - AddStep("Set null country", () => countryBindable.Value = null); - AddStep("Set scope to Performance", () => scope.Value = RankingsScope.Performance); - AddStep("Set scope to Spotlights", () => scope.Value = RankingsScope.Spotlights); - AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); - AddStep("Set scope to Country", () => scope.Value = RankingsScope.Country); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs index 568e36df4c..a769ebe4a9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs @@ -25,7 +25,8 @@ namespace osu.Game.Tests.Visual.Online typeof(TableRowBackground), typeof(UserBasedTable), typeof(RankingsTable<>), - typeof(RankingsOverlay) + typeof(RankingsOverlay), + typeof(RankingsOverlayHeader) }; [Cached] diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsRulesetSelector.cs deleted file mode 100644 index 84515bd3a4..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsRulesetSelector.cs +++ /dev/null @@ -1,41 +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 System; -using System.Collections.Generic; -using osu.Game.Overlays.Rankings; -using osu.Framework.Graphics; -using osu.Game.Rulesets; -using osu.Framework.Bindables; -using osu.Game.Rulesets.Osu; -using osu.Game.Rulesets.Mania; -using osu.Game.Rulesets.Taiko; -using osu.Game.Rulesets.Catch; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneRankingsRulesetSelector : OsuTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(RankingsRulesetSelector), - }; - - public TestSceneRankingsRulesetSelector() - { - var current = new Bindable(); - - Add(new RankingsRulesetSelector - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Current = { BindTarget = current } - }); - - AddStep("Select osu!", () => current.Value = new OsuRuleset().RulesetInfo); - AddStep("Select mania", () => current.Value = new ManiaRuleset().RulesetInfo); - AddStep("Select taiko", () => current.Value = new TaikoRuleset().RulesetInfo); - AddStep("Select catch", () => current.Value = new CatchRuleset().RulesetInfo); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsScopeSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsScopeSelector.cs deleted file mode 100644 index 3693d6b5b4..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsScopeSelector.cs +++ /dev/null @@ -1,54 +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 System; -using System.Collections.Generic; -using osu.Framework.Graphics; -using osu.Framework.Bindables; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Allocation; -using osu.Game.Graphics; -using osu.Game.Overlays.Rankings; - -namespace osu.Game.Tests.Visual.Online -{ - public class TestSceneRankingsScopeSelector : OsuTestScene - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(RankingsScopeSelector), - }; - - private readonly Box background; - - public TestSceneRankingsScopeSelector() - { - var scope = new Bindable(); - - AddRange(new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both - }, - new RankingsScopeSelector - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Current = scope, - } - }); - - AddStep(@"Select country", () => scope.Value = RankingsScope.Country); - AddStep(@"Select performance", () => scope.Value = RankingsScope.Performance); - AddStep(@"Select score", () => scope.Value = RankingsScope.Score); - AddStep(@"Select spotlights", () => scope.Value = RankingsScope.Spotlights); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - background.Colour = colours.GreySeafoam; - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index 93da2a439e..ab174f303e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -16,6 +16,7 @@ using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Catch; using osu.Framework.Allocation; +using osu.Game.Overlays; namespace osu.Game.Tests.Visual.Online { @@ -36,6 +37,9 @@ namespace osu.Game.Tests.Visual.Online [Resolved] private IAPIProvider api { get; set; } + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + private readonly BasicScrollContainer scrollFlow; private readonly DimmedLoadingLayer loading; private CancellationTokenSource cancellationToken; diff --git a/osu.Game/Overlays/Rankings/CountryFilter.cs b/osu.Game/Overlays/Rankings/CountryFilter.cs index 2b12457ccc..4bdefb06ef 100644 --- a/osu.Game/Overlays/Rankings/CountryFilter.cs +++ b/osu.Game/Overlays/Rankings/CountryFilter.cs @@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Rankings } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - background.Colour = colours.GreySeafoam; + background.Colour = colourProvider.Dark3; } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 410d316006..1b19bbd95e 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -100,9 +100,9 @@ namespace osu.Game.Overlays.Rankings } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - background.Colour = colours.GreySeafoamDarker; + background.Colour = colourProvider.Background5; } protected override void LoadComplete() @@ -154,9 +154,9 @@ namespace osu.Game.Overlays.Rankings } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - IdleColour = colours.GreySeafoamLighter; + IdleColour = colourProvider.Light2; HoverColour = Color4.White; } } diff --git a/osu.Game/Overlays/Rankings/DismissableFlag.cs b/osu.Game/Overlays/Rankings/DismissableFlag.cs deleted file mode 100644 index 7a55b0bba6..0000000000 --- a/osu.Game/Overlays/Rankings/DismissableFlag.cs +++ /dev/null @@ -1,55 +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 osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Game.Users.Drawables; -using osuTK.Graphics; -using osuTK; -using osu.Framework.Input.Events; -using System; - -namespace osu.Game.Overlays.Rankings -{ - public class DismissableFlag : UpdateableFlag - { - private const int duration = 200; - - public Action Action; - - private readonly SpriteIcon hoverIcon; - - public DismissableFlag() - { - AddInternal(hoverIcon = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Depth = -1, - Alpha = 0, - Size = new Vector2(10), - Icon = FontAwesome.Solid.Times, - }); - } - - protected override bool OnHover(HoverEvent e) - { - hoverIcon.FadeIn(duration, Easing.OutQuint); - this.FadeColour(Color4.Gray, duration, Easing.OutQuint); - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - base.OnHoverLost(e); - hoverIcon.FadeOut(duration, Easing.OutQuint); - this.FadeColour(Color4.White, duration, Easing.OutQuint); - } - - protected override bool OnClick(ClickEvent e) - { - Action?.Invoke(); - return true; - } - } -} diff --git a/osu.Game/Overlays/Rankings/HeaderTitle.cs b/osu.Game/Overlays/Rankings/HeaderTitle.cs deleted file mode 100644 index b08a2a3900..0000000000 --- a/osu.Game/Overlays/Rankings/HeaderTitle.cs +++ /dev/null @@ -1,91 +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 osu.Framework.Bindables; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Users; -using osu.Framework.Graphics; -using osuTK; -using osu.Game.Graphics; -using osu.Framework.Allocation; -using osu.Game.Graphics.Sprites; - -namespace osu.Game.Overlays.Rankings -{ - public class HeaderTitle : CompositeDrawable - { - private const int spacing = 10; - private const int flag_margin = 5; - private const int text_size = 40; - - public readonly Bindable Scope = new Bindable(); - public readonly Bindable Country = new Bindable(); - - private readonly SpriteText scopeText; - private readonly DismissableFlag flag; - - public HeaderTitle() - { - AutoSizeAxes = Axes.Both; - InternalChild = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(spacing, 0), - Children = new Drawable[] - { - flag = new DismissableFlag - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Margin = new MarginPadding { Bottom = flag_margin }, - Size = new Vector2(30, 20), - }, - scopeText = new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light) - }, - new OsuSpriteText - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light), - Text = @"Ranking" - } - } - }; - - flag.Action += () => Country.Value = null; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - scopeText.Colour = colours.Lime; - } - - protected override void LoadComplete() - { - Scope.BindValueChanged(onScopeChanged, true); - Country.BindValueChanged(onCountryChanged, true); - base.LoadComplete(); - } - - private void onScopeChanged(ValueChangedEvent scope) => scopeText.Text = scope.NewValue.ToString(); - - private void onCountryChanged(ValueChangedEvent country) - { - if (country.NewValue == null) - { - flag.Hide(); - return; - } - - flag.Country = country.NewValue; - flag.Show(); - } - } -} diff --git a/osu.Game/Overlays/Rankings/RankingsHeader.cs b/osu.Game/Overlays/Rankings/RankingsHeader.cs deleted file mode 100644 index 6aa3e75df9..0000000000 --- a/osu.Game/Overlays/Rankings/RankingsHeader.cs +++ /dev/null @@ -1,129 +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 osu.Framework.Graphics.Containers; -using osu.Framework.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Game.Rulesets; -using osu.Game.Users; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osuTK; -using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; - -namespace osu.Game.Overlays.Rankings -{ - public class RankingsHeader : CompositeDrawable - { - private const int content_height = 250; - - public IEnumerable Spotlights - { - get => dropdown.Items; - set => dropdown.Items = value; - } - - public readonly Bindable Scope = new Bindable(); - public readonly Bindable Ruleset = new Bindable(); - public readonly Bindable Country = new Bindable(); - public readonly Bindable Spotlight = new Bindable(); - - private readonly OsuDropdown dropdown; - - public RankingsHeader() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - AddInternal(new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] - { - new RankingsRulesetSelector - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Current = Ruleset - }, - new Container - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Height = content_height, - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Child = new HeaderBackground(), - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 20), - Children = new Drawable[] - { - new RankingsScopeSelector - { - Margin = new MarginPadding { Top = 10 }, - Current = Scope - }, - new HeaderTitle - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Margin = new MarginPadding { Top = 10 }, - Scope = { BindTarget = Scope }, - Country = { BindTarget = Country }, - }, - dropdown = new OsuDropdown - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Width = 0.8f, - Current = Spotlight, - } - } - }, - } - } - } - }); - } - - protected override void LoadComplete() - { - Scope.BindValueChanged(onScopeChanged, true); - base.LoadComplete(); - } - - private void onScopeChanged(ValueChangedEvent scope) => - dropdown.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); - - private class HeaderBackground : Sprite - { - public HeaderBackground() - { - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - RelativeSizeAxes = Axes.Both; - FillMode = FillMode.Fill; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(@"Headers/rankings"); - } - } - } -} diff --git a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs new file mode 100644 index 0000000000..94afe4e5a5 --- /dev/null +++ b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs @@ -0,0 +1,135 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Bindables; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets; +using osu.Game.Users; +using System.Collections.Generic; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Allocation; + +namespace osu.Game.Overlays.Rankings +{ + public class RankingsOverlayHeader : TabControlOverlayHeader + { + public readonly Bindable Ruleset = new Bindable(); + public readonly Bindable Spotlight = new Bindable(); + public readonly Bindable Country = new Bindable(); + + public IEnumerable Spotlights + { + get => spotlightsContainer.Spotlights; + set => spotlightsContainer.Spotlights = value; + } + + protected override ScreenTitle CreateTitle() => new RankingsTitle + { + Scope = { BindTarget = Current } + }; + + protected override Drawable CreateTitleContent() => new OverlayRulesetSelector + { + Current = Ruleset + }; + + private SpotlightsContainer spotlightsContainer; + + protected override Drawable CreateContent() => new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new CountryFilter + { + Current = Country + }, + spotlightsContainer = new SpotlightsContainer + { + Spotlight = { BindTarget = Spotlight } + } + } + }; + + protected override void LoadComplete() + { + Current.BindValueChanged(onCurrentChanged, true); + base.LoadComplete(); + } + + private void onCurrentChanged(ValueChangedEvent scope) => + spotlightsContainer.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint); + + private class RankingsTitle : ScreenTitle + { + public readonly Bindable Scope = new Bindable(); + + public RankingsTitle() + { + Title = "ranking"; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Scope.BindValueChanged(scope => Section = scope.NewValue.ToString().ToLowerInvariant(), true); + } + + 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 + { + Performance, + Spotlights, + Score, + Country + } +} diff --git a/osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs b/osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs deleted file mode 100644 index 3d25e3995a..0000000000 --- a/osu.Game/Overlays/Rankings/RankingsRulesetSelector.cs +++ /dev/null @@ -1,56 +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 osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets; -using osuTK; -using System.Linq; - -namespace osu.Game.Overlays.Rankings -{ - public class RankingsRulesetSelector : PageTabControl - { - protected override TabItem CreateTabItem(RulesetInfo value) => new RankingsTabItem(value); - - protected override Dropdown CreateDropdown() => null; - - public RankingsRulesetSelector() - { - AutoSizeAxes = Axes.X; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours, RulesetStore rulesets) - { - foreach (var r in rulesets.AvailableRulesets) - AddItem(r); - - AccentColour = colours.Lime; - - SelectTab(TabContainer.FirstOrDefault()); - } - - protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer - { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(20, 0), - }; - - private class RankingsTabItem : PageTabItem - { - public RankingsTabItem(RulesetInfo value) - : base(value) - { - } - - protected override string CreateText() => $"{Value.Name}"; - } - } -} diff --git a/osu.Game/Overlays/Rankings/RankingsScopeSelector.cs b/osu.Game/Overlays/Rankings/RankingsScopeSelector.cs deleted file mode 100644 index 2095bcc61c..0000000000 --- a/osu.Game/Overlays/Rankings/RankingsScopeSelector.cs +++ /dev/null @@ -1,26 +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 osu.Game.Graphics.UserInterface; -using osu.Framework.Allocation; -using osuTK.Graphics; - -namespace osu.Game.Overlays.Rankings -{ - public class RankingsScopeSelector : GradientLineTabControl - { - [BackgroundDependencyLoader] - private void load() - { - AccentColour = LineColour = Color4.Black; - } - } - - public enum RankingsScope - { - Performance, - Spotlights, - Score, - Country - } -} diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index f947c5585c..943897581e 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Rankings.Tables { public abstract class RankingsTable : TableContainer { - protected const int TEXT_SIZE = 14; + protected const int TEXT_SIZE = 12; private const float horizontal_inset = 20; private const float row_height = 25; private const int items_per_page = 50; @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Rankings.Tables private static TableColumn[] mainHeaders => new[] { - new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 50)), // place + new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 40)), // place new TableColumn(string.Empty, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed)), // flag and username (country name) }; @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Rankings.Tables private OsuSpriteText createIndexDrawable(int index) => new OsuSpriteText { Text = $"#{index + 1}", - Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold) + Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.SemiBold) }; private FillFlowContainer createMainContent(TModel item) => new FillFlowContainer @@ -112,10 +112,10 @@ namespace osu.Game.Overlays.Rankings.Tables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { if (Text != highlighted) - Colour = colours.GreySeafoamLighter; + Colour = colourProvider.Foreground1; } } @@ -131,9 +131,9 @@ namespace osu.Game.Overlays.Rankings.Tables protected class ColoredRowText : RowText { [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - Colour = colours.GreySeafoamLighter; + Colour = colourProvider.Foreground1; } } } diff --git a/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs b/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs index 04e1c22dae..fe87a8b3d4 100644 --- a/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs +++ b/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Game.Graphics; using osuTK.Graphics; namespace osu.Game.Overlays.Rankings.Tables @@ -35,10 +34,10 @@ namespace osu.Game.Overlays.Rankings.Tables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - background.Colour = idleColour = colours.GreySeafoam; - hoverColour = colours.GreySeafoamLight; + background.Colour = idleColour = colourProvider.Background4; + hoverColour = colourProvider.Background3; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Overlays/RankingsOverlay.cs b/osu.Game/Overlays/RankingsOverlay.cs index 1ab18b8c15..84470d9caa 100644 --- a/osu.Game/Overlays/RankingsOverlay.cs +++ b/osu.Game/Overlays/RankingsOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; using osu.Game.Overlays.Rankings; using osu.Game.Users; using osu.Game.Rulesets; @@ -27,6 +26,7 @@ namespace osu.Game.Overlays private readonly BasicScrollContainer scrollFlow; private readonly Container tableContainer; private readonly DimmedLoadingLayer loading; + private readonly Box background; private APIRequest lastRequest; private CancellationTokenSource cancellationToken; @@ -39,10 +39,9 @@ namespace osu.Game.Overlays { Children = new Drawable[] { - new Box + background = new Box { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.1f), + RelativeSizeAxes = Axes.Both }, scrollFlow = new BasicScrollContainer { @@ -55,12 +54,13 @@ namespace osu.Game.Overlays Direction = FillDirection.Vertical, Children = new Drawable[] { - new RankingsHeader + new RankingsOverlayHeader { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Depth = -float.MaxValue, Country = { BindTarget = Country }, - Scope = { BindTarget = Scope }, + Current = { BindTarget = Scope }, Ruleset = { BindTarget = ruleset } }, new Container @@ -86,6 +86,12 @@ namespace osu.Game.Overlays }; } + [BackgroundDependencyLoader] + private void load() + { + background.Colour = ColourProvider.Background5; + } + protected override void LoadComplete() { Country.BindValueChanged(_ => diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index dff5a17bd8..b199a2a0cf 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays TabControl = CreateTabControl().With(control => { control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }; - control.Current = current; + control.Current = Current; }) } });