using UnityEngine;
|
|
public class PhantasmPavilionInfoCell : MonoBehaviour
|
{
|
[SerializeField] TextEx txtUnLockInfo;
|
[SerializeField] TextEx txtAddInfo;
|
[SerializeField] TextEx txtAddNext;
|
PhantasmPavilionManager manager { get { return PhantasmPavilionManager.Instance; } }
|
public void Display(int index, CellView cellView)
|
{
|
int id = cellView.info.Value.infoInt1;
|
PhantasmPavilionType type = manager.nowType;
|
int[] attrIDList = manager.GetAttrIDList(type, id);
|
int[] initAttrValueList = manager.GetInitAttrValueList(type, id);
|
if (attrIDList.IsNullOrEmpty() || initAttrValueList.IsNullOrEmpty()
|
|| attrIDList.Length != initAttrValueList.Length || attrIDList.Length <= index)
|
{
|
txtUnLockInfo.SetActive(false);
|
txtAddInfo.SetActive(false);
|
txtAddNext.SetActive(false);
|
return;
|
}
|
|
int attrID = attrIDList[index];
|
int attrValue = initAttrValueList[index];
|
bool isHasAttr = manager.HasInitAttr(type, id); // 是否有解锁属性
|
bool isCanStarAdd = manager.HasStarAddAttr(type, id); // 是否可升星
|
bool isStarMax = manager.IsStarMax(type, id); // 是否已升满
|
PhantasmPavilionState state = manager.GetUnLockState(type, id);
|
txtUnLockInfo.SetActive(state != PhantasmPavilionState.Activated || (state == PhantasmPavilionState.Activated && isHasAttr && !isCanStarAdd));
|
txtAddInfo.SetActive(state == PhantasmPavilionState.Activated && isHasAttr && isCanStarAdd);
|
txtAddNext.SetActive(state == PhantasmPavilionState.Activated && isHasAttr && isCanStarAdd && !isStarMax);
|
if (isHasAttr)
|
{
|
txtUnLockInfo.text = PlayerPropertyConfig.GetFullDescription(attrID, attrValue);
|
}
|
|
if (isCanStarAdd)
|
{
|
int addValue = manager.GetEndAttrValue(type, id, index);
|
txtAddInfo.text = PlayerPropertyConfig.GetFullDescription(attrID, addValue);
|
}
|
|
if (isCanStarAdd && !isStarMax)
|
{
|
int[] attrPerStarAddList = manager.GetAttrPerStarAddList(type, id);
|
if (attrPerStarAddList.IsNullOrEmpty() || attrIDList.Length != initAttrValueList.Length || attrPerStarAddList.Length <= index)
|
return;
|
int attrPerStarAdd = attrPerStarAddList[index];
|
txtAddNext.text = Language.Get("PhantasmPavilion12", UIHelper.AppendColor(TextColType.LightGreen, StringUtility.Contact("+", PlayerPropertyConfig.GetValueDescription(attrID, attrPerStarAdd))));
|
}
|
}
|
|
}
|