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();
|
}
|
}
|
}
|