Exemple #1
0
    public void UpdateSpells(SpellData[] spells)
    {
        spellCanvasGroup.alpha = 1;

        int       i, j, il, jl;
        SpellData spell;
        Button    spellButton;
        Text      spellText;

        for (i = 0, il = spells.Length; i < il; i++)
        {
            spell = spells[i];
            if (spell == null)
            {
                break;
            }
            spellButton = spellButtons[i];
            spellButton.GetComponent <CanvasGroup>().alpha = 1;
            spellButton.interactable = true;
            spellButton.image.sprite = spell.icon;

            spellButton.onClick.RemoveAllListeners();
            int id = spell.id;
            spellButton.onClick.AddListener(() => UpdateSpellInfo(id));

            for (j = 0, jl = _callbacks.Count; j < jl; j++)
            {
                SpellButtonCallback callback = _callbacks[j];
                spellButton.onClick.AddListener(() => callback(id));
            }
        }
    }
Exemple #2
0
 public void AddSpellButtonCallback(SpellButtonCallback callback)
 {
     _callbacks.Add(callback);
 }