Use typed hull classes in sector summaries
This commit is contained in:
parent
738fa00eca
commit
87f9adf4d9
3 changed files with 26 additions and 4 deletions
Binary file not shown.
|
|
@ -1,6 +1,8 @@
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using GameCult.Aetheria.State.Unity;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
@ -90,17 +92,17 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
|
||||||
Properties.AddProperty("Stars", () => starCount);
|
Properties.AddProperty("Stars", () => starCount);
|
||||||
|
|
||||||
var stationCount = zone.RuntimeBlueprint.Entities
|
var stationCount = zone.RuntimeBlueprint.Entities
|
||||||
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Station)
|
.Count(entity => HasHullType(entity, HullType.Station))
|
||||||
.ToString();
|
.ToString();
|
||||||
Properties.AddProperty("Stations", () => stationCount);
|
Properties.AddProperty("Stations", () => stationCount);
|
||||||
|
|
||||||
var turretCount = zone.RuntimeBlueprint.Entities
|
var turretCount = zone.RuntimeBlueprint.Entities
|
||||||
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Turret)
|
.Count(entity => HasHullType(entity, HullType.Turret))
|
||||||
.ToString();
|
.ToString();
|
||||||
Properties.AddProperty("Turrets", () => turretCount);
|
Properties.AddProperty("Turrets", () => turretCount);
|
||||||
|
|
||||||
var shipCount = zone.RuntimeBlueprint.Entities
|
var shipCount = zone.RuntimeBlueprint.Entities
|
||||||
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Ship)
|
.Count(entity => HasHullType(entity, HullType.Ship))
|
||||||
.ToString();
|
.ToString();
|
||||||
Properties.AddProperty("Ships", () => shipCount);
|
Properties.AddProperty("Ships", () => shipCount);
|
||||||
}
|
}
|
||||||
|
|
@ -112,6 +114,24 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HasHullType(RuntimeEntityBlueprint entity, HullType hullType)
|
||||||
|
{
|
||||||
|
var typedItem = FindTypedHull(entity);
|
||||||
|
if (typedItem != null)
|
||||||
|
return string.Equals(typedItem.HullType, hullType.ToString(), StringComparison.Ordinal);
|
||||||
|
|
||||||
|
return GameManager.ItemManager.GetData(entity.Hull) is HullData hullData &&
|
||||||
|
hullData.HullType == hullType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AetheriaRuntimeCatalogItem FindTypedHull(RuntimeEntityBlueprint entity)
|
||||||
|
{
|
||||||
|
var itemId = entity?.Hull?.Data?.ItemId ?? Guid.Empty;
|
||||||
|
return itemId == Guid.Empty
|
||||||
|
? null
|
||||||
|
: ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D"));
|
||||||
|
}
|
||||||
|
|
||||||
// private IEnumerator AnimatePath()
|
// private IEnumerator AnimatePath()
|
||||||
// {
|
// {
|
||||||
// var pathZones = ActionGameManager.CurrentSector.ExitPath;
|
// var pathZones = ActionGameManager.CurrentSector.ExitPath;
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
||||||
now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu
|
now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu
|
||||||
applies typed row prefilters for size, hardpoint type, and behavior kind before
|
applies typed row prefilters for size, hardpoint type, and behavior kind before
|
||||||
hydrating `ItemData` projections for legacy commodity filters, columns, and
|
hydrating `ItemData` projections for legacy commodity filters, columns, and
|
||||||
buy actions.
|
buy actions. The sector properties UI also resolves station/turret/ship
|
||||||
|
counts through typed hull classifications from the runtime catalog before
|
||||||
|
falling back to legacy `HullData` projection for missing rows.
|
||||||
- `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`.
|
- `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`.
|
||||||
Sector and tutorial generation receive the package-owned typed runtime
|
Sector and tutorial generation receive the package-owned typed runtime
|
||||||
catalog. `Galaxy` projects typed corporation v2 records into temporary legacy
|
catalog. `Galaxy` projects typed corporation v2 records into temporary legacy
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue