Gate action bar consumables with typed catalog
This commit is contained in:
parent
87f9adf4d9
commit
ca18aa24d3
3 changed files with 22 additions and 3 deletions
|
|
@ -729,6 +729,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
slot.Binding = new ActionBarGearBinding(CurrentEntity, slot, equippedItemDragAction.EquippedItem, trigger);
|
||||
return true;
|
||||
case ItemInstanceDragObject itemInstanceDragAction:
|
||||
if (!IsTypedConsumable(itemInstanceDragAction.Item)) return false;
|
||||
if (!(ItemManager.GetData(itemInstanceDragAction.Item) is ConsumableItemData consumable)) return false;
|
||||
slot.Binding = new ActionBarConsumableBinding(CurrentEntity, slot, consumable);
|
||||
return true;
|
||||
|
|
@ -748,6 +749,21 @@ public class ActionGameManager : MonoBehaviour
|
|||
return slot;
|
||||
}
|
||||
|
||||
bool IsTypedConsumable(ItemInstance item)
|
||||
{
|
||||
var typedItem = FindTypedActionBarItem(item);
|
||||
return typedItem == null ||
|
||||
string.Equals(typedItem.Category, nameof(ConsumableItemData), StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
AetheriaRuntimeCatalogItem FindTypedActionBarItem(ItemInstance item)
|
||||
{
|
||||
var itemId = item?.Data?.ItemId ?? Guid.Empty;
|
||||
return itemId == Guid.Empty
|
||||
? null
|
||||
: RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D"));
|
||||
}
|
||||
|
||||
var bindings = RuntimePlayerSettings.InputSettings.ActionBarInputs.OrderBy(i => i)
|
||||
.Select(createBinding).ToList();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue