Ejemplo n.º 1
0
    void InitializeStats()
    {
        _lists = new Transform[] { _offensiveList, _defensiveList, _miscList, _attributeList, _vitalList };

        for (int i = 0; i < _lists.Length; i++)
        {
            int a = i;

            _lists[i].parent.Find("subHeader").GetComponent <GenericPointerHandler>().Initialize(
                null,
                () => ToggleList(_lists[a], _lists[a].parent.Find("subHeader/toggle").GetComponent <RectTransform>()),
                null,
                null,
                null);
        }

        _statItems      = new GameObject[Enum.GetNames(typeof(StatType)).Length];
        _attributeItems = new GameObject[Enum.GetNames(typeof(AttributeType)).Length];
        _vitalItems     = new GameObject[Enum.GetNames(typeof(VitalType)).Length];

        for (int i = 0; i < _attributeItems.Length; i++)
        {
            int a = i;

            _attributeItems[a] = CreateValueHeaderItem(
                ((AttributeType)a).ToString(),
                Player.selectedActor.data.GetAttribute((AttributeType)a).value.ToString(),
                Attribute.ToColor((AttributeType)a),
                _attributeList,
                () => Tooltip.Open(Player.selectedActor.data.GetAttribute((AttributeType)a).GetTooltip()),
                null,
                null,
                null,
                () => Tooltip.Close());

            _attributeItems[a].transform.Find("levelup").GetComponent <GenericPointerHandler>().Initialize(
                null,
                null,
                null,
                null,
                null);
            _attributeItems[a].transform.Find("levelup").gameObject.SetActive(false);
        }
        for (int i = 0; i < _vitalItems.Length; i++)
        {
            int a = i;

            _vitalItems[a] = CreateValueHeaderItem(
                ((VitalType)i).ToString(),
                Player.selectedActor.data.GetVital((VitalType)i).current + " / " + Player.selectedActor.data.GetVital((VitalType)i).GetMax(),
                Vital.ToColor((VitalType)i),
                _vitalList,
                () => Tooltip.Open(Player.selectedActor.data.GetVital((VitalType)a).ToTooltip()),
                null,
                null,
                null,
                () => Tooltip.Close());
        }
        for (int i = 0; i < Enum.GetNames(typeof(StatType)).Length; i++)
        {
            Stat s = Player.selectedActor.data.GetStat((StatType)i);

            _statItems[i] = CreateValueHeaderItem(
                s.GetHeader(),
                s.GetValueFormatted(),
                s.category == StatCategory.Offensive ? Color.red : (s.category == StatCategory.Defensive ? Color.blue : Color.yellow),
                s.category == StatCategory.Offensive ? _offensiveList : (s.category == StatCategory.Defensive ? _defensiveList : _miscList),
                () => Tooltip.Open(s.ToTooltip()),
                null,
                null,
                null,
                () => Tooltip.Close());
        }
    }
Ejemplo n.º 2
0
 void OnActorVitalChanged(Actor a, VitalType vt)
 {
     UpdateVital(_items[a].transform.Find(vt.ToString().ToLower()), a.data.GetVital(vt).current, a.data.GetVital(vt).GetMax(), Vital.ToColor(vt));
 }