Restructured for new direction.
This commit is contained in:
@@ -35,39 +35,38 @@ namespace BriarQueen.Framework.Registries
|
||||
{
|
||||
_entryLookup = new Dictionary<string, CodexEntrySo>();
|
||||
|
||||
AddEntries(_bookEntries, "Book Entries");
|
||||
AddEntries(_puzzleClues, "Puzzle Clues");
|
||||
AddEntries(_photoEntries, "Photo Entries");
|
||||
}
|
||||
RegistryLookupBuilder.AddEntries(
|
||||
_entryLookup,
|
||||
_bookEntries,
|
||||
this,
|
||||
nameof(CodexRegistry),
|
||||
"Book Entries",
|
||||
"UniqueID",
|
||||
entry => entry.UniqueID,
|
||||
entry => entry,
|
||||
entry => RegistryLookupBuilder.HasNonEmptyKey(entry.UniqueID));
|
||||
|
||||
private void AddEntries(List<CodexEntrySo> entries, string category)
|
||||
{
|
||||
if (entries == null)
|
||||
return;
|
||||
RegistryLookupBuilder.AddEntries(
|
||||
_entryLookup,
|
||||
_puzzleClues,
|
||||
this,
|
||||
nameof(CodexRegistry),
|
||||
"Puzzle Clues",
|
||||
"UniqueID",
|
||||
entry => entry.UniqueID,
|
||||
entry => entry,
|
||||
entry => RegistryLookupBuilder.HasNonEmptyKey(entry.UniqueID));
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(entry.UniqueID))
|
||||
{
|
||||
Debug.LogWarning(
|
||||
$"[CodexRegistry] Skipping {category} entry '{entry.name}' because UniqueID is empty.",
|
||||
this);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_entryLookup.ContainsKey(entry.UniqueID))
|
||||
{
|
||||
Debug.LogError(
|
||||
$"[CodexRegistry] Duplicate UniqueID detected: '{entry.UniqueID}' from entry '{entry.name}'.",
|
||||
this);
|
||||
continue;
|
||||
}
|
||||
|
||||
_entryLookup.Add(entry.UniqueID, entry);
|
||||
}
|
||||
RegistryLookupBuilder.AddEntries(
|
||||
_entryLookup,
|
||||
_photoEntries,
|
||||
this,
|
||||
nameof(CodexRegistry),
|
||||
"Photo Entries",
|
||||
"UniqueID",
|
||||
entry => entry.UniqueID,
|
||||
entry => entry,
|
||||
entry => RegistryLookupBuilder.HasNonEmptyKey(entry.UniqueID));
|
||||
}
|
||||
|
||||
public bool TryGetEntry(string entryID, out CodexEntrySo entry)
|
||||
@@ -130,4 +129,4 @@ namespace BriarQueen.Framework.Registries
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user