53 lines
2 KiB
C#
53 lines
2 KiB
C#
using Aetheria.State.Documents;
|
|
using GameCult.Caching;
|
|
using GameCult.Networking;
|
|
|
|
namespace Aetheria.State;
|
|
|
|
public static class AetheriaDocumentRegistry
|
|
{
|
|
public static CultDocumentRegistry CreateCultCacheRegistry()
|
|
{
|
|
var registry = new CultDocumentRegistry();
|
|
foreach (var documentType in DocumentTypes)
|
|
{
|
|
registry.GetRequired(documentType);
|
|
}
|
|
|
|
return registry;
|
|
}
|
|
|
|
public static CultNetDocumentRegistry CreateCultNetRegistry(CultDocumentRegistry? cacheRegistry = null)
|
|
{
|
|
var registry = cacheRegistry ?? CreateCultCacheRegistry();
|
|
return new CultNetDocumentRegistry(
|
|
registry,
|
|
new[]
|
|
{
|
|
CultNetDocumentBinding.ForDocument<AetheriaWorldState>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaItemDefinition>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaCorporation>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaPlayerProfile>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaRuntimeSession>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaMigrationLedger>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaPlayerSettings>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaSavedRun>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaSavedZone>(registry),
|
|
CultNetDocumentBinding.ForDocument<AetheriaEntitySnapshot>(registry)
|
|
});
|
|
}
|
|
|
|
public static IReadOnlyList<Type> DocumentTypes { get; } =
|
|
[
|
|
typeof(AetheriaWorldState),
|
|
typeof(AetheriaItemDefinition),
|
|
typeof(AetheriaCorporation),
|
|
typeof(AetheriaPlayerProfile),
|
|
typeof(AetheriaRuntimeSession),
|
|
typeof(AetheriaMigrationLedger),
|
|
typeof(AetheriaPlayerSettings),
|
|
typeof(AetheriaSavedRun),
|
|
typeof(AetheriaSavedZone),
|
|
typeof(AetheriaEntitySnapshot)
|
|
];
|
|
}
|