TigerEmu/Game/Rooms/RoomManager.cs

28 lines
961 B
C#

using Microsoft.Extensions.Logging;
using Tiger.Storage;
namespace Tiger.Game.Rooms;
public class RoomManager : IRoomManager
{
private readonly IRepository<RoomPrivateCategory> _roomPrivateCategoryRepository;
private readonly ILogger<IRoomManager> _logger;
public IDictionary<int, RoomPrivateCategory> PrivateCategories { get; private set; }
public RoomManager(IRepository<RoomPrivateCategory> roomPrivateCategoryRepository, ILogger<IRoomManager> logger)
{
_roomPrivateCategoryRepository = roomPrivateCategoryRepository;
_logger = logger;
PrivateCategories = new Dictionary<int, RoomPrivateCategory>();
}
public async Task LoadPrivateCategoriesAsync()
{
PrivateCategories =
(await _roomPrivateCategoryRepository.FindByAsync()).ToDictionary(rpc => rpc.Id);
_logger.LogInformation("Loaded {Count} private room categories", PrivateCategories.Count);
}
}