Esempio n. 1
0
    public void UpdateBuy(List <string> buyableSpells)
    {
        foreach (VendorButton ib in buyButtons)
        {
            RemoveUIObj(ib);
        }
        buyButtons = new VendorButton[buyableSpells.Count];
        bool buyPossible = pawn.GetSpells().Length < pawn.SpellSlotCount.GetValue();
        int  height      = 28 * buyableSpells.Count + (4 * (buyableSpells.Count - 1));
        int  yStart      = size.height / 2 - height / 2;

        for (int i = 0; i < buyButtons.Length; i++)
        {
            string spellId = buyableSpells[i];
            buyButtons[i] = new VendorButton(Spells.Get(spellId), new Vector2i(size.width / 4, yStart + i * 32), true, !buyPossible || pawn.DoesKnowSpell(spellId));
            AddUIObj(buyButtons[i]);
        }
        buyHeader.SetPosition(new Vector2i(size.width / 4, yStart - 10));
    }