Skip to content

Commit 732b2a7

Browse files
authored
Limit maximum match history displayed at ranked play queue screen (ppy#37816)
As proposed in ppy#37815, but without the extra stuff that I'm not sure about.
1 parent 50aafba commit 732b2a7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,20 @@ private void onMatchmakingLobbyStatusChanged(MatchmakingLobbyStatus status) => S
441441
loadRecentMatches(status.RecentMatches.OfType<RankedPlayRoomState>().ToArray()).FireAndForget();
442442
});
443443

444+
private int historyInsertOrder;
445+
444446
private async Task loadRecentMatches(RankedPlayRoomState[] matches)
445447
{
448+
// matches initial API response.
449+
const int max_panels = 50;
450+
446451
await userLookupCache.GetUsersAsync(matches.SelectMany(m => m.Users.Keys).ToArray()).ConfigureAwait(false);
447452

448453
Scheduler.Add(() =>
449454
{
450455
foreach (var match in matches)
451456
{
452-
resultPanelContainer.Insert(-resultPanelContainer.Count, new RankedPlayMatchPanel(match)
457+
resultPanelContainer.Insert(historyInsertOrder--, new RankedPlayMatchPanel(match)
453458
{
454459
RelativeSizeAxes = Axes.X,
455460
Width = 0.48f
@@ -461,6 +466,9 @@ private async Task loadRecentMatches(RankedPlayRoomState[] matches)
461466
resultPanelContainer.LayoutDuration = 400;
462467
resultPanelContainer.LayoutEasing = Easing.OutQuint;
463468
}
469+
470+
while (resultPanelContainer.Count > max_panels)
471+
resultPanelContainer.Children.First().RemoveAndDisposeImmediately();
464472
});
465473
}
466474

0 commit comments

Comments
 (0)