2020-02-19 14:40:54 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-03-06 00:09:43 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using System.Linq;
|
2020-03-06 00:09:43 +00:00
|
|
|
|
using System.Threading;
|
2020-05-14 06:35:11 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2022-02-22 05:56:04 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2020-05-14 06:35:11 +00:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2021-06-22 05:53:21 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-02-19 15:17:02 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2020-04-21 06:47:43 +00:00
|
|
|
|
using osu.Framework.Input.Events;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osu.Game.Audio;
|
2021-10-23 14:55:05 +00:00
|
|
|
|
using osu.Game.Beatmaps.Drawables.Cards;
|
2021-06-19 12:54:24 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-06-19 12:54:24 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2022-02-22 05:56:04 +00:00
|
|
|
|
using osu.Game.Online.API;
|
2021-12-22 12:16:36 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osu.Game.Overlays.BeatmapListing;
|
2021-06-16 04:46:13 +00:00
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
2021-01-18 08:13:38 +00:00
|
|
|
|
public partial class BeatmapListingOverlay : OnlineOverlay<BeatmapListingHeader>
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
|
|
|
|
[Resolved]
|
|
|
|
|
private PreviewTrackManager previewTrackManager { get; set; }
|
|
|
|
|
|
2022-02-22 05:56:04 +00:00
|
|
|
|
[Resolved]
|
|
|
|
|
private IAPIProvider api { get; set; }
|
|
|
|
|
|
|
|
|
|
private IBindable<APIUser> apiUser;
|
|
|
|
|
|
2020-03-06 00:09:43 +00:00
|
|
|
|
private Container panelTarget;
|
2021-11-27 16:53:57 +00:00
|
|
|
|
private FillFlowContainer<BeatmapCard> foundContent;
|
2023-03-21 05:27:07 +00:00
|
|
|
|
|
2023-03-22 04:31:35 +00:00
|
|
|
|
private BeatmapListingFilterControl filterControl => Header.FilterControl;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
|
|
|
|
public BeatmapListingOverlay()
|
|
|
|
|
: base(OverlayColourScheme.Blue)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
Child = new FillFlowContainer
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
new Container
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
new Box
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-10-23 14:55:05 +00:00
|
|
|
|
Colour = ColourProvider.Background5,
|
2020-02-19 14:40:54 +00:00
|
|
|
|
},
|
2021-01-18 07:48:12 +00:00
|
|
|
|
panelTarget = new Container
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2021-09-11 13:54:49 +00:00
|
|
|
|
Masking = true,
|
2021-01-18 07:48:12 +00:00
|
|
|
|
Padding = new MarginPadding { Horizontal = 20 },
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
2021-01-18 07:48:12 +00:00
|
|
|
|
},
|
2021-01-04 13:42:39 +00:00
|
|
|
|
},
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2023-03-22 04:31:35 +00:00
|
|
|
|
|
|
|
|
|
filterControl.TypingStarted = onTypingStarted;
|
|
|
|
|
filterControl.SearchStarted = onSearchStarted;
|
|
|
|
|
filterControl.SearchFinished = onSearchFinished;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-22 12:16:36 +00:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
filterControl.CardSize.BindValueChanged(_ => onCardSizeChanged());
|
2022-02-22 05:56:04 +00:00
|
|
|
|
|
|
|
|
|
apiUser = api.LocalUser.GetBoundCopy();
|
2022-08-09 07:38:12 +00:00
|
|
|
|
apiUser.BindValueChanged(_ => Schedule(() =>
|
2022-02-22 05:56:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (api.IsLoggedIn)
|
2022-11-17 14:41:49 +00:00
|
|
|
|
replaceResultsAreaContent(Drawable.Empty());
|
2022-08-09 07:38:12 +00:00
|
|
|
|
}));
|
2021-12-22 12:16:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-01 10:45:17 +00:00
|
|
|
|
public void ShowWithSearch(string query)
|
|
|
|
|
{
|
|
|
|
|
filterControl.Search(query);
|
|
|
|
|
Show();
|
2022-10-26 01:06:49 +00:00
|
|
|
|
ScrollFlow.ScrollToStart();
|
2021-07-01 10:45:17 +00:00
|
|
|
|
}
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
2022-12-21 19:02:04 +00:00
|
|
|
|
public void ShowWithGenreFilter(SearchGenre genre)
|
2022-12-19 06:52:21 +00:00
|
|
|
|
{
|
|
|
|
|
ShowWithSearch(string.Empty);
|
|
|
|
|
filterControl.FilterGenre(genre);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-21 19:02:04 +00:00
|
|
|
|
public void ShowWithLanguageFilter(SearchLanguage language)
|
2022-12-19 06:52:21 +00:00
|
|
|
|
{
|
|
|
|
|
ShowWithSearch(string.Empty);
|
|
|
|
|
filterControl.FilterLanguage(language);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 07:48:12 +00:00
|
|
|
|
protected override BeatmapListingHeader CreateHeader() => new BeatmapListingHeader();
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
2021-02-09 09:32:44 +00:00
|
|
|
|
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
2020-11-10 07:26:30 +00:00
|
|
|
|
private void onTypingStarted()
|
|
|
|
|
{
|
|
|
|
|
// temporary until the textbox/header is updated to always stay on screen.
|
2021-01-18 07:48:12 +00:00
|
|
|
|
ScrollFlow.ScrollToStart();
|
2020-02-19 23:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 06:47:43 +00:00
|
|
|
|
protected override void OnFocus(FocusEvent e)
|
2020-02-19 23:54:35 +00:00
|
|
|
|
{
|
2020-04-21 06:47:43 +00:00
|
|
|
|
base.OnFocus(e);
|
2020-02-19 23:54:35 +00:00
|
|
|
|
|
2020-04-21 06:47:43 +00:00
|
|
|
|
filterControl.TakeFocus();
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 00:09:43 +00:00
|
|
|
|
private CancellationTokenSource cancellationToken;
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
2021-12-24 10:00:09 +00:00
|
|
|
|
private Task panelLoadTask;
|
|
|
|
|
|
2020-03-06 00:09:43 +00:00
|
|
|
|
private void onSearchStarted()
|
2020-02-19 23:54:35 +00:00
|
|
|
|
{
|
2020-03-06 00:09:43 +00:00
|
|
|
|
cancellationToken?.Cancel();
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
|
|
|
|
previewTrackManager.StopAnyPlaying(this);
|
|
|
|
|
|
2020-03-06 00:09:43 +00:00
|
|
|
|
if (panelTarget.Any())
|
2021-01-18 07:48:12 +00:00
|
|
|
|
Loading.Show();
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-22 05:53:21 +00:00
|
|
|
|
private void onSearchFinished(BeatmapListingFilterControl.SearchResult searchResult)
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2021-12-24 10:00:09 +00:00
|
|
|
|
cancellationToken?.Cancel();
|
|
|
|
|
|
2021-06-26 18:31:26 +00:00
|
|
|
|
if (searchResult.Type == BeatmapListingFilterControl.SearchResultType.SupporterOnlyFilters)
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2022-11-18 01:35:05 +00:00
|
|
|
|
var supporterOnly = new SupporterRequiredDrawable(searchResult.SupporterOnlyFiltersUsed);
|
2022-11-17 14:41:49 +00:00
|
|
|
|
replaceResultsAreaContent(supporterOnly);
|
2020-02-19 14:40:54 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-22 12:16:36 +00:00
|
|
|
|
var newCards = createCardsFor(searchResult.Results);
|
2020-02-19 15:17:02 +00:00
|
|
|
|
|
2020-05-14 06:35:11 +00:00
|
|
|
|
if (filterControl.CurrentPage == 0)
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2020-05-14 06:35:11 +00:00
|
|
|
|
//No matches case
|
2021-12-22 12:16:36 +00:00
|
|
|
|
if (!newCards.Any())
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2022-11-17 14:41:49 +00:00
|
|
|
|
replaceResultsAreaContent(new NotFoundDrawable());
|
2020-05-14 06:35:11 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2020-02-19 14:40:54 +00:00
|
|
|
|
|
2021-12-22 12:16:36 +00:00
|
|
|
|
var content = createCardContainerFor(newCards);
|
2020-05-11 18:18:47 +00:00
|
|
|
|
|
2022-11-17 14:41:49 +00:00
|
|
|
|
panelLoadTask = LoadComponentAsync(foundContent = content, replaceResultsAreaContent, (cancellationToken = new CancellationTokenSource()).Token);
|
2020-05-11 18:18:47 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2020-02-19 14:40:54 +00:00
|
|
|
|
{
|
2022-09-13 21:49:02 +00:00
|
|
|
|
// new results may contain beatmaps from a previous page,
|
|
|
|
|
// this is dodgy but matches web behaviour for now.
|
|
|
|
|
// see: https://github.com/ppy/osu-web/issues/9270
|
2023-12-04 19:17:22 +00:00
|
|
|
|
newCards = newCards.ExceptBy(foundContent.Select(c => c.BeatmapSet.OnlineID), c => c.BeatmapSet.OnlineID);
|
2022-09-12 22:38:52 +00:00
|
|
|
|
|
2021-12-24 09:58:31 +00:00
|
|
|
|
panelLoadTask = LoadComponentsAsync(newCards, loaded =>
|
2020-05-11 18:18:47 +00:00
|
|
|
|
{
|
2020-05-14 06:35:11 +00:00
|
|
|
|
lastFetchDisplayedTime = Time.Current;
|
|
|
|
|
foundContent.AddRange(loaded);
|
|
|
|
|
loaded.ForEach(p => p.FadeIn(200, Easing.OutQuint));
|
2021-12-24 09:58:31 +00:00
|
|
|
|
}, (cancellationToken = new CancellationTokenSource()).Token);
|
2020-05-11 18:18:47 +00:00
|
|
|
|
}
|
2020-02-19 15:17:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-12 22:38:52 +00:00
|
|
|
|
private IEnumerable<BeatmapCard> createCardsFor(IEnumerable<APIBeatmapSet> beatmapSets) => beatmapSets.Select(set => BeatmapCard.Create(set, filterControl.CardSize.Value).With(c =>
|
2021-12-22 12:16:36 +00:00
|
|
|
|
{
|
|
|
|
|
c.Anchor = Anchor.TopCentre;
|
|
|
|
|
c.Origin = Anchor.TopCentre;
|
2024-05-03 04:13:52 +00:00
|
|
|
|
c.Scale = new Vector2(0.8f);
|
2021-12-22 12:16:36 +00:00
|
|
|
|
})).ToArray();
|
|
|
|
|
|
|
|
|
|
private static ReverseChildIDFillFlowContainer<BeatmapCard> createCardContainerFor(IEnumerable<BeatmapCard> newCards)
|
|
|
|
|
{
|
|
|
|
|
// spawn new children with the contained so we only clear old content at the last moment.
|
|
|
|
|
// reverse ID flow is required for correct Z-ordering of the cards' expandable content (last card should be front-most).
|
|
|
|
|
var content = new ReverseChildIDFillFlowContainer<BeatmapCard>
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Spacing = new Vector2(10),
|
|
|
|
|
Alpha = 0,
|
2022-01-03 04:18:27 +00:00
|
|
|
|
Margin = new MarginPadding
|
|
|
|
|
{
|
2022-01-19 21:10:05 +00:00
|
|
|
|
Top = 15,
|
|
|
|
|
// the + 20 adjustment is roughly eyeballed in order to fit all of the expanded content height after it's scaled
|
|
|
|
|
// as well as provide visual balance to the top margin.
|
|
|
|
|
Bottom = ExpandedContentScrollContainer.HEIGHT + 20
|
2022-01-03 04:18:27 +00:00
|
|
|
|
},
|
2021-12-22 12:16:36 +00:00
|
|
|
|
ChildrenEnumerable = newCards
|
|
|
|
|
};
|
|
|
|
|
return content;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-17 14:41:49 +00:00
|
|
|
|
private void replaceResultsAreaContent(Drawable content)
|
2020-02-19 15:17:02 +00:00
|
|
|
|
{
|
2021-01-18 07:48:12 +00:00
|
|
|
|
Loading.Hide();
|
2020-05-14 06:35:11 +00:00
|
|
|
|
lastFetchDisplayedTime = Time.Current;
|
2020-02-21 07:13:24 +00:00
|
|
|
|
|
2022-11-17 14:41:49 +00:00
|
|
|
|
panelTarget.Child = content;
|
2020-05-11 18:18:47 +00:00
|
|
|
|
|
2022-01-03 18:39:07 +00:00
|
|
|
|
content.FadeInFromZero();
|
2020-02-19 15:17:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-22 12:16:36 +00:00
|
|
|
|
private void onCardSizeChanged()
|
|
|
|
|
{
|
2022-01-03 19:02:46 +00:00
|
|
|
|
if (foundContent?.IsAlive != true || !foundContent.Any())
|
2021-12-22 12:16:36 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Loading.Show();
|
|
|
|
|
|
|
|
|
|
var newCards = createCardsFor(foundContent.Reverse().Select(card => card.BeatmapSet));
|
|
|
|
|
|
2021-12-24 10:00:09 +00:00
|
|
|
|
cancellationToken?.Cancel();
|
|
|
|
|
|
2021-12-24 09:58:31 +00:00
|
|
|
|
panelLoadTask = LoadComponentsAsync(newCards, cards =>
|
2021-12-22 12:16:36 +00:00
|
|
|
|
{
|
|
|
|
|
foundContent.Clear();
|
|
|
|
|
foundContent.AddRange(cards);
|
|
|
|
|
Loading.Hide();
|
|
|
|
|
}, (cancellationToken = new CancellationTokenSource()).Token);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-19 15:17:02 +00:00
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
2020-03-06 00:09:43 +00:00
|
|
|
|
cancellationToken?.Cancel();
|
2020-02-19 15:17:02 +00:00
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-25 20:41:05 +00:00
|
|
|
|
public partial class NotFoundDrawable : CompositeDrawable
|
2020-02-19 15:17:02 +00:00
|
|
|
|
{
|
2020-02-19 23:43:13 +00:00
|
|
|
|
public NotFoundDrawable()
|
2020-02-19 15:17:02 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = 250;
|
2020-02-20 02:08:42 +00:00
|
|
|
|
Alpha = 0;
|
2020-02-19 15:17:02 +00:00
|
|
|
|
Margin = new MarginPadding { Top = 15 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-11-17 14:41:35 +00:00
|
|
|
|
private void load(LargeTextureStore textures)
|
2020-02-19 15:17:02 +00:00
|
|
|
|
{
|
|
|
|
|
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/not-found")
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2021-06-16 04:46:13 +00:00
|
|
|
|
Text = BeatmapsStrings.ListingSearchNotFoundQuote,
|
2020-02-19 15:17:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
2020-05-11 18:18:47 +00:00
|
|
|
|
|
2021-06-26 18:40:54 +00:00
|
|
|
|
// TODO: localisation requires Text/LinkFlowContainer support for localising strings with links inside
|
|
|
|
|
// (https://github.com/ppy/osu-framework/issues/4530)
|
2021-06-19 12:54:24 +00:00
|
|
|
|
public partial class SupporterRequiredDrawable : CompositeDrawable
|
|
|
|
|
{
|
2021-06-24 05:45:38 +00:00
|
|
|
|
private LinkFlowContainer supporterRequiredText;
|
2021-06-20 13:23:54 +00:00
|
|
|
|
|
2022-11-18 01:35:05 +00:00
|
|
|
|
private readonly List<LocalisableString> filtersUsed;
|
|
|
|
|
|
|
|
|
|
public SupporterRequiredDrawable(List<LocalisableString> filtersUsed)
|
2021-06-19 12:54:24 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2021-06-20 09:17:07 +00:00
|
|
|
|
Height = 225;
|
2021-06-19 12:54:24 +00:00
|
|
|
|
Alpha = 0;
|
2022-11-18 01:35:05 +00:00
|
|
|
|
|
|
|
|
|
this.filtersUsed = filtersUsed;
|
2021-06-19 12:54:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-11-17 14:41:35 +00:00
|
|
|
|
private void load(LargeTextureStore textures)
|
2021-06-19 12:54:24 +00:00
|
|
|
|
{
|
|
|
|
|
AddInternal(new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
2021-06-24 05:45:38 +00:00
|
|
|
|
Children = new Drawable[]
|
2021-06-19 12:54:24 +00:00
|
|
|
|
{
|
|
|
|
|
new Sprite
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
FillMode = FillMode.Fit,
|
|
|
|
|
Texture = textures.Get(@"Online/supporter-required"),
|
|
|
|
|
},
|
2021-06-24 05:45:38 +00:00
|
|
|
|
supporterRequiredText = new LinkFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Margin = new MarginPadding { Bottom = 10 },
|
|
|
|
|
},
|
2021-06-19 12:54:24 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2021-06-24 05:45:38 +00:00
|
|
|
|
supporterRequiredText.AddText(
|
2022-11-18 01:35:05 +00:00
|
|
|
|
BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(string.Join(" and ", filtersUsed), "").ToString(),
|
2021-06-22 05:53:21 +00:00
|
|
|
|
t =>
|
|
|
|
|
{
|
|
|
|
|
t.Font = OsuFont.GetFont(size: 16);
|
|
|
|
|
t.Colour = Colour4.White;
|
|
|
|
|
}
|
2021-06-24 05:45:38 +00:00
|
|
|
|
);
|
2021-06-22 05:53:21 +00:00
|
|
|
|
|
|
|
|
|
supporterRequiredText.AddLink(BeatmapsStrings.ListingSearchSupporterFilterQuoteLinkText.ToString(), @"/store/products/supporter-tag");
|
2021-06-19 12:54:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-14 06:35:11 +00:00
|
|
|
|
private const double time_between_fetches = 500;
|
|
|
|
|
|
|
|
|
|
private double lastFetchDisplayedTime;
|
|
|
|
|
|
2020-05-11 18:18:47 +00:00
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
2020-05-14 06:35:11 +00:00
|
|
|
|
const int pagination_scroll_distance = 500;
|
|
|
|
|
|
2021-12-24 09:58:31 +00:00
|
|
|
|
bool shouldShowMore = panelLoadTask?.IsCompleted != false
|
2020-05-14 06:35:11 +00:00
|
|
|
|
&& Time.Current - lastFetchDisplayedTime > time_between_fetches
|
2021-01-18 07:48:12 +00:00
|
|
|
|
&& (ScrollFlow.ScrollableExtent > 0 && ScrollFlow.IsScrolledToEnd(pagination_scroll_distance));
|
2020-05-14 06:35:11 +00:00
|
|
|
|
|
|
|
|
|
if (shouldShowMore)
|
|
|
|
|
filterControl.FetchNextPage();
|
2020-05-11 18:18:47 +00:00
|
|
|
|
}
|
2020-02-19 14:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|