Use typed behavior key for properties payloads
This commit is contained in:
parent
93ab0ae102
commit
16c9ee3a5f
3 changed files with 27 additions and 5 deletions
Binary file not shown.
|
|
@ -474,7 +474,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => TypedBehaviorMatches(payload, typeof(WeaponData)));
|
||||
var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => TypedBehaviorMatches(payload, WeaponBehaviorMatcher));
|
||||
if (weaponPayload != null)
|
||||
{
|
||||
var damageCurve = ReadTypedBezierCurve(FindTypedBehaviorField(weaponPayload, 7)?.Value);
|
||||
|
|
@ -561,15 +561,15 @@ public class PropertiesPanel : MonoBehaviour
|
|||
: fallback;
|
||||
}
|
||||
|
||||
private static bool TypedBehaviorMatches(AetheriaRuntimeBehaviorPayload payload, Type behaviorType)
|
||||
private static bool TypedBehaviorMatches(AetheriaRuntimeBehaviorPayload payload, BehaviorKindMatcher matcher)
|
||||
{
|
||||
if (string.Equals(payload.Kind, behaviorType.Name, StringComparison.Ordinal))
|
||||
if (string.Equals(payload.Kind, matcher.Kind, StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var payloadType = ResolveBehaviorType(payload.Kind);
|
||||
return payloadType != null && behaviorType.IsAssignableFrom(payloadType);
|
||||
return payloadType != null && matcher.MetadataType.IsAssignableFrom(payloadType);
|
||||
}
|
||||
|
||||
private static Type ResolveBehaviorType(string kind)
|
||||
|
|
@ -587,6 +587,22 @@ public class PropertiesPanel : MonoBehaviour
|
|||
.GroupBy(type => type.Name)
|
||||
.ToDictionary(group => group.Key, group => group.First(), StringComparer.Ordinal);
|
||||
|
||||
private static readonly BehaviorKindMatcher WeaponBehaviorMatcher = new BehaviorKindMatcher(
|
||||
nameof(WeaponData),
|
||||
typeof(WeaponData));
|
||||
|
||||
private readonly struct BehaviorKindMatcher
|
||||
{
|
||||
public BehaviorKindMatcher(string kind, Type metadataType)
|
||||
{
|
||||
Kind = string.IsNullOrWhiteSpace(kind) ? "" : kind;
|
||||
MetadataType = metadataType ?? throw new ArgumentNullException(nameof(metadataType));
|
||||
}
|
||||
|
||||
public string Kind { get; }
|
||||
public Type MetadataType { get; }
|
||||
}
|
||||
|
||||
private string GetTitle(EquippableItem item)
|
||||
{
|
||||
var typedItem = FindTypedPropertyItem(item);
|
||||
|
|
|
|||
|
|
@ -222,7 +222,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
manufacturer, base mass, max durability, thermal bounds, and thermal
|
||||
performance curve keys for basic item presentation without hydrating legacy
|
||||
DTOs. Runtime behavior stat display and damage-range curves read typed
|
||||
behavior payload fields by legacy payload key. The old explicit
|
||||
behavior payload fields by legacy payload key. Damage-range payload selection
|
||||
is keyed by typed behavior kind (`WeaponData`); legacy `BehaviorData` ancestry
|
||||
is only a temporary metadata fallback while typed behavior metadata/factory
|
||||
documents are missing. The old explicit
|
||||
`Inspect(ItemData)` DTO inspection overload is deleted; trade row clicks now
|
||||
inspect the typed runtime catalog row directly. Incomplete typed thermal
|
||||
curve rows render a neutral fallback curve instead of hydrating legacy
|
||||
|
|
@ -746,6 +749,9 @@ First Aetheria surfaces to publish:
|
|||
curves onto typed behavior payload fields, and delete the explicit
|
||||
`Inspect(ItemData)` projection inspector after moving trade row inspection
|
||||
onto typed runtime catalog rows.
|
||||
- Done: demote PropertiesPanel weapon damage-range payload matching from
|
||||
`BehaviorData` `Type` authority to a typed behavior kind key; reflection
|
||||
remains metadata-only until typed behavior metadata/factory documents exist.
|
||||
- Done: remove the loot pickup presentation fallback to legacy `ItemData`;
|
||||
typed category/name rows now decide pickup visuals and scan labels, and
|
||||
missing typed rows render generic unknown gear pickup presentation.
|
||||
|
|
|
|||
Loading…
Reference in a new issue