Move Galaxy off legacy catalog reader
This commit is contained in:
parent
fabbd088e2
commit
8cdd4d0b37
4 changed files with 26 additions and 20 deletions
Binary file not shown.
|
|
@ -32,7 +32,7 @@ public class Galaxy
|
|||
private HashSet<Guid> _containedFactions;
|
||||
private GalaxyZone[] _exitPath;
|
||||
private Dictionary<Faction, MarkovNameGenerator> _nameGenerators = new Dictionary<Faction, MarkovNameGenerator>();
|
||||
private readonly ILegacyCatalogReader _catalog;
|
||||
private readonly ItemManager _itemManager;
|
||||
|
||||
public GalaxyZone[] ExitPath
|
||||
{
|
||||
|
|
@ -48,16 +48,16 @@ public class Galaxy
|
|||
SectorGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
ILegacyCatalogReader catalog,
|
||||
ItemManager itemManager,
|
||||
Action<string> log,
|
||||
Action<string> progressCallback = null,
|
||||
uint seed = 0)
|
||||
{
|
||||
_catalog = catalog;
|
||||
_itemManager = itemManager;
|
||||
IsPrelude = false;
|
||||
Background = background;
|
||||
Log = log;
|
||||
var factions = catalog.GetAll<Faction>();
|
||||
var factions = itemManager.GetCatalogEntries<Faction>();
|
||||
var random = new Random(seed == 0 ? (uint) (DateTime.Now.Ticks % uint.MaxValue) : seed);
|
||||
Factions = factions.OrderBy(x => random.NextFloat()).Take(settings.MegaCount).ToArray();
|
||||
foreach (var f in Factions) FactionRelationships[f] = FactionRelationship.Neutral;
|
||||
|
|
@ -81,7 +81,7 @@ public class Galaxy
|
|||
|
||||
CalculateFactionInfluence(progressCallback);
|
||||
|
||||
GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback);
|
||||
GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback);
|
||||
|
||||
progressCallback?.Invoke("Done!");
|
||||
if(progressCallback!=null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
|
|
@ -89,21 +89,21 @@ public class Galaxy
|
|||
|
||||
public Faction ResolveFaction(string name)
|
||||
{
|
||||
return _catalog.GetAll<Faction>().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
return _itemManager.GetCatalogEntries<Faction>().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
public Galaxy(
|
||||
TutorialGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
ILegacyCatalogReader catalog,
|
||||
ItemManager itemManager,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
Action<string> log,
|
||||
Action<string> progressCallback = null,
|
||||
uint seed = 0)
|
||||
{
|
||||
_catalog = catalog;
|
||||
_itemManager = itemManager;
|
||||
IsPrelude = true;
|
||||
|
||||
Background = background;
|
||||
|
|
@ -189,7 +189,7 @@ public class Galaxy
|
|||
|
||||
CalculateFactionInfluence(progressCallback);
|
||||
|
||||
GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback);
|
||||
GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback);
|
||||
|
||||
// progressCallback?.Invoke("Weaving Narrative");
|
||||
// var processor = new StoryProcessor(playerSettings, narrativeDirectory, this, ref random, Log);
|
||||
|
|
@ -280,7 +280,7 @@ public class Galaxy
|
|||
}
|
||||
}
|
||||
|
||||
private void GenerateNames(ILegacyCatalogReader catalog,
|
||||
private void GenerateNames(ItemManager itemManager,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
ref Random random,
|
||||
Action<string> progressCallback = null)
|
||||
|
|
@ -290,7 +290,7 @@ public class Galaxy
|
|||
progressCallback?.Invoke($"Feeding Markov Chains: {i + 1} / {Factions.Length}");
|
||||
//if(progressCallback!=null) Thread.Sleep(250); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
var faction = Factions[i];
|
||||
_nameGenerators[faction] = new MarkovNameGenerator(ref random, catalog.Get<NameFile>(faction.GeonameFile).Names, nameGeneratorSettings);
|
||||
_nameGenerators[faction] = new MarkovNameGenerator(ref random, itemManager.GetCatalogEntry<NameFile>(faction.GeonameFile).Names, nameGeneratorSettings);
|
||||
}
|
||||
|
||||
// Generate zone name using the owner's name generator, otherwise assign catalogue ID
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class MainMenu : MonoBehaviour
|
|||
Settings.SectorGenerationSettings,
|
||||
Settings.SectorBackgroundSettings,
|
||||
Settings.NameGeneratorSettings,
|
||||
ActionGameManager.LegacyCatalog,
|
||||
ActionGameManager.ItemManager,
|
||||
Debug.Log,
|
||||
setState);
|
||||
Observable.NextFrame().Subscribe(_ =>
|
||||
|
|
@ -143,7 +143,7 @@ public class MainMenu : MonoBehaviour
|
|||
Settings.TutorialGenerationSettings,
|
||||
Settings.TutorialBackgroundSettings,
|
||||
Settings.NameGeneratorSettings,
|
||||
ActionGameManager.LegacyCatalog,
|
||||
ActionGameManager.ItemManager,
|
||||
ActionGameManager.PlayerSettings,
|
||||
ActionGameManager.GameDataDirectory.CreateSubdirectory("Narrative"),
|
||||
Debug.Log,
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
`GetCatalogEntries<T>` methods. This does not remove the legacy reader under
|
||||
the hood; it prevents old catalog authority from leaking into every caller
|
||||
that only needs a domain lookup.
|
||||
- `Galaxy` generation no longer accepts `ILegacyCatalogReader`. Sector and
|
||||
tutorial generation receive `ItemManager` and use the same narrow catalog
|
||||
lookup port for factions and name files. `ActionGameManager.LegacyCatalog`
|
||||
now feeds only `ItemManager` boot; menu/generation paths no longer receive
|
||||
the legacy reader directly.
|
||||
- `DatabaseLink<T>.Value` can resolve legacy links only after
|
||||
`LegacyCatalogBoundary` binds the pull-only catalog cache. Legacy catalog
|
||||
construction no longer grabs global `DatabaseLinkBase` authority.
|
||||
|
|
@ -183,11 +188,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
old MessagePack catalog reads, and `LegacyCatalogBoundary` is the only named
|
||||
owner for opening the old catalog and binding legacy `DatabaseLink<T>`
|
||||
resolution until catalog migration lands. Runtime code receives narrow
|
||||
`ItemManager` catalog methods where gameplay only needs lookups; `ItemManager`
|
||||
and `Galaxy` still receive `ILegacyCatalogReader` until typed runtime catalog
|
||||
boot replaces them. `Aetheria.State.Unity` owns a read-only typed catalog
|
||||
facade for future Unity consumers; it does not write state or own simulation.
|
||||
The legacy cache no longer has a public mutation surface.
|
||||
`ItemManager` catalog methods where gameplay only needs lookups. `ItemManager`
|
||||
still receives `ILegacyCatalogReader` until typed runtime catalog boot
|
||||
replaces it; `Galaxy` has been moved off the legacy reader and now consumes
|
||||
`ItemManager`. `Aetheria.State.Unity` owns a read-only typed catalog facade
|
||||
for future Unity consumers; it does not write state or own simulation. The
|
||||
legacy cache no longer has a public mutation surface.
|
||||
- Inputs: Unity gameplay code, legacy catalog files, typed state documents, and
|
||||
CultMesh server state.
|
||||
- Outputs: `Aetheria.State` emits `.cc` state and CultMesh documents. Legacy
|
||||
|
|
@ -228,8 +234,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
- Shared paths: gameplay input, editor edits, import/deep-load, replication,
|
||||
simulation ticks, and tests all call the same typed state service.
|
||||
- Deletion line: after catalog migration smokes pass, replace
|
||||
`ActionGameManager.LegacyCatalog`/`ItemManager`/`Galaxy` boot with the typed
|
||||
runtime catalog package, then delete or quarantine the remaining
|
||||
`ActionGameManager.LegacyCatalog`/`ItemManager` boot with the typed runtime
|
||||
catalog package, then delete or quarantine the remaining
|
||||
`LegacyCatalogCache`/`DatabaseEntry` runtime catalog dependency and remove old
|
||||
MessagePack backing store classes from live Unity source.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue