Ejemplo n.º 1
0
    public void AddButtonFavorite()
    {
        ButtonForInventory favorite = Instantiate(magicInterface.ButtonPrefab);

        favorite.transform.SetParent(content);
        favorite.ChangeText("Favorite");
        favorite.button.onClick.AddListener(delegate { magicInterface.DisplayFavorite(); });
    }
Ejemplo n.º 2
0
    public void AddButtonFilter(SpellData spell)
    {
        ButtonForInventory otherButton = Instantiate(magicInterface.ButtonPrefab);

        otherButton.transform.SetParent(content);
        otherButton.ChangeText(spell.EnumSpellType.ToString());
        otherButton.button.onClick.AddListener(delegate { magicInterface.DisplaySpells(spell.EnumSpellType); });
    }
Ejemplo n.º 3
0
    public void AddButtonFilter(Item item)
    {
        ButtonForInventory otherButton = Instantiate(inventory.ButtonPrefab);

        otherButton.transform.SetParent(filterContent);
        otherButton.ChangeText(item.EnumItemType.ToString());
        otherButton.button.onClick.AddListener(delegate { inventory.DisplayItems(item.EnumItemType); });
    }
Ejemplo n.º 4
0
    public ButtonForInventory AddButtonAll()
    {
        ButtonForInventory button = Instantiate(magicInterface.ButtonPrefab);

        button.transform.SetParent(content);
        button.ChangeText("All");
        button.button.onClick.AddListener(delegate { magicInterface.DisplayAll(); });

        return(button);
    }
Ejemplo n.º 5
0
    public void AddButtonItem(Dictionary <Item, uint> items, Item item)
    {
        ButtonForInventory button = Instantiate(inventory.ButtonPrefab);

        button.transform.SetParent(listContent);
        button.ChangeText(items[item] > 1 ? item.ItemName + " (" + items[item] + ")" : item.ItemName);

        if (inventory.FavoriteItems.ContainsKey(item))
        {
            button.ChangeTextColor(inventory.ColorOfFavorite);
        }

        button.button.onClick.AddListener(delegate { inventory.DisplayItemCharacteristics(item, items[item]); });

        if (inventory.Player.Arsenal.HasItem(item))
        {
            button.DisplayImageEquipped();
        }
    }
Ejemplo n.º 6
0
    public void RemoveItem(Item itemToRemove)
    {
        if (!items.ContainsKey(itemToRemove))
        {
            return;
        }

        if (items[itemToRemove] > 1)
        {
            --items[itemToRemove];
            ButtonForInventory button = itemList.FindButtonInItemListWithText(itemToRemove.ItemName);
            if (button)
            {
                button.ChangeText(items[itemToRemove] > 1 ? itemToRemove.ItemName + " (" + items[itemToRemove] + ")"  : itemToRemove.ItemName);
            }
        }
        else
        {
            if (player.Arsenal.HasItem(itemToRemove))
            {
                player.Arsenal.Unequip(itemToRemove);
            }
            items.Remove(itemToRemove);
            DeleteSelectedButton();
        }

        curWeight -= itemToRemove.Weight;
        if (inventoryType == InterfaceType.PlayerInventory && curWeight < maxWeight)
        {
            player.GetComponent <CharController>().CanMove = true;
            if (onEncumberedChange != null)
            {
                onEncumberedChange();
            }
        }

        lowerBar.ChangeWeightLabel();
    }
Ejemplo n.º 7
0
    public void AddButtonSpell(SpellData spell)
    {
        if (!magicInterface)
        {
            magicInterface = transform.parent.GetComponent <MagicInterface>();
        }

        ButtonForInventory button = Instantiate(magicInterface.ButtonPrefab);

        button.transform.SetParent(content);
        button.ChangeText(spell.SpellName);

        if (magicInterface.FavoriteSpells.Contains(spell))
        {
            button.ChangeTextColor(magicInterface.ColorOfFavorite);
        }

        button.button.onClick.AddListener(delegate { magicInterface.DisplaySpellCharacteristics(spell); });

        if (magicInterface.Player.Arsenal.HasSpell(spell) != -1)
        {
            button.DisplayImageEquipped();
        }
    }