コード例 #1
0
 public bool AddItem(Item item)
 {
     if (_crafter.AddItem(item))
     {
         var ip = Instantiate(ItemPrefab, SlotParent).GetComponent <ItemDragHandler>();
         ip.Item      = item;
         ip.Crafter   = this;
         ip.Inventory = _inventory;
         ip.InCraft   = true;
         ip.OnDrop    = () =>
         {
             _crafter.RemoveItem(ip.Item);
             Destroy(ip.gameObject);
         };
         ip.OnDispose = () =>
         {
             _crafter.RemoveItem(ip.Item);
             Destroy(ip.gameObject);
         };
         ip.Init();
         return(true);
     }
     AboveText.Show("cannon full", 2, Color.red);
     return(false);
 }