Exemple #1
0
    public void Describe(OnUIItemDescribeEventData e)
    {
        EquipmentDescription n = Instantiate(DescriptionPrefab);

        n.GetComponent <RectTransform>().SetParent(e.DescriptionParent, false);
        n.TopDescription.text    = TopDescription;
        n.BottomDescription.text = BottomDescription;
        foreach (PlayerUIStatModifier stat in StatBonuses)
        {
            EquipmentDescriptionStatChange s = Instantiate(StatLinePrefab);
            s.Image.sprite = stat.Icon;
            s.Text.text    = stat.Description;
            n.AddStatChange(s);
        }
    }
    public void AddStatChange(float statFrom, float statChange, Sprite withIcon)
    {
        EquipmentDescriptionStatChange statChangeUI = Instantiate(StatChangePrefab);

        statChangeUI.transform.SetParent(transform, false);
        statChangeUI.Image.sprite = withIcon;
        string colorTag      = "";
        string colorCloseTag = "";

        if (statChange < 0)
        {
            colorTag      = "<color=#f00f>";
            colorCloseTag = "</color>";
        }
        else if (statChange > 0)
        {
            colorTag      = "<color=#0f0f>";
            colorCloseTag = "</color>";
        }
        statChangeUI.Text.text = colorTag + statFrom + " -> " + (statFrom + statChange) + colorCloseTag;
    }
 public void AddStatChange(EquipmentDescriptionStatChange stat)
 {
     stat.transform.SetParent(StatChangesRoot, false);
     StatChanges.Add(stat);
 }