using System.Collections.Concurrent;
using System.Security.Cryptography;
using AmongUs.Shared.Innersloth;
+using Serilog;
namespace AmongUs.Server.Net
{
public class GameManager
{
- private readonly RNGCryptoServiceProvider _random;
+ private static readonly ILogger Logger = Log.ForContext<GameManager>();
+
private readonly ConcurrentDictionary<int, Game> _games;
public GameManager()
{
- _random = new RNGCryptoServiceProvider();
_games = new ConcurrentDictionary<int, Game>();
}
if (_games.TryAdd(gameCode, game))
{
+ Logger.Debug("Created game with code {0} ({1}).", GameCode.IntToGameName(gameCode), gameCode);
return game;
}
+ Logger.Warning("Failed to create game.");
return null;
}
public void Remove(int gameCode)
{
+ Logger.Debug("Remove game with code {0} ({1}).", GameCode.IntToGameName(gameCode), gameCode);
_games.TryRemove(gameCode, out _);
}
}