26 lines
778 B
C#
26 lines
778 B
C#
using Microsoft.Extensions.Logging;
|
|
using Tiger.Game.Rooms.Models;
|
|
using Tiger.Storage;
|
|
|
|
namespace Tiger.Game.Rooms;
|
|
|
|
public class RoomManager : IRoomManager
|
|
{
|
|
private readonly IRepository<RoomModel> _roomModelRepository;
|
|
private readonly ILogger<IRoomManager> _logger;
|
|
|
|
public RoomManager(IRepository<RoomModel> roomModelRepository, ILogger<IRoomManager> logger)
|
|
{
|
|
_roomModelRepository = roomModelRepository;
|
|
_logger = logger;
|
|
}
|
|
|
|
public Dictionary<string, RoomModel> Models { get; private set; } = new();
|
|
|
|
public async Task LoadModelsAsync()
|
|
{
|
|
Models = (await _roomModelRepository.FindByAsync()).ToDictionary(rm => rm.Name);
|
|
|
|
_logger.LogInformation("Loaded {Count} room models", Models.Count);
|
|
}
|
|
} |