private void UpdateTooltipText(HotBarItem item)
        {
            sb.Append("<size=35>").Append(item.ColouredName).Append("</size>").AppendLine();
            sb.Append(item.GetInfoDisplayText());

            UpdateTooltipText(sb.ToString());
            sb.Clear();
        }
Ejemplo n.º 2
0
 public void Add(HotBarItem itemToAdd)
 {
     foreach (var slot in hotbarSlots)
     {
         if (slot.AddItem(itemToAdd))
         {
             return;
         }
     }
 }
        // on item drop or item trash
        public bool RemoveSpellCast(HotBarItem baseItem)
        {
            SpellBookItem key = null;

            if (ReferenceEquals(baseItem, null) || ReferenceEquals(key = baseItem as SpellBookItem, null))
            {
                return(false);
            }

            return(existingSpellCasts.Remove(key));
        }
Ejemplo n.º 4
0
        public void ProcessUnEquip(HotBarItem item)
        {
            var equippable = (EquippableItem)item;

            if (ReferenceEquals(equippable, null))
            {
                return;
            }

            Debug.Log("Processing unequip");
            statsSystem.RemoveModifierFrom(equippable.StatType, equippable.StatModifier);
        }
    // Use this for initialization
    void Start()
    {
        //build options. Just set keybinds to trigger onSelect, which we assign below. This will select the item to build, then we just need to listen for either a left click or a cancel.
        keybinds.Add(new KeyBind(0, "f1", null, () =>
        {
            hotBar1[0].onSelect();
        }));
        keybinds.Add(new KeyBind(0, "f2", null, () =>
        {
            hotBar1[1].onSelect();
        }));
        keybinds.Add(new KeyBind(0, "f3", null, () =>
        {
            hotBar1[2].onSelect();
        }));
        keybinds.Add(new KeyBind(0, "f4", null, () =>
        {
            hotBar1[3].onSelect();
        }));



        //initialize hotbar GUI stuff
        for (int i = 0; i < hotBar1.Count; i++)
        {
            int x = i;
            //set up onselect, actual assignment of currentHotBar1Item, and ondeselect using a persistant local scope variable because delegates
            hotBar1[i].onSelect = () => {
                if (currentHotBar1Item != null)
                {
                    HotBarGUIDeselectEffect1(currentHotBar1Item);
                }
                currentHotBar1Item = hotBar1[x];
                HotBarGUISelectEffect1(currentHotBar1Item);
                ShowBlueprint();
            };
            //try to find keybind, then show in GUI
            for (int y = 0; y < keybinds.Count; y++)
            {
                if (keybinds[y].action == hotBar1[i].action && keybinds[y].castButton == null)                       //if the same action, this is the keybind, show it in GUI && castButton isn't set (it set itself up) should probably revamp this loop later....
                {
                    hotBar1[i].obj.GetChild(0).GetChild(0).GetChild(2).GetComponent <Text>().text = keybinds[y].key; //assign text
                }
            }
        }
    }
        public void TryEquipSpell(HotBarItem hotBarItem)
        {
            if (!enabled)
            {
                return;
            }

            SpellBookItem spellItem = default;

            var isSpell = !ReferenceEquals(hotBarItem, null) &&
                          !ReferenceEquals(spellItem = hotBarItem as SpellBookItem, null);

            if (!isSpell)
            {
                return;
            }

            var equippedSpellExists = !ReferenceEquals(equippedSpellCastBase, null);

            if (equippedSpellExists && equippedSpellCastBase.IsCasting)
            {
                return;
            }

            if (!equippedSpellExists)
            {
                Equip(spellItem);
            }
            else
            {
                var dataIsEqual = ReferenceEquals(equippedSpellCastBase.Data, spellItem.SpellCastData) &&
                                  ReferenceEquals(equippedSpellCastBase.Element, spellItem.SpellElement);
                if (dataIsEqual)
                {
                    return;
                }

                UnEquip();
                Equip(spellItem);
            }

            onSpellChange?.Invoke();
        }