コード例 #1
0
    public void MousePutDown(InventorySlotUI slot)
    {
        if (airItem == null)
        {
            return;
        }
        if (airItem.onActionBar)
        {
            return;
        }
        int        slotSize = SlotSize(airItem.item);
        GameObject result   = PutItemOnCoords(slot.slotX, slot.slotY, airItem.item, slotSize, airItem.UpgradeLevel);

        result.GetComponent <ItemUI>().ChangeQuantity(airItem.GetQuantity());
        if (result != null)
        {
            //if it was previously in inventory, not eq
            if ((airItem.itemX != -1) && (airItem.itemY != -1))
            {
                ClearSlot(airItem.itemX, airItem.itemY, slotSize);
            }
            else
            {
                airItem.eqPieceSlot.item   = null;
                airItem.eqPieceSlot.itemUI = null;
                airItem.eqPieceSlot        = null;
                Debug.Log("nulled items belonging to eq");
            }
            airItem.MoveObserversTo(result.GetComponent <ItemUI>());
            Destroy(airItem.gameObject);
            myUI.playerUI.UpdatePlayerStats();
        }
        airItem = null;
    }
コード例 #2
0
ファイル: ActionBarSlot.cs プロジェクト: zukerr/hidden-realm
 public void UseActionButton()
 {
     if (usableItem != null)
     {
         if (usableItem is HealthPotion)
         {
             GameObject.Find("LocalPlayer").GetComponent <PlayerRpg>().UseHealthPotion(((HealthPotion)usableItem).healthAmount);
             originalItem.ChangeQuantity(originalItem.GetQuantity() - 1);
             if (originalItem.GetQuantity() == 0)
             {
                 originalItem.DestroyObservers();
                 inventory.ClearSlot(originalItem.itemX, originalItem.itemY, 1);
                 Destroy(originalItem.gameObject);
                 //Destroy(copiedItem);
             }
         }
     }
 }
コード例 #3
0
    public static SerialItem SerializeItem(ItemUI item)
    {
        int id         = ItemsDatabase.instance.GetIndexOfItem(item.item);
        int x          = item.itemX;
        int y          = item.itemY;
        int upgradeLvl = item.UpgradeLevel;
        int quantity   = item.GetQuantity();

        return(new SerialItem(id, x, y, upgradeLvl, quantity));
    }
コード例 #4
0
ファイル: ItemUI.cs プロジェクト: zukerr/hidden-realm
 public void UpdateQuantityText()
 {
     if (!item.equipable)
     {
         if (pointerItemUI == null)
         {
             if (quantity > 0)
             {
                 stackText.text = quantity.ToString();
             }
             else
             {
                 stackText.text = "";
             }
         }
         else
         {
             stackText.text = pointerItemUI.GetQuantity().ToString();
         }
     }
 }