mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Merge pull request #6917 from EVAST9919/beatmap-overlay-no-supporter-filter
Add placeholder for non-supporters in beatmap overlay
This commit is contained in:
commit
d95eb37c2d
@ -42,6 +42,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(BeatmapAvailability),
|
||||
typeof(BeatmapRulesetSelector),
|
||||
typeof(BeatmapRulesetTabItem),
|
||||
typeof(NotSupporterPlaceholder)
|
||||
};
|
||||
|
||||
protected override bool UseOnlineAPI => true;
|
||||
|
@ -0,0 +1,49 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
public class NotSupporterPlaceholder : Container
|
||||
{
|
||||
public NotSupporterPlaceholder()
|
||||
{
|
||||
LinkFlowContainer text;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = @"You need to be an osu!supporter to access the friend and country rankings!",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
},
|
||||
text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 12))
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
text.AddText("Click ");
|
||||
text.AddLink("here", "/home/support");
|
||||
text.AddText(" to see all the fancy features that you can get!");
|
||||
}
|
||||
}
|
||||
}
|
@ -26,17 +26,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>();
|
||||
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
|
||||
private readonly Bindable<User> user = new Bindable<User>();
|
||||
|
||||
private readonly Box background;
|
||||
private readonly ScoreTable scoreTable;
|
||||
private readonly FillFlowContainer topScoresContainer;
|
||||
private readonly DimmedLoadingLayer loading;
|
||||
private readonly FillFlowContainer filterControls;
|
||||
private readonly LeaderboardModSelector modSelector;
|
||||
private readonly NoScoresPlaceholder noScoresPlaceholder;
|
||||
private readonly FillFlowContainer content;
|
||||
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
@ -93,21 +93,24 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Margin = new MarginPadding { Vertical = spacing },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
filterControls = new FillFlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, spacing),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new LeaderboardScopeSelector
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Current = { BindTarget = scope }
|
||||
},
|
||||
modSelector = new LeaderboardModSelector
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Ruleset = { BindTarget = ruleset }
|
||||
}
|
||||
}
|
||||
@ -127,6 +130,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
AlwaysPresent = true,
|
||||
Margin = new MarginPadding { Vertical = 10 }
|
||||
},
|
||||
notSupporterPlaceholder = new NotSupporterPlaceholder
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Alpha = 0,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -204,9 +213,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
private void onUserChanged(ValueChangedEvent<User> user)
|
||||
{
|
||||
scope.Value = BeatmapLeaderboardScope.Global;
|
||||
modSelector.DeselectAll();
|
||||
filterControls.FadeTo(api.IsLoggedIn && api.LocalUser.Value.IsSupporter ? 1 : 0);
|
||||
if (modSelector.SelectedMods.Any())
|
||||
modSelector.DeselectAll();
|
||||
else
|
||||
getScores();
|
||||
|
||||
modSelector.FadeTo(userIsSupporter ? 1 : 0);
|
||||
}
|
||||
|
||||
private void getScores()
|
||||
@ -223,6 +235,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
return;
|
||||
}
|
||||
|
||||
if (scope.Value != BeatmapLeaderboardScope.Global && !userIsSupporter)
|
||||
{
|
||||
Scores = null;
|
||||
notSupporterPlaceholder.Show();
|
||||
loading.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
notSupporterPlaceholder.Hide();
|
||||
|
||||
content.Show();
|
||||
loading.Show();
|
||||
|
||||
@ -238,5 +260,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
api.Queue(getScoresRequest);
|
||||
}
|
||||
|
||||
private bool userIsSupporter => api.IsLoggedIn && api.LocalUser.Value.IsSupporter;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user