Use typed durability in properties panel
This commit is contained in:
parent
d21a8b5cfd
commit
a950205ecc
3 changed files with 13 additions and 4 deletions
Binary file not shown.
|
|
@ -399,6 +399,15 @@ public class PropertiesPanel : MonoBehaviour
|
|||
: (float)typedItem.Mass;
|
||||
}
|
||||
|
||||
private float GetMaxDurability(ItemInstance item)
|
||||
{
|
||||
var typedItem = FindTypedPropertyItem(item);
|
||||
if (typedItem != null && typedItem.Durability > 0)
|
||||
return (float)typedItem.Durability;
|
||||
|
||||
return GameManager.ItemManager.GetData(item).Durability;
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCatalogItem FindTypedPropertyItem(ItemInstance item)
|
||||
{
|
||||
var itemId = item?.Data?.ItemId ?? Guid.Empty;
|
||||
|
|
@ -499,7 +508,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
var statusSheet = AddStatSheet();
|
||||
if (item.EquippableItem.Durability < .01f)
|
||||
statusSheet.AddStat("Durability", () => "Item Destroyed!");
|
||||
else statusSheet.AddStat("Durability", () => $"{(int)(item.EquippableItem.Durability / gearData.Durability * 100)}%");
|
||||
else statusSheet.AddStat("Durability", () => $"{(int)(item.EquippableItem.Durability / GetMaxDurability(item.EquippableItem) * 100)}%");
|
||||
statusSheet.AddStat("Temperature", () => ActionGameManager.RuntimePlayerSettings.FormatTemperature(item.Temperature));
|
||||
|
||||
var heatCurve = AddCurveField();
|
||||
|
|
@ -541,7 +550,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
AddSpacer();
|
||||
var gearData = GameManager.ItemManager.GetData(gear);
|
||||
var statusSheet = AddStatSheet();
|
||||
statusSheet.AddStat("Durability", () => $"{(int)(gear.Durability / gearData.Durability * 100)}%");
|
||||
statusSheet.AddStat("Durability", () => $"{(int)(gear.Durability / GetMaxDurability(gear) * 100)}%");
|
||||
var heatCurve = AddCurveField();
|
||||
heatCurve.Show(
|
||||
"Thermal Performance",
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
presentation now uses typed catalog category/name rows to choose weapon-vs-gear
|
||||
pickup visuals and scan labels before falling back to legacy item projections.
|
||||
The item properties panel also reads typed catalog description, manufacturer,
|
||||
and base mass for item presentation before hydrating legacy DTOs for behavior
|
||||
reflection, thermal curves, and durability math that have not yet moved to
|
||||
base mass, and max durability for item presentation before hydrating legacy
|
||||
DTOs for behavior reflection and thermal curves that have not yet moved to
|
||||
typed behavior surfaces. Inventory selection highlighting now uses typed item
|
||||
shape cells for UI tint geometry before falling back to legacy `ItemData.Shape`.
|
||||
Inventory cargo cell tint now uses typed hardpoint facets before falling back
|
||||
|
|
|
|||
Loading…
Reference in a new issue