Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide ruleset selector when on kudosu ranking #27070

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 29 additions & 6 deletions osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using osu.Framework.Bindables;
using osu.Game.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Users;

Expand All @@ -19,8 +17,8 @@ public partial class RankingsOverlayHeader : TabControlOverlayHeader<RankingsSco

public Bindable<CountryCode> Country => countryFilter.Current;

private OverlayRulesetSelector rulesetSelector;
private CountryFilter countryFilter;
private OverlayRulesetSelector rulesetSelector = null!;
private CountryFilter countryFilter = null!;

protected override OverlayTitle CreateTitle() => new RankingsTitle();

Expand All @@ -39,5 +37,30 @@ public RankingsTitle()
Icon = OsuIcon.Ranking;
}
}

protected override void LoadComplete()
{
base.LoadComplete();

Current.BindValueChanged(scope =>
{
rulesetSelector.FadeTo(showRulesetSelector(scope.NewValue) ? 1 : 0, 200, Easing.OutQuint);
}, true);

bool showRulesetSelector(RankingsScope scope)
{
switch (scope)
{
case RankingsScope.Performance:
case RankingsScope.Spotlights:
case RankingsScope.Score:
case RankingsScope.Country:
return true;

default:
return false;
}
}
}
}
}