Project_WL/Assets/Script/UI/PC/Info/PCInfoStatMgrCard.cs

63 lines
1.8 KiB
C#

using TMPro;
using UnityEngine;
public class PCInfoStatMgrCard : CardBase
{
public PCInfoStatMgrCard_Stats m_PCInfoStatMgrCard_Stats;
public TextMeshProUGUI[] texts; // 0 메인스탯, 1 현재 스탯
eStat m_MainStat;
public override void Set<T>(T _base)
{
base.Set(_base);
m_MainStat = DSUtil.StringToEnum<eStat>(_base.ToString());
texts[0].text = m_MainStat.ToString();
//texts[0].color = texts[1].color = Get_MainStatColor();
//ColorUtility.TryParseHtmlString(Get_StatColor(), out Color statColor);
//texts[0].color = statColor;
Set_Detail();
Set_StatPoint();
}
void Set_Detail()
{
m_PCInfoStatMgrCard_Stats.Set(m_MainStat, Get_StatPoint());
}
int Get_StatPoint()
{
return table_classconfig.Ins.Get_PureStat(m_MainStat, ServerInfo.Ins.m_ServerData) + PCInfoStatMgrUI.Ins.Get_Stat(m_MainStat);
}
void Set_StatPoint()
{
texts[1].text = $"{table_classconfig.Ins.Get_PureStat(m_MainStat, ServerInfo.Ins.m_ServerData)}\n+({PCInfoStatMgrUI.Ins.Get_Stat(m_MainStat)})";
}
string Get_StatColor()
{
switch (m_MainStat)
{
case eStat.STR: return "#FF0000";
case eStat.DEX: return "#18ff00";
case eStat.INT: return "#0036ff";
case eStat.LUK: return "#fffc00";
}
return "#FFFFFF";
}
Color Get_MainStatColor()
{
var classData = table_classconfig.Ins.Get_Data_orNull(ServerInfo.Ins.m_ServerData.Get_EqiupmentEquip(eItem.PC));
if (m_MainStat == classData.Get_MainStatToStat())
return Color.magenta;
return Color.white;
}
public void OnClick_Stat(int add)
{
PCInfoStatMgrUI.Ins.Set_Stat(m_MainStat, add, Set_Detail);
Set_StatPoint();
}
}