Use typed action bar icon fields
This commit is contained in:
parent
8aa1e15a39
commit
028da90e0d
160 changed files with 312 additions and 278 deletions
Binary file not shown.
|
|
@ -421,6 +421,7 @@ internal static class LegacyCatalogReader
|
|||
HullCanTow = unionKey == 3 && GetBool(payload, 29),
|
||||
DockingMaxSizeX = dockingMaxSize.X,
|
||||
DockingMaxSizeY = dockingMaxSize.Y,
|
||||
ActionBarIcon = unionKey is 2 or 3 or 29 or 30 or 31 ? GetString(payload, 20) : "",
|
||||
SimpleCommodityCategory = unionKey == 0 ? GetEnumName(payload, 10, SimpleCommodityCategories) : "",
|
||||
CompoundCommodityCategory = unionKey == 1 ? GetEnumName(payload, 11, CompoundCommodityCategories) : "",
|
||||
WeaponRange = unionKey == 31 ? GetEnumName(payload, 24, WeaponRanges) : "",
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ internal static class AetheriaRuntimeCatalogSnapshotMapper
|
|||
item.HullCanTow,
|
||||
item.DockingMaxSizeX,
|
||||
item.DockingMaxSizeY,
|
||||
item.ActionBarIcon,
|
||||
item.SimpleCommodityCategory,
|
||||
item.CompoundCommodityCategory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ var maxDurabilityItems = items
|
|||
var durableMaxDurabilityItems = maxDurabilityItems.Count(item => item.Durability > 0);
|
||||
var importedThermalRangeItems = items.Count(item => item.MaximumTemperature > item.MinimumTemperature);
|
||||
var importedThermalCurveItems = items.Count(item => item.ThermalPerformanceCurveKeys.Length > 0);
|
||||
var actionBarIconItems = items.Count(item => !string.IsNullOrWhiteSpace(item.ActionBarIcon));
|
||||
var dockingBayItems = items.Count(item => item.Category == "DockingBayData");
|
||||
var dockingBayMaxSizeItems = items.Count(item =>
|
||||
item.Category == "DockingBayData" &&
|
||||
|
|
@ -393,6 +394,7 @@ Console.WriteLine($"Hull armor/physical facet items: {hullArmorItems}/{hullPhysi
|
|||
Console.WriteLine($"Simple/compound commodity category items: {simpleCommodityCategoryItems}/{compoundCommodityCategoryItems}");
|
||||
Console.WriteLine($"Durable hull/weapon items: {durableMaxDurabilityItems}/{maxDurabilityItems.Length}");
|
||||
Console.WriteLine($"Thermal range/curve items: {importedThermalRangeItems}/{importedThermalCurveItems}");
|
||||
Console.WriteLine($"Action-bar icon items: {actionBarIconItems}");
|
||||
Console.WriteLine($"Docking bay max-size items: {dockingBayMaxSizeItems}/{dockingBayItems}");
|
||||
Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}");
|
||||
Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Length} root children)");
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ public sealed class AetheriaItemDefinition
|
|||
|
||||
[Key(45)]
|
||||
public int DockingMaxSizeY { get; set; }
|
||||
|
||||
[Key(46)]
|
||||
public string ActionBarIcon { get; set; } = "";
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -122,9 +122,7 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
Slot.QuantityRemaining.gameObject.SetActive(false);
|
||||
Slot.Icon.gameObject.SetActive(true);
|
||||
Slot.Label.gameObject.SetActive(false);
|
||||
if (!string.IsNullOrEmpty(Item.Data.ActionBarIcon))
|
||||
Slot.Icon.texture = Resources.Load<Texture2D>(Item.Data.ActionBarIcon.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
else Slot.Icon.texture = ResolveIconTexture();
|
||||
Slot.Icon.texture = ResolveIconTexture();
|
||||
}
|
||||
|
||||
private Texture2D ResolveIconTexture()
|
||||
|
|
@ -132,6 +130,10 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
var typedItem = FindTypedGearItem(Item.EquippableItem);
|
||||
if (typedItem != null)
|
||||
{
|
||||
var actionBarIcon = LoadActionBarIcon(typedItem.ActionBarIcon);
|
||||
if (actionBarIcon != null)
|
||||
return actionBarIcon;
|
||||
|
||||
if (Enum.TryParse<WeaponType>(typedItem.WeaponType, out var weaponType))
|
||||
return ActionGameManager.Instance.Settings.GetIcon(weaponType).texture;
|
||||
|
||||
|
|
@ -142,6 +144,20 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
return ActionGameManager.Instance.Settings.GetIcon(HardpointType.Tool).texture;
|
||||
}
|
||||
|
||||
private static Texture2D LoadActionBarIcon(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return null;
|
||||
|
||||
const string resourcesPrefix = "Assets/Resources/";
|
||||
var resourcePath = path.StartsWith(resourcesPrefix, StringComparison.Ordinal)
|
||||
? path.Substring(resourcesPrefix.Length)
|
||||
: path;
|
||||
|
||||
resourcePath = resourcePath.Split('.').First();
|
||||
return Resources.Load<Texture2D>(resourcePath);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCatalogItem FindTypedGearItem(ItemInstance item)
|
||||
{
|
||||
var itemId = item?.Data?.ItemId ?? Guid.Empty;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader
|
|||
if (projected is EquippableItemData equippable)
|
||||
{
|
||||
equippable.Durability = (float)item.Durability;
|
||||
equippable.ActionBarIcon = item.ActionBarIcon;
|
||||
equippable.Behaviors = ProjectBehaviors(item).ToList();
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue