mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 16:02:58 +08:00
added supporter-only-filter content
This commit is contained in:
parent
b6e07ff59c
commit
27da3dc75a
@ -24,6 +24,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when a search finishes. Contains only new items in the case of pagination.
|
/// Fired when a search finishes. Contains only new items in the case of pagination.
|
||||||
|
/// Null when non-supporter user used supporter-only filters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<List<BeatmapSetInfo>> SearchFinished;
|
public Action<List<BeatmapSetInfo>> SearchFinished;
|
||||||
|
|
||||||
@ -212,7 +213,14 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
lastResponse = response;
|
lastResponse = response;
|
||||||
getSetsRequest = null;
|
getSetsRequest = null;
|
||||||
|
|
||||||
SearchFinished?.Invoke(sets);
|
if (!api.LocalUser.Value.IsSupporter && (searchControl.Ranks.Any() || searchControl.Played.Value != SearchPlayed.Any))
|
||||||
|
{
|
||||||
|
SearchFinished?.Invoke(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SearchFinished?.Invoke(sets);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(getSetsRequest);
|
api.Queue(getSetsRequest);
|
||||||
|
@ -15,7 +15,9 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.BeatmapListing;
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -33,6 +35,7 @@ namespace osu.Game.Overlays
|
|||||||
private Container panelTarget;
|
private Container panelTarget;
|
||||||
private FillFlowContainer<BeatmapPanel> foundContent;
|
private FillFlowContainer<BeatmapPanel> foundContent;
|
||||||
private NotFoundDrawable notFoundContent;
|
private NotFoundDrawable notFoundContent;
|
||||||
|
private SupporterRequiredDrawable supporterRequiredContent;
|
||||||
private BeatmapListingFilterControl filterControl;
|
private BeatmapListingFilterControl filterControl;
|
||||||
|
|
||||||
public BeatmapListingOverlay()
|
public BeatmapListingOverlay()
|
||||||
@ -76,6 +79,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
foundContent = new FillFlowContainer<BeatmapPanel>(),
|
foundContent = new FillFlowContainer<BeatmapPanel>(),
|
||||||
notFoundContent = new NotFoundDrawable(),
|
notFoundContent = new NotFoundDrawable(),
|
||||||
|
supporterRequiredContent = new SupporterRequiredDrawable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -117,6 +121,13 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void onSearchFinished(List<BeatmapSetInfo> beatmaps)
|
private void onSearchFinished(List<BeatmapSetInfo> beatmaps)
|
||||||
{
|
{
|
||||||
|
// non-supporter user used supporter-only filters
|
||||||
|
if (beatmaps == null)
|
||||||
|
{
|
||||||
|
LoadComponentAsync(supporterRequiredContent, addContentToPlaceholder, (cancellationToken = new CancellationTokenSource()).Token);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var newPanels = beatmaps.Select<BeatmapSetInfo, BeatmapPanel>(b => new GridBeatmapPanel(b)
|
var newPanels = beatmaps.Select<BeatmapSetInfo, BeatmapPanel>(b => new GridBeatmapPanel(b)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -170,7 +181,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
var transform = lastContent.FadeOut(100, Easing.OutQuint);
|
var transform = lastContent.FadeOut(100, Easing.OutQuint);
|
||||||
|
|
||||||
if (lastContent == notFoundContent)
|
if (lastContent == notFoundContent || lastContent == supporterRequiredContent)
|
||||||
{
|
{
|
||||||
// not found display may be used multiple times, so don't expire/dispose it.
|
// not found display may be used multiple times, so don't expire/dispose it.
|
||||||
transform.Schedule(() => panelTarget.Remove(lastContent));
|
transform.Schedule(() => panelTarget.Remove(lastContent));
|
||||||
@ -240,6 +251,107 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SupporterRequiredDrawable : CompositeDrawable
|
||||||
|
{
|
||||||
|
public SupporterRequiredDrawable()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = 250;
|
||||||
|
Alpha = 0;
|
||||||
|
Margin = new MarginPadding { Top = 15 };
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
AddInternal(new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(10, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
|
Texture = textures.Get(@"Online/supporter-required"),
|
||||||
|
},
|
||||||
|
createSupportRequiredText(),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable createSupportRequiredText()
|
||||||
|
{
|
||||||
|
LinkFlowContainer linkFlowContainer;
|
||||||
|
string[] text = BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(
|
||||||
|
BeatmapsStrings.ListingSearchFiltersRank.ToString(),
|
||||||
|
"{1}"
|
||||||
|
).ToString().Split("{1}");
|
||||||
|
|
||||||
|
// var titleContainer = new Container
|
||||||
|
// {
|
||||||
|
// RelativeSizeAxes = Axes.X,
|
||||||
|
// Margin = new MarginPadding { Vertical = 5 },
|
||||||
|
// Children = new Drawable[]
|
||||||
|
// {
|
||||||
|
// linkFlowContainer = new LinkFlowContainer
|
||||||
|
// {
|
||||||
|
// Anchor = Anchor.Centre,
|
||||||
|
// Origin = Anchor.Centre,
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
linkFlowContainer = new LinkFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Bottom = 10,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
linkFlowContainer.AddText(
|
||||||
|
text[0],
|
||||||
|
t =>
|
||||||
|
{
|
||||||
|
t.Font = OsuFont.GetFont(size: 16);
|
||||||
|
t.Colour = Colour4.White;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
linkFlowContainer.AddLink(
|
||||||
|
BeatmapsStrings.ListingSearchSupporterFilterQuoteLinkText.ToString(),
|
||||||
|
"https://osu.ppy.sh/store/products/supporter-tag",
|
||||||
|
t =>
|
||||||
|
{
|
||||||
|
t.Font = OsuFont.GetFont(size: 16);
|
||||||
|
t.Colour = Colour4.AliceBlue;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
linkFlowContainer.AddText(
|
||||||
|
text[1],
|
||||||
|
t =>
|
||||||
|
{
|
||||||
|
t.Font = OsuFont.GetFont(size: 16);
|
||||||
|
t.Colour = Colour4.White;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return linkFlowContainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private const double time_between_fetches = 500;
|
private const double time_between_fetches = 500;
|
||||||
|
|
||||||
private double lastFetchDisplayedTime;
|
private double lastFetchDisplayedTime;
|
||||||
|
Loading…
Reference in New Issue
Block a user