2024-12-15 01:39:39 +00:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class MainStatLvUpCard : CardBase
|
|
|
|
|
{
|
|
|
|
|
public Image[] sprites; // 0 메인스탯
|
2025-01-08 23:22:43 +00:00
|
|
|
public TextMeshProUGUI[] labels; // 0 레벨, 1 +스탯, 2 가격, 3 스탯명
|
2024-12-15 01:39:39 +00:00
|
|
|
public GameObject[] gos; // 0 주스탯 여부
|
|
|
|
|
|
|
|
|
|
MainStatCardData m_Data;
|
|
|
|
|
|
2025-02-08 22:22:31 +00:00
|
|
|
private void Awake() { Set_Repeat_for1sec(Set_Price); }
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
public override void Set<T>(T _base)
|
|
|
|
|
{
|
|
|
|
|
base.Set(_base);
|
|
|
|
|
m_Data = _base as MainStatCardData;
|
2025-01-08 23:22:43 +00:00
|
|
|
sprites[0].sprite = UIAtlasMgr.Ins.Get_Sprite(DSUtil.Format("{0}-upgrade-btn", m_Data.mainStatType.ToString().ToLower()));
|
2024-12-15 01:39:39 +00:00
|
|
|
var classData = table_classconfig.Ins.Get_Data_orNull(ServerInfo.Ins.m_ServerData.Get_EqiupmentEquip(eItem.PC));
|
|
|
|
|
gos[0].SetActive(classData.Get_MainStat() == m_Data.mainStatType);
|
2025-01-08 23:22:43 +00:00
|
|
|
labels[3].text = m_Data.mainStatType.ToString().ToUpper();
|
2024-12-15 01:39:39 +00:00
|
|
|
Set_UI();
|
|
|
|
|
Set_Price();
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-03 02:14:02 +00:00
|
|
|
int Get_Lv()
|
2024-12-15 01:39:39 +00:00
|
|
|
{
|
|
|
|
|
var curmap = MyValue.MyChoiceMapData;
|
2025-02-03 02:14:02 +00:00
|
|
|
int lv = curmap.Get_MapData().e_Dungeon == eDungeon.d4_Wave ? DungeonInfo.Ins.dic_WaveStat[m_Data.mainStatType] :
|
|
|
|
|
ServerInfo.Ins.m_ServerData.MapData_Get_StatLv(curmap.n_MapID, curmap.n_Difficult, m_Data.mainStatType);
|
|
|
|
|
return lv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Set_UI()
|
|
|
|
|
{
|
|
|
|
|
int lv = Get_Lv();
|
2024-12-15 01:39:39 +00:00
|
|
|
labels[0].text = $"Lv.{lv}";
|
2025-01-08 23:22:43 +00:00
|
|
|
labels[1].text = $"{lv}"; // TODO 정인호 : 레벨당 스탯1 임시
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Set_Price()
|
|
|
|
|
{
|
|
|
|
|
var price = Get_Price();
|
|
|
|
|
labels[2].text = NumberFormatter.FormatNumber(price);
|
2025-02-03 02:14:02 +00:00
|
|
|
|
|
|
|
|
bool canLvUp = false;
|
|
|
|
|
var curmap = MyValue.MyChoiceMapData;
|
|
|
|
|
if (curmap.Get_MapData().e_Dungeon == eDungeon.d4_Wave)
|
|
|
|
|
canLvUp = DungeonInfo.Ins.WaveGold >= price;
|
2024-12-15 01:39:39 +00:00
|
|
|
else
|
2025-03-03 23:58:34 +00:00
|
|
|
canLvUp = ServerInfo.Ins.m_ServerData.Check_ItemAmount(2, price, false);
|
2024-12-15 01:39:39 +00:00
|
|
|
|
2025-02-03 02:14:02 +00:00
|
|
|
if (canLvUp) labels[2].color = Color.black;
|
|
|
|
|
else labels[2].color = Color.red;
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-03 02:14:02 +00:00
|
|
|
int Get_Price() { return (Get_Lv() + 1) * 100; }
|
|
|
|
|
|
2024-12-15 01:39:39 +00:00
|
|
|
public void OnClick_LvUp()
|
|
|
|
|
{
|
2025-02-03 02:14:02 +00:00
|
|
|
var price = Get_Price();
|
|
|
|
|
var curmap = MyValue.MyChoiceMapData;
|
|
|
|
|
if (curmap.Get_MapData().e_Dungeon == eDungeon.d4_Wave)
|
|
|
|
|
{
|
|
|
|
|
if (DungeonInfo.Ins.WaveGold >= price)
|
|
|
|
|
{
|
|
|
|
|
DungeonInfo.Ins.Add_WaveGold(-price);
|
|
|
|
|
++DungeonInfo.Ins.dic_WaveStat[m_Data.mainStatType];
|
|
|
|
|
DungeonInfo.Ins.dic_WaveStat[m_Data.mainStatType].RandomizeCryptoKey();
|
|
|
|
|
Set_UI();
|
|
|
|
|
Set_Price();
|
2025-02-04 00:37:17 +00:00
|
|
|
MyValue.Get_ActorStatInfoorNull(eRole.PC, true, "0", 0, true);
|
2025-02-03 02:14:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2024-12-15 01:39:39 +00:00
|
|
|
{
|
2025-02-03 02:14:02 +00:00
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
2025-03-03 23:58:34 +00:00
|
|
|
if (sdata.Check_ItemAmount(2, Get_Price()))
|
2025-02-03 02:14:02 +00:00
|
|
|
{
|
2025-03-03 23:58:34 +00:00
|
|
|
sdata.Use_Item(2, price);
|
2025-02-03 02:14:02 +00:00
|
|
|
sdata.MapData_Add_StatLv(curmap.n_MapID, curmap.n_Difficult, m_Data.mainStatType);
|
|
|
|
|
Set_UI();
|
|
|
|
|
Set_Price();
|
2024-12-15 01:39:39 +00:00
|
|
|
|
2025-02-11 23:22:40 +00:00
|
|
|
if (MyInfoUI.isIns) MyInfoUI.Ins.Set_MainStats();
|
2025-02-03 02:14:02 +00:00
|
|
|
}
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|