Skip to content

Commit

Permalink
Merge pull request #27070 from Joehuu/hide-ruleset-selector-kudosu
Browse files Browse the repository at this point in the history
Hide ruleset selector when on kudosu ranking
  • Loading branch information
bdach authored Feb 7, 2024
2 parents b68a169 + b0bd1a8 commit 7460d07
Showing 1 changed file with 29 additions and 6 deletions.
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;
}
}
}
}
}

0 comments on commit 7460d07

Please sign in to comment.