yyl
29 分钟以前 3b3ef59aef93a240eb2f9f40a0715f7253f14d6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using UnityEngine;
 
public class HeroFatesUpgradeAttrCell : MonoBehaviour
{
    [SerializeField] TextEx txtAttrName;
    [SerializeField] TextEx txtAttrFromValue;
    [SerializeField] TextEx txtAttrToValue;
    [SerializeField] ImageEx imgAdd;
    [SerializeField] UIEffectPlayer uIEffectPlayer1;
    [SerializeField] UIEffectPlayer uIEffectPlayer2;
    HeroFatesManager manager { get { return HeroFatesManager.Instance; } }
 
    public void Display(int index, CellView cell, bool isPlayer = false)
    {
        uIEffectPlayer1.Stop();
        uIEffectPlayer2.Stop();
        int fatesID = cell.info.Value.infoInt1;
 
        if (!manager.TryGetAttrIDListAndLVAttrValueList(fatesID, out int[] attrIDList, out int[] lvAttrValueList))
            return;
        if (index < 0 || index >= attrIDList.Length)
            return;
        int attrID = attrIDList[index];
        long attrValue = lvAttrValueList[index];
        if (!PlayerPropertyConfig.HasKey(attrID))
            return;
        PlayerPropertyConfig config = PlayerPropertyConfig.Get(attrID);
        txtAttrName.text = config.ShowName;
 
        long fromValue = manager.GetNowAttrValue(fatesID, index);
        txtAttrFromValue.text = PlayerPropertyConfig.GetValueDescription(attrID, fromValue);
        long toValue = manager.GetNextAttrValue(fatesID, index);
        txtAttrToValue.text = PlayerPropertyConfig.GetValueDescription(attrID, toValue);
 
        imgAdd.SetActive(toValue > fromValue);
 
        if (isPlayer)
        {
            uIEffectPlayer1.Play();
            uIEffectPlayer2.Play();
        }
    }
}