TigerEmu/Game/Navigator/NavigatorManager.cs

28 lines
916 B
C#
Raw Normal View History

2023-11-10 13:55:42 +00:00
using Microsoft.Extensions.Logging;
using Tiger.Game.Navigator.Nodes;
using Tiger.Storage;
2023-10-14 20:32:12 +00:00
namespace Tiger.Game.Navigator;
public class NavigatorManager : INavigatorManager
{
2023-11-10 13:55:42 +00:00
private readonly IRepository<NavigatorNode> _navigatorNodeRepository;
private readonly ILogger<INavigatorManager> _logger;
2023-10-14 20:32:12 +00:00
2023-11-10 13:55:42 +00:00
public IDictionary<int, NavigatorNode> NavigatorNodes { get; private set; }
public NavigatorManager(IRepository<NavigatorNode> navigatorNodeRepository, ILogger<INavigatorManager> logger)
{
_navigatorNodeRepository = navigatorNodeRepository;
_logger = logger;
NavigatorNodes = new Dictionary<int, NavigatorNode>();
}
public async Task LoadNodesAsync()
2023-10-14 20:32:12 +00:00
{
2023-11-10 13:55:42 +00:00
NavigatorNodes = (await _navigatorNodeRepository.FindByAsync()).ToDictionary(nn => nn.Id);
_logger.LogInformation("Loaded {Count} navigator nodes", NavigatorNodes.Count);
2023-10-14 20:32:12 +00:00
}
}