Files
JJBB/Assets/Project/Script/GUI/MeridiaSoul/UIItem/MeridiaSoulPoint.cs
2024-08-23 15:49:34 +08:00

132 lines
4.8 KiB
C#

using UnityEngine;
using GCGame.Table;
using UnityEngine.UI;
using Games.GlobeDefine;
using GCGame;
public class MeridiaSoulPoint : MonoBehaviour
{
public Animator BreakPointIcon;
public Text BreakPointLevel;
public Text BreakPointPay;
public GameObject BreakPointEffect;
public GameObject BreakPointEffectUp;
public GameObject BreakPointUp;
private string m_currCrossFade = "";
private void OnEnable()
{
if(string.IsNullOrEmpty(m_currCrossFade)==false)
BreakPointIcon.CrossFade(m_currCrossFade, 0);
AddChildAsset childAsset = BreakPointEffectUp.GetComponent<AddChildAsset>();
if (childAsset != null)
childAsset.LoadAsset();
}
private int m_VeinID = -1;
public int ShowInfo(int VeinID, int nodeID,int openLevel)
{
if(m_VeinID!=-1 && m_VeinID!=VeinID)
{
Clear();
}
m_VeinID = VeinID;
ShowNodeModel(VeinID, nodeID);
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < openLevel)
{
BreakPointLevel.text = string.Format("<color=#ce0101ff>{0}</color>", StrDictionary.GetClientDictionaryString("#{46001}", openLevel));
BreakPointPay.gameObject.SetActive(false);
BreakPointUp.SetActive(false);
BreakPointEffect.SetActive(false);
//BreakPointEffectUp.SetActive(false);
return -1;
}
MeridiaSoulData.VeinNodeData VeinData = MeridiaSoulData.Instance.GetNodeData(VeinID, nodeID);
int _NodeID = nodeID;
nodeID *= 1000;
if (VeinData != null)
{
nodeID += VeinData.level;
Tab_BloodVeinNode nodeNext = TableManager.GetBloodVeinNodeByID(nodeID + 1, 0);
if (nodeNext == null)
{
BreakPointLevel.text = string.Format("<color=#ce0101ff>{0}</color>", StrDictionary.GetClientDictionaryString("#{25125}"));
BreakPointUp.SetActive(false);
BreakPointPay.gameObject.SetActive(false);
BreakPointEffect.SetActive(true);
//BreakPointEffectUp.SetActive(false);
return nodeID;
}
BreakPointLevel.text = StrDictionary.GetClientDictionaryString("#{1063}", VeinData.level);
BreakPointUp.SetActive(MeridiaSoulData.Instance.NodeCanUp(VeinID, _NodeID));
BreakPointEffect.SetActive(true);
}
else
{
BreakPointLevel.text = StrDictionary.GetClientDictionaryString("#{1063}", 0);
BreakPointUp.SetActive(MeridiaSoulData.Instance.NodeCanUp(VeinID, _NodeID));
BreakPointEffect.SetActive(false);
}
BreakPointPay.gameObject.SetActive(true);
Tab_BloodVeinNode node = TableManager.GetBloodVeinNodeByID(nodeID, 0);
if (node == null)
{
BreakPointPay.gameObject.SetActive(false);
return -1;
}
else
{
long hasCount0 = Utils.GetConstHas(node.GetCostTypebyIndex(0), node.GetCostSubbyIndex(0));
long hasCount1 = Utils.GetConstHas(node.GetCostTypebyIndex(1), node.GetCostSubbyIndex(1));
if (hasCount0 >= node.GetCostValbyIndex(0))
{
BreakPointPay.text = string.Format("{0}:<color=#fcfd85ff>{1}</color>", Utils.GetConstName(node.GetCostTypebyIndex(0), node.GetCostSubbyIndex(0)), node.GetCostValbyIndex(0));
}
else
{
if (hasCount1 >= node.GetCostValbyIndex(1))
BreakPointPay.text = string.Format("{0}:<color=#fcfd85ff>{1}</color>", Utils.GetConstName(node.GetCostTypebyIndex(1), node.GetCostSubbyIndex(1)), node.GetCostValbyIndex(1));
else
BreakPointPay.text = string.Format("{0}:<color=#d92109ff>{1}</color>", Utils.GetConstName(node.GetCostTypebyIndex(1), node.GetCostSubbyIndex(1)), node.GetCostValbyIndex(1));
}
return nodeID;
}
}
public void Clear()
{
BreakPointEffectUp.SetActive(false);
m_currCrossFade = "";
}
public void UPLevel()
{
BreakPointEffectUp.SetActive(true);
}
public void OnDisable()
{
BreakPointEffectUp.SetActive(false);
}
public void ShowNodeModel(int VeinID, int nodeID)
{
m_currCrossFade = "";
MeridiaSoulData.VeinNodeData VeinData = MeridiaSoulData.Instance.GetNodeData(VeinID, nodeID);
nodeID *= 1000;
if (VeinData != null)
{
nodeID += VeinData.level;
}
Tab_BloodVeinNode node = TableManager.GetBloodVeinNodeByID(nodeID, 0);
if (node == null)
{
return;
}
BreakPointIcon.CrossFade(node.Icon, 0);
m_currCrossFade = node.Icon;
}
}