Use typed weapon behavior metadata

This commit is contained in:
Meta Vens 2026-06-14 09:59:30 +01:00
commit 26219ebd44
6 changed files with 49 additions and 33 deletions

Binary file not shown.

View file

@ -11,6 +11,7 @@
<Compile Include="..\Packages\org.gamecult.eve.surface\Runtime\EveSurfaceDocument.cs" Link="EveSurfaceDocument.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeCatalogSnapshot.cs" Link="AetheriaRuntimeCatalogSnapshot.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeCatalogStore.cs" Link="AetheriaRuntimeCatalogStore.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeBehaviorKinds.cs" Link="AetheriaRuntimeBehaviorKinds.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeItemCategories.cs" Link="AetheriaRuntimeItemCategories.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeEveCommandLog.cs" Link="AetheriaRuntimeEveCommandLog.cs" />
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeStateCommitLog.cs" Link="AetheriaRuntimeStateCommitLog.cs" />

View file

@ -474,7 +474,7 @@ public class PropertiesPanel : MonoBehaviour
}
}
var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => TypedBehaviorMatches(payload, WeaponBehaviorMatcher));
var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => AetheriaRuntimeBehaviorKinds.IsWeapon(payload.Kind));
if (weaponPayload != null)
{
var damageCurve = ReadTypedBezierCurve(FindTypedBehaviorField(weaponPayload, 7)?.Value);
@ -561,17 +561,6 @@ public class PropertiesPanel : MonoBehaviour
: fallback;
}
private static bool TypedBehaviorMatches(AetheriaRuntimeBehaviorPayload payload, BehaviorKindMatcher matcher)
{
if (string.Equals(payload.Kind, matcher.Kind, StringComparison.Ordinal))
{
return true;
}
var payloadType = ResolveBehaviorType(payload.Kind);
return payloadType != null && matcher.MetadataType.IsAssignableFrom(payloadType);
}
private static Type ResolveBehaviorType(string kind)
{
return string.IsNullOrWhiteSpace(kind)
@ -587,22 +576,6 @@ 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);

View file

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
namespace GameCult.Aetheria.State.Unity
{
public static class AetheriaRuntimeBehaviorKinds
{
public const string GuidedWeapon = "GuidedWeapon";
public const string Launcher = "Launcher";
public const string InstantWeapon = "InstantWeapon";
public const string ConstantWeapon = "ConstantWeapon";
public const string ChargedWeapon = "ChargedWeapon";
public const string AutoWeapon = "AutoWeapon";
private static readonly ISet<string> WeaponKinds = new HashSet<string>(StringComparer.Ordinal)
{
GuidedWeapon,
Launcher,
InstantWeapon,
ConstantWeapon,
ChargedWeapon,
AutoWeapon
};
public static bool IsWeapon(string kind)
{
return !string.IsNullOrWhiteSpace(kind) && WeaponKinds.Contains(kind);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f03e4d7d6e841a4a9a37b4c9d25cc5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -226,9 +226,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
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. 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
is keyed by package-owned typed weapon behavior metadata; legacy
`BehaviorData` ancestry is no longer a fallback for weapon payload selection.
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
@ -762,8 +762,9 @@ First Aetheria surfaces to publish:
`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.
`BehaviorData` `Type` authority to package-owned typed weapon behavior
metadata; `BehaviorData` reflection remains display/filter 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.