Add metadata for new gacha assets and implement gacha system scaffolding.

This commit is contained in:
2026-07-06 22:10:31 +02:00
parent 4768c9b3e0
commit 22754e4106
56 changed files with 2442 additions and 30 deletions
+21 -2
View File
@@ -13,7 +13,6 @@ namespace KernelPanic.Meta
private int featuredIndex;
// TODO: Populate owned units from SaveService during bootstrap.
// TODO: Add newly unlocked units from GachaService rewards when pulls exist.
public IReadOnlyList<DistroDefinition> OwnedUnits => ownedUnits;
public DistroDefinition FeaturedUnit => ownedUnits.Count == 0 ? null : ownedUnits[Math.Clamp(featuredIndex, 0, ownedUnits.Count - 1)];
@@ -21,7 +20,7 @@ namespace KernelPanic.Meta
public void Add(DistroDefinition unit)
{
if (unit == null || ownedUnits.Contains(unit))
if (unit == null)
{
return;
}
@@ -32,6 +31,26 @@ namespace KernelPanic.Meta
Changed?.Invoke();
}
public int GetOwnedCount(string unitId)
{
if (string.IsNullOrWhiteSpace(unitId))
{
return 0;
}
int count = 0;
for (int i = 0; i < ownedUnits.Count; i++)
{
DistroDefinition unit = ownedUnits[i];
if (unit != null && string.Equals(unit.Id, unitId, StringComparison.OrdinalIgnoreCase))
{
count++;
}
}
return count;
}
public void SelectNextFeatured()
{
if (ownedUnits.Count < 2)