Merge pull request #12973 from rob-v/SortPlayingGamesInLobby

Sort 'Playing' games in the lobby by play time. #12959
This commit is contained in:
Oliver Brakmann
2017-04-01 19:20:01 +02:00
committed by GitHub

View File

@@ -391,10 +391,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return 3; return 3;
}; };
foreach (var loop in modGames.OrderBy(listOrder).ThenByDescending(g => g.Players)) foreach (var modGamesByState in modGames.GroupBy(listOrder).OrderBy(g => g.Key))
{ {
var game = loop; // Sort 'Playing' games by Started, others by number of players
if (game == null || Filtered(game)) foreach (var game in modGamesByState.Key == 2 ? modGamesByState.OrderByDescending(g => g.Started) : modGamesByState.OrderByDescending(g => g.Players))
{
if (Filtered(game))
continue; continue;
var canJoin = game.IsJoinable; var canJoin = game.IsJoinable;
@@ -451,6 +453,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
rows.Add(item); rows.Add(item);
} }
} }
}
Game.RunAfterTick(() => Game.RunAfterTick(() =>
{ {