neon-sprawl/server/NeonSprawl.Server/Game/Factions/FactionDefinitionCatalog.cs

22 lines
1005 B
C#

using System.Collections.ObjectModel;
namespace NeonSprawl.Server.Game.Factions;
/// <summary>In-memory faction catalog loaded at startup (NEO-134). Game code should prefer <see cref="IFactionDefinitionRegistry"/> for lookups.</summary>
public sealed class FactionDefinitionCatalog(
string factionsDirectory,
IReadOnlyDictionary<string, FactionDefRow> byId,
int catalogJsonFileCount)
{
/// <summary>Absolute path to the directory that was enumerated for <c>*_factions.json</c> catalogs.</summary>
public string FactionsDirectory { get; } = factionsDirectory;
public IReadOnlyDictionary<string, FactionDefRow> ById { get; } =
new ReadOnlyDictionary<string, FactionDefRow>(new Dictionary<string, FactionDefRow>(byId, StringComparer.Ordinal));
public int DistinctFactionCount => ById.Count;
/// <summary>Number of <c>*_factions.json</c> files under <see cref="FactionsDirectory"/>.</summary>
public int CatalogJsonFileCount { get; } = catalogJsonFileCount;
}