1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Merge branch 'master' into fix-spritetext-usage

This commit is contained in:
Dan Balasescu 2019-11-25 12:15:05 +09:00 committed by GitHub
commit 9f93727a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 10 deletions

View File

@ -42,6 +42,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(BeatmapAvailability), typeof(BeatmapAvailability),
typeof(BeatmapRulesetSelector), typeof(BeatmapRulesetSelector),
typeof(BeatmapRulesetTabItem), typeof(BeatmapRulesetTabItem),
typeof(NotSupporterPlaceholder)
}; };
protected override bool UseOnlineAPI => true; protected override bool UseOnlineAPI => true;

View File

@ -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!");
}
}
}

View File

@ -26,17 +26,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>(); public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>(); 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 Bindable<User> user = new Bindable<User>();
private readonly Box background; private readonly Box background;
private readonly ScoreTable scoreTable; private readonly ScoreTable scoreTable;
private readonly FillFlowContainer topScoresContainer; private readonly FillFlowContainer topScoresContainer;
private readonly DimmedLoadingLayer loading; private readonly DimmedLoadingLayer loading;
private readonly FillFlowContainer filterControls;
private readonly LeaderboardModSelector modSelector; private readonly LeaderboardModSelector modSelector;
private readonly NoScoresPlaceholder noScoresPlaceholder; private readonly NoScoresPlaceholder noScoresPlaceholder;
private readonly FillFlowContainer content; private readonly FillFlowContainer content;
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
@ -93,21 +93,24 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Margin = new MarginPadding { Vertical = spacing }, Margin = new MarginPadding { Vertical = spacing },
Children = new Drawable[] Children = new Drawable[]
{ {
filterControls = new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Y,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, spacing), Spacing = new Vector2(0, spacing),
Children = new Drawable[] Children = new Drawable[]
{ {
new LeaderboardScopeSelector new LeaderboardScopeSelector
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Current = { BindTarget = scope } Current = { BindTarget = scope }
}, },
modSelector = new LeaderboardModSelector modSelector = new LeaderboardModSelector
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Ruleset = { BindTarget = ruleset } Ruleset = { BindTarget = ruleset }
} }
} }
@ -127,6 +130,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AlwaysPresent = true, AlwaysPresent = true,
Margin = new MarginPadding { Vertical = 10 } Margin = new MarginPadding { Vertical = 10 }
}, },
notSupporterPlaceholder = new NotSupporterPlaceholder
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Alpha = 0,
},
new FillFlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -204,9 +213,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void onUserChanged(ValueChangedEvent<User> user) private void onUserChanged(ValueChangedEvent<User> user)
{ {
scope.Value = BeatmapLeaderboardScope.Global; if (modSelector.SelectedMods.Any())
modSelector.DeselectAll(); modSelector.DeselectAll();
filterControls.FadeTo(api.IsLoggedIn && api.LocalUser.Value.IsSupporter ? 1 : 0); else
getScores();
modSelector.FadeTo(userIsSupporter ? 1 : 0);
} }
private void getScores() private void getScores()
@ -223,6 +235,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
return; return;
} }
if (scope.Value != BeatmapLeaderboardScope.Global && !userIsSupporter)
{
Scores = null;
notSupporterPlaceholder.Show();
loading.Hide();
return;
}
notSupporterPlaceholder.Hide();
content.Show(); content.Show();
loading.Show(); loading.Show();
@ -238,5 +260,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
api.Queue(getScoresRequest); api.Queue(getScoresRequest);
} }
private bool userIsSupporter => api.IsLoggedIn && api.LocalUser.Value.IsSupporter;
} }
} }

View File

@ -224,7 +224,7 @@ namespace osu.Game.Rulesets.UI
Playfield.PostProcess(); Playfield.PostProcess();
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>()) foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); mod.ApplyToDrawableHitObjects(Playfield.AllHitObjects);
} }
public override void RequestResume(Action continueResume) public override void RequestResume(Action continueResume)