Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions PerformanceCalculatorGUI/Screens/ProfileScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public partial class ProfileScreen : PerformanceCalculatorScreen

private StatefulButton calculationButton = null!;
private SwitchButton includePinnedCheckbox = null!;
private SwitchButton includeFirstsCheckbox = null!;
private SwitchButton onlyDisplayBestCheckbox = null!;
private VerboseLoadingLayer loadingLayer = null!;

Expand Down Expand Up @@ -183,6 +184,20 @@ private void load()
UseFullGlyphHeight = false,
Text = "Include pinned scores"
},
includeFirstsCheckbox = new SwitchButton
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Current = { Value = false },
},
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.Torus.With(weight: FontWeight.SemiBold, size: 14),
UseFullGlyphHeight = false,
Text = "Include first place scores"
},
onlyDisplayBestCheckbox = new SwitchButton
{
Anchor = Anchor.CentreLeft,
Expand Down Expand Up @@ -233,8 +248,6 @@ private void load()

usernameTextBox.OnCommit += (_, _) => { calculateProfiles(usernameTextBox.Current.Value.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)); };
sorting.ValueChanged += e => { updateSorting(e.NewValue); };
includePinnedCheckbox.Current.ValueChanged += e => { calculateProfiles(currentUsers); };
onlyDisplayBestCheckbox.Current.ValueChanged += e => { calculateProfiles(currentUsers); };

if (RuntimeInfo.IsDesktop)
HotReloadCallbackReceiver.CompilationFinished += _ => Schedule(() => { calculateProfiles(currentUsers); });
Expand Down Expand Up @@ -313,6 +326,13 @@ private void calculateProfiles(string[] usernames)
apiScores = apiScores.Concat(pinnedScores.Where(p => apiScores.All(b => b.ID != p.ID)).ToArray()).ToList();
}

if (includeFirstsCheckbox.Current.Value)
{
var firstScores = await apiManager.GetJsonFromApi<List<SoloScoreInfo>>($"users/{player.OnlineID}/scores/firsts?mode={ruleset.Value.ShortName}&limit={max_api_scores_in_one_query}")
.ConfigureAwait(false);
apiScores = apiScores.Concat(firstScores.Where(p => apiScores.All(b => b.ID != p.ID)).ToArray()).ToList();
}

foreach (var score in apiScores)
{
if (token.IsCancellationRequested)
Expand Down
Loading