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

            ItemImages.Remove(itemImage);
            Destroy(itemImage.gameObject);
        }
예제 #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);
        }
예제 #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;
        }
예제 #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;
            }
        }
예제 #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";
            }
        }
예제 #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);
                }
            }
        }
예제 #7
0
        private void UpdateItemImage(ItemInfo itemUpdated)
        {
            ItemImage itemImage = GetItemImage(itemUpdated);

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

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

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

            PendingEquippedItem = null;
        }