Ejemplo n.º 1
0
    public void ItemAdded(Item item)
    {
        InventoryUIItem emptyItem = Instantiate(itemContainer);

        emptyItem.SetItem(item);
        emptyItem.transform.SetParent(scrollViewContent);
    }
Ejemplo n.º 2
0
    void ItemAddToCharacterViewer(Item item)
    {
        InventoryUIItem emptyItem = Instantiate(itemContainer);

        emptyItem.SetItem(item);
        if (item.TwoHanded)
        {
            characterViewer.Find("Equipment").Find("Equip_Blank").gameObject.SetActive(true);
            characterViewer.Find("Equipment").Find("Equip_Left").gameObject.SetActive(false);
        }
        switch (item.ObjectSlug)
        {
        case "sword":
            emptyItem.transform.SetParent(characterViewer.Find("Equipment").Find("Equip_Right").GetComponent <RectTransform>());
            break;

        case "staff":
            emptyItem.transform.SetParent(characterViewer.Find("Equipment").Find("Equip_Right").GetComponent <RectTransform>());
            break;

        default:
            Debug.Log("no");
            break;
        }
    }
Ejemplo n.º 3
0
    void LootItem(List <Item> items)
    {
        CleanUp(lootWindow);
        looting = items;
        if (looting.Count == 0)
        {
            isLootingOn = false;
            lootPanel.gameObject.SetActive(isLootingOn);
            UIEventHandler.ItemLooted();
        }
        foreach (Item item in looting)
        {
            isLootingOn = true;
            lootPanel.gameObject.SetActive(isLootingOn);
            if (viewerVisible)
            {
                ToggleViewer();
            }

            itemName.text = item.ItemName;
            InventoryUIItem emptyItem = Instantiate(lootItemContainer);
            currentSelectedItem = item;
            emptyItem.SetItem(item);
            emptyItem.transform.SetParent(lootWindow);
        }
    }
    public void ItemAdded(Item item)
    {
        Debug.Log("Adding Item: " + item.ItemName);
        InventoryUIItem emptyItem = Instantiate(itemContainer);

        emptyItem.SetItem(item);
        emptyItem.transform.SetParent(scrollViewContent);
    }
Ejemplo n.º 5
0
    private void AddItemRepresentation(Item item)
    {
        //Debug.Log("Inventory UI adding item with uuid: " + item.Uuid + "Items in map: " + uuidToPrefab.Count);
        InventoryUIItem emptyItem = Instantiate(itemContainer);

        emptyItem.SetItem(item);
        emptyItem.transform.SetParent(scrollViewContent, false);
        uuidToPrefab[item.Uuid] = emptyItem.gameObject;
        UpdateItemNumbersUI();
    }
Ejemplo n.º 6
0
    public void ItemAdded(Item item)
    {
        InventoryUIItem emptyItem = Instantiate(itemContainer, scrollViewContent);

        emptyItem.transform.localPosition = new Vector3(1, 1, 1);
        emptyItem.SetItem(item);
        // emptyItem.transform.SetParent(scrollViewContent);
        scrollViewContent.sizeDelta = new Vector2(scrollViewContent.rect.width, scrollViewContent.rect.height + itemContainer.GetComponent <RectTransform>().rect.height);
        emptyItem.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
    }
Ejemplo n.º 7
0
    public void ItemAdded(Item item)
    {
        InventoryUIItem emptyItem = Instantiate(itemContainer);

        emptyItem.SetItem(item);
        if (item.TwoHanded && InventoryController.isEquipped)
        {
            characterViewer.Find("Equipment").Find("Equip_Blank").gameObject.SetActive(false);
            characterViewer.Find("Equipment").Find("Equip_Left").gameObject.SetActive(true);
        }
        emptyItem.transform.SetParent(scrollViewContent);
    }
Ejemplo n.º 8
0
    private void UpdateInventory(Item item)
    {
        int itemCount = PlayerInventory.Instance.GetItemCount(item.GetItemID());

        if (itemCount > 1)
        {
            viewContent.Find("item_id:" + item.GetItemID()).GetComponent <InventoryUIItem>().number.text = itemCount.ToString();
        }
        else
        {
            InventoryUIItem emptyItem = Instantiate(itemContainer);
            emptyItem.SetItem(item);
            emptyItem.name = "item_id:" + item.GetItemID().ToString();
            emptyItem.transform.SetParent(viewContent);
        }
        UpdateInventorySize();
    }
 public void ItemAdded(Item item)
 {
     if (item.Stackable && CheckIfItemIsInInventory(item))
     {
         for (int i = 0; i < itemUIList.Count; i++)
         {
             if (itemUIList[i].item == item)
             {
                 itemUIList[i].UpdateCount();
             }
         }
     }
     else if (!item.Stackable || !CheckIfItemIsInInventory(item))
     {
         InventoryUIItem emptyItem = Instantiate(ItemContainer);
         emptyItem.SetItem(item);
         itemUIList.Add(emptyItem);
         emptyItem.transform.SetParent(itemHolder);
         emptyItem.transform.localScale = new Vector3(1f, 1f, 1f);
         inventoryButtons.Add(emptyItem.GetComponent <Button>());
     }
 }