Exemple #1
0
        private void RemoveItemImage(ItemInfo itemRemoved)
        {
            ItemImage itemImage = GetItemImage(itemRemoved);

            ItemImages.Remove(itemImage);
            Destroy(itemImage.gameObject);
        }
Exemple #2
0
        private void AddItemImage(ItemInfo itemAdded)
        {
            GameObject itemObject = GameObject.Instantiate(ItemImagePrefab, ItemsGroup.transform);
            ItemImage  itemImage  = itemObject.GetComponent <ItemImage>();

            itemImage.SetItem(itemAdded);
            itemImage.SetSprite(itemAdded.Sprite);
            itemImage.SetQuantityText(itemAdded.Quantity);

            ItemImages.Add(itemImage);
        }
Exemple #3
0
        private void UpdateEquipPending(ItemImage selectedItemImage, ItemInfo selectedItem)
        {
            if (PendingEquippedItem != null)
            {
                ItemImage previousEquippedImage = GetItemImage(PendingEquippedItem);
                previousEquippedImage.SetSprite(PendingEquippedItem.Sprite);
            }
            selectedItemImage.SetSprite(selectedItem.EquippedSprite);

            PendingEquippedItem = selectedItem;
        }
Exemple #4
0
        private void UpdateArrow()
        {
            Arrow.SetActive(false);
            if (SelectedItemIndex >= 0)
            {
                Arrow.SetActive(true);

                ItemImage selectedItemImage = GetItemImage(SelectedItemIndex);
                Transform arrowPoint        = selectedItemImage.ArrowPoint;

                Vector3 newArrowPosition = arrowPoint.position;
                Arrow.transform.position = newArrowPosition;
            }
        }
Exemple #5
0
        private void UpdateTexts()
        {
            if (SelectedItemIndex >= 0)
            {
                ItemImage selectedItemImage = GetItemImage(SelectedItemIndex);
                ItemBase  selectedItem      = selectedItemImage.Item;

                LocalizeScriptName.TableEntryReference        = selectedItem.VariableName;
                LocalizeScriptDescription.TableEntryReference = selectedItem.VariableName;
            }
            else
            {
                LocalizeScriptName.TableEntryReference        = "empty";
                LocalizeScriptDescription.TableEntryReference = "empty";
            }
        }
Exemple #6
0
        private void UpdateEquipUnequipPending()
        {
            ItemImage selectedItemImage = GetItemImage(SelectedItemIndex);
            ItemInfo  selectedItem      = Inventory.GetInventoryItem(selectedItemImage.Item);

            if (selectedItem.IsEquippable)
            {
                Inventory.SoundController.PlayClip(Inventory.SoundController.Seleccion);

                if (IsItemPendingEquipped(selectedItem))
                {
                    UpdateUnequipPending(selectedItemImage, selectedItem);
                }
                else
                {
                    UpdateEquipPending(selectedItemImage, selectedItem);
                }
            }
        }
Exemple #7
0
        private void UpdateItemImage(ItemInfo itemUpdated)
        {
            ItemImage itemImage = GetItemImage(itemUpdated);

            itemImage.SetQuantityText(itemUpdated.Quantity);
        }
Exemple #8
0
        private ItemImage GetItemImage(int index)
        {
            ItemImage itemImage = ItemImages.ElementAt(index);

            return(itemImage);
        }
Exemple #9
0
        private ItemImage GetItemImage(ItemBase itemInfo)
        {
            ItemImage itemImage = ItemImages.Find(temp => temp.Item.Equals(itemInfo));

            return(itemImage);
        }
Exemple #10
0
        private void UpdateUnequipPending(ItemImage selectedItemImage, ItemInfo selectedItem)
        {
            selectedItemImage.SetSprite(selectedItem.Sprite);

            PendingEquippedItem = null;
        }