Hitsu San Design
New member
Hello and good evening,
I am trying to put together an event listener that can filter out items based on the Item view slot they have been added and ofcourse their Collection, per example lets pick "c_Inventory_OnAdd_ItemInfo_ItemStack".
The issue with the aforementioned event is the fact that lets say i had the desired Item View Slot as a reference, i would still hit a wall cause the Item View Slot only holds its past value at the moment of the addition of the Item to the Collection.
A possible suggestion to this would be to add to the event an Item View Slot parameter that merely indicates where this Item will be added, if its null we can assume this Item will not be added to a U.I (like a monster per example or something that holds some Items but are not gonna get displayed).
Cause the only other alternative to this would be to listen to the containers event for on draw, but this seems convoluted and hard to wrap your head around when you go with a logical flow for this.
An example script:
What other alternatives exist to handle a listener like the one described?
I am trying to put together an event listener that can filter out items based on the Item view slot they have been added and ofcourse their Collection, per example lets pick "c_Inventory_OnAdd_ItemInfo_ItemStack".
The issue with the aforementioned event is the fact that lets say i had the desired Item View Slot as a reference, i would still hit a wall cause the Item View Slot only holds its past value at the moment of the addition of the Item to the Collection.
A possible suggestion to this would be to add to the event an Item View Slot parameter that merely indicates where this Item will be added, if its null we can assume this Item will not be added to a U.I (like a monster per example or something that holds some Items but are not gonna get displayed).
Cause the only other alternative to this would be to listen to the containers event for on draw, but this seems convoluted and hard to wrap your head around when you go with a logical flow for this.
An example script:
C#:
[SerializeField]
private ItemViewSlot TargetSlot;
[SerializeField]
private ItemCollectionID targetCollection;
private Inventory inventory; //Its referened in start, this is only an example
public void ItemViewSlotListener(ItemInfo itemInfo, ItemStack stack)
{
if (inventory.GetItemCollection(targetCollection) != stack.ItemCollection)
{
return;
}
//The following is not possible to work
if (TargetSlot.ItemInfo == itemInfo)
{
return;
}
//Do stuff
}
What other alternatives exist to handle a listener like the one described?
Last edited: