mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Add support card size tab control to beatmap listing
This commit is contained in:
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -12,6 +13,7 @@ using osu.Framework.Graphics.Effects;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Beatmaps.Drawables.Cards;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
@ -48,6 +50,11 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int CurrentPage { get; private set; }
|
public int CurrentPage { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently selected <see cref="BeatmapCardSize"/>.
|
||||||
|
/// </summary>
|
||||||
|
public IBindable<BeatmapCardSize> CardSize { get; } = new Bindable<BeatmapCardSize>();
|
||||||
|
|
||||||
private readonly BeatmapListingSearchControl searchControl;
|
private readonly BeatmapListingSearchControl searchControl;
|
||||||
private readonly BeatmapListingSortTabControl sortControl;
|
private readonly BeatmapListingSortTabControl sortControl;
|
||||||
private readonly Box sortControlBackground;
|
private readonly Box sortControlBackground;
|
||||||
@ -105,6 +112,13 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding { Left = 20 }
|
Margin = new MarginPadding { Left = 20 }
|
||||||
|
},
|
||||||
|
new BeatmapListingCardSizeTabControl
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 20 },
|
||||||
|
Current = { BindTarget = CardSize }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,12 +241,14 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
if (filters.Any())
|
if (filters.Any())
|
||||||
{
|
{
|
||||||
SearchFinished?.Invoke(SearchResult.SupporterOnlyFilters(filters));
|
var supporterOnlyFilters = SearchResult.SupporterOnlyFilters(filters);
|
||||||
|
SearchFinished?.Invoke(supporterOnlyFilters);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchFinished?.Invoke(SearchResult.ResultsReturned(sets));
|
var resultsReturned = SearchResult.ResultsReturned(sets);
|
||||||
|
SearchFinished?.Invoke(resultsReturned);
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(getSetsRequest);
|
api.Queue(getSetsRequest);
|
||||||
@ -296,7 +312,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
public static SearchResult ResultsReturned(List<APIBeatmapSet> results) => new SearchResult
|
public static SearchResult ResultsReturned(List<APIBeatmapSet> results) => new SearchResult
|
||||||
{
|
{
|
||||||
Type = SearchResultType.ResultsReturned,
|
Type = SearchResultType.ResultsReturned,
|
||||||
Results = results
|
Results = results,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static SearchResult SupporterOnlyFilters(List<LocalisableString> filters) => new SearchResult
|
public static SearchResult SupporterOnlyFilters(List<LocalisableString> filters) => new SearchResult
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private Drawable currentContent;
|
private Drawable currentContent;
|
||||||
private Container panelTarget;
|
private Container panelTarget;
|
||||||
private FillFlowContainer<BeatmapCardNormal> foundContent;
|
private FillFlowContainer<BeatmapCard> foundContent;
|
||||||
private NotFoundDrawable notFoundContent;
|
private NotFoundDrawable notFoundContent;
|
||||||
private SupporterRequiredDrawable supporterRequiredContent;
|
private SupporterRequiredDrawable supporterRequiredContent;
|
||||||
private BeatmapListingFilterControl filterControl;
|
private BeatmapListingFilterControl filterControl;
|
||||||
@ -78,7 +78,7 @@ namespace osu.Game.Overlays
|
|||||||
Padding = new MarginPadding { Horizontal = 20 },
|
Padding = new MarginPadding { Horizontal = 20 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
foundContent = new FillFlowContainer<BeatmapCardNormal>(),
|
foundContent = new FillFlowContainer<BeatmapCard>(),
|
||||||
notFoundContent = new NotFoundDrawable(),
|
notFoundContent = new NotFoundDrawable(),
|
||||||
supporterRequiredContent = new SupporterRequiredDrawable(),
|
supporterRequiredContent = new SupporterRequiredDrawable(),
|
||||||
}
|
}
|
||||||
@ -135,11 +135,11 @@ namespace osu.Game.Overlays
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newPanels = searchResult.Results.Select(b => new BeatmapCardNormal(b)
|
var newPanels = searchResult.Results.Select(b => BeatmapCard.Create(b, filterControl.CardSize.Value).With(card =>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
card.Anchor = Anchor.TopCentre;
|
||||||
Origin = Anchor.TopCentre,
|
card.Origin = Anchor.TopCentre;
|
||||||
});
|
}));
|
||||||
|
|
||||||
if (filterControl.CurrentPage == 0)
|
if (filterControl.CurrentPage == 0)
|
||||||
{
|
{
|
||||||
@ -152,7 +152,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
// spawn new children with the contained so we only clear old content at the last moment.
|
// 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).
|
// reverse ID flow is required for correct Z-ordering of the cards' expandable content (last card should be front-most).
|
||||||
var content = new ReverseChildIDFillFlowContainer<BeatmapCardNormal>
|
var content = new ReverseChildIDFillFlowContainer<BeatmapCard>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Reference in New Issue
Block a user