public void ClickOnFavorite() { ButtonForInventory button = magicInterface.GetSelectedButton(); if (magicInterface.FavoriteSpells.Contains(magicInterface.SelectedSpell)) { magicInterface.FavoriteSpells.Remove(magicInterface.SelectedSpell); if (magicInterface.FavoriteDisplayed) { Destroy(button.gameObject); magicInterface.Unselect(); } else { favorite.GetComponentInChildren <Text>().text = "Favorite"; button.InitTextColor(); } return; } magicInterface.FavoriteSpells.Add(magicInterface.SelectedSpell); button.ChangeTextColor(magicInterface.ColorOfFavorite); favorite.GetComponentInChildren <Text>().text = "Unfavorite"; }
public void ClickOnFavorite() { ButtonForInventory button = itemList.FindButtonInItemListWithText(selectedItem.ItemName); if (favoriteItems.ContainsKey(selectedItem)) { favoriteItems.Remove(selectedItem); if (favoriteDisplayed) { Destroy(button.gameObject); selectedItem = null; itemCharaPanel.Hide(); lowerBar.HideButtons(); } else { lowerBar.ItemIsFavorite(false); button.InitTextColor(); } return; } favoriteItems.Add(selectedItem, 1); button.ChangeTextColor(colorOfFavorite); lowerBar.ItemIsFavorite(true); }
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(); } }