Does this look like a bool to you?

        public int GetNumber()
        {
            if (GetItem() != null)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

Seems like a return of true or false to me…
Was this intended?
I went to all 4 references for this and they look like they want a number different than 1.

Just hoping to understand the strategy… (maybe a typo and meant to return GetItem())??

Thanks for any help to understand

The GetNumber() is a required function for the drag and drop system. GetNumber() tells us how many items are transferred in the swap.

In the case of InventoryUI and ActionSlotUI, corresponding to the Inventory and ActionStore, we actually are looking for a number, but in EquipmentUI, there can only be 1 item in each of the slots (as we use a Dictionary<EquipLocation, EquipableItem> to represent the contents of Equipment. This means that we can only get a value of 1 (if something is in the slot) or 0 if something is not.

This expression could be written as:

return GetItem()!=null?1:0;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms