mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-03 17:38:22 +00:00
25 lines
No EOL
649 B
C#
25 lines
No EOL
649 B
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using LBPUnion.ProjectLighthouse.Types;
|
|
using LBPUnion.ProjectLighthouse.Types.Match;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Extensions;
|
|
|
|
public static class RoomExtensions
|
|
{
|
|
public static List<User> GetPlayers(this Room room, Database database)
|
|
{
|
|
List<User> players = new();
|
|
foreach (int playerId in room.PlayerIds)
|
|
{
|
|
User? player = database.Users.FirstOrDefault(p => p.UserId == playerId);
|
|
Debug.Assert(player != null);
|
|
|
|
players.Add(player);
|
|
}
|
|
|
|
return players;
|
|
}
|
|
} |