54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
|
|
public class HeartItem : MonoBehaviour
|
|
{
|
|
public GameObject BackOnSel;
|
|
public GameObject SelectObj;
|
|
public Text Name;
|
|
public Text Add;
|
|
public Text Cost;
|
|
public GameObject Up;
|
|
public GameObject EffectObj;
|
|
|
|
public void InitData(Tab_HeartAttr heart)
|
|
{
|
|
int heartLevel = MeridiaSoulData.Instance.GetHeartLevel(heart.Id);
|
|
int HeartLevelID = heart.Id * 1000000 + MeridiaSoulData.Instance.HeartClass * 1000 + heartLevel;
|
|
Tab_HeartLevel HeartLevelTab = TableManager.GetHeartLevelByID(HeartLevelID, 0);
|
|
if (HeartLevelTab == null)
|
|
return;
|
|
Tab_HeartLevel HeartLevelTabNext = TableManager.GetHeartLevelByID(HeartLevelID + 1, 0);
|
|
int count = HeartSoul.GetLearnMaxLevel(heart.Id);
|
|
Name.text = string.Format("<color=#efefefff>{0}</color>(<color=#59ee60ff>{1}/{2}</color>)", heart.Name, heartLevel, count);
|
|
if (HeartLevelTabNext != null)
|
|
{
|
|
Add.text = string.Format("<color=#efefefff>+{0}{1}</color>", HeartLevelTabNext.AttrValue1, PropID.GetAttrName((PropID.PropertyID)HeartLevelTabNext.AttrId1));
|
|
}
|
|
else
|
|
Add.text = string.Format("<color=#efefefff>+{0}{1}</color>", HeartLevelTab.AttrValue1, PropID.GetAttrName((PropID.PropertyID)HeartLevelTab.AttrId1));
|
|
Up.SetActive(HeartLevelTab.LevelSoulCount <= MeridiaSoulData.Instance.HeartCount && heartLevel < count);
|
|
if(MeridiaSoulData.Instance.HeartCount >= HeartLevelTab.LevelSoulCount)
|
|
{
|
|
Cost.text = string.Format("<color=#feff88ff>{0}</color>", StrDictionary.GetClientDictionaryString("#{47411}", HeartLevelTab.LevelSoulCount));
|
|
}
|
|
else
|
|
{
|
|
Cost.text = string.Format("<color=#f74b4bff>{0}</color>", StrDictionary.GetClientDictionaryString("#{47411}", HeartLevelTab.LevelSoulCount));
|
|
}
|
|
|
|
EffectObj.SetActive(heartLevel == count);
|
|
|
|
}
|
|
|
|
public void OnSelect(bool state)
|
|
{
|
|
BackOnSel.SetActive(!state);
|
|
SelectObj.SetActive(state);
|
|
}
|
|
|
|
} |