public void EquipSpell(int idx) { ButtonForInventory button = magicInterface.GetSelectedButton(); int equippedInIdx = magicInterface.Player.Arsenal.HasSpell(magicInterface.SelectedSpell); if (equippedInIdx != -1) { if (idx != equippedInIdx) { magicInterface.Player.Arsenal.UnequipSpell(magicInterface.SelectedSpell, equippedInIdx); magicInterface.Player.Arsenal.EquipSpell(magicInterface.SelectedSpell, idx); } else { magicInterface.Player.Arsenal.UnequipSpell(magicInterface.SelectedSpell, idx); button.HideImageEquipped(); TextEquipOrUnequip(false); } } else { magicInterface.Player.Arsenal.EquipSpell(magicInterface.SelectedSpell, idx); button.DisplayImageEquipped(); TextEquipOrUnequip(true); } magicInterface.EquippedSpellPanel.RefreshList(); }
private void Equip(Item item, ButtonForInventory button) { Item prevEquipped = inventory.Player.Arsenal.Equip(item); if (prevEquipped) { ButtonForInventory prevButton = inventory.ItemList.FindButtonInItemListWithText(prevEquipped.ItemName); if (prevButton) { prevButton.HideImageEquipped(); } } button.DisplayImageEquipped(); ItemIsEquipped(true); ChangeModifierLabel(0); ChangeParticularStat(item is Equipment ? "Armor" : "Damages", item is Equipment ? ((Equipment)item).Armor : ((WeaponData)item).Weapon.damages); }
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(); } }
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(); } }