예제 #1
0
        public override bool Equals(object other)
        {
            ItemScriptable otherHolder = other as ItemScriptable;

            return(otherHolder != null
                ? Item.ID == otherHolder.Item.ID
                : this == null);
        }
 void ISerializationCallbackReceiver.OnAfterDeserialize()
 {
     (itemHolder as ISerializationCallbackReceiver)?.OnAfterDeserialize();
     Slot = new ItemSlot(type, itemHolder?.Item)
     {
         OnItemChanged = () => {
             itemHolder = Slot.HasItem() ? itemDatabase.GetItemHolder(Slot.StoredItem.ID) : null;
             RefreshUI();
         }
     };
 }
 public ItemScriptable GetItemHolder(Predicate <ItemScriptable> match)
 {
     foreach (var kvp in itemDatabaseMap)
     {
         ItemScriptable holder = kvp.Value;
         if (match(holder))
         {
             return(holder);
         }
     }
     return(null);
 }