98 lines
3.0 KiB
C#
98 lines
3.0 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipmentCard : CardBase
|
|
{
|
|
public Image[] images; // 0 등급, 1 아이콘
|
|
public GameObject[] gos; // 0 잠김, 1 알림
|
|
public TextMeshProUGUI[] texts; // 0 강화레벨
|
|
|
|
bool isEquipSlot;
|
|
eEquipmentParts m_Parts;
|
|
eEquipCommonPopup m_PopupType;
|
|
SD_EquipmentData m_sData;
|
|
EquipmentListTableData m_Data;
|
|
|
|
public override void Set<T>(T _base)
|
|
{
|
|
base.Set(_base);
|
|
m_sData = _base as SD_EquipmentData;
|
|
Set_UI();
|
|
}
|
|
|
|
bool isSetUI() { return m_sData.ID > 0 || m_sData.TableID > 0; }
|
|
|
|
public override void Set_UI()
|
|
{
|
|
if (isSetUI())
|
|
{
|
|
m_Data = table_EquipmentList.Ins.Get_Data(m_sData.TableID);
|
|
|
|
images[0].sprite = UIAtlasMgr.Ins.Get_Sprite($"equipment_bg_0{m_Data.n_Grade}");
|
|
images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_ID);
|
|
|
|
var udata = table_EquipmentUpgrade.Ins.Get_Data(m_Data.n_Grade);
|
|
texts[0].text = udata.n_MaxLv <= m_sData.Lv ? "Max" : $"+{m_sData.Lv}";
|
|
}
|
|
else
|
|
{
|
|
texts[0].text = "";
|
|
}
|
|
|
|
images[0].color = images[1].color = new Color(1f, 1f, 1f, isSetUI() ? 1f : 0f);
|
|
gos[0].SetActive(false);
|
|
gos[1].SetActive(false);
|
|
}
|
|
|
|
public void Set_isEquipSlot(int pcid, eEquipmentParts parts, eEquipCommonPopup commonPopup)
|
|
{
|
|
isEquipSlot = true;
|
|
m_Parts = parts;
|
|
m_PopupType = commonPopup;
|
|
|
|
if (MyValue.dic_NeedEvolution.ContainsKey(m_Parts))
|
|
gos[0].SetActive(MyValue.sdata.Get_PCEvolution(pcid) < MyValue.dic_NeedEvolution[m_Parts]);
|
|
else
|
|
gos[0].SetActive(false);
|
|
}
|
|
|
|
public override void OnClick_Card()
|
|
{
|
|
if (CardType == eUICardType.NoTouch) return;
|
|
|
|
if (isEquipSlot)
|
|
{
|
|
var pcid = LobbyUIManager.Ins.Get_MainMenu<MainMenu_Equipment>(MainMenuType.Equip).Get_SelectPCID();
|
|
switch (m_Parts)
|
|
{
|
|
case eEquipmentParts.SubWeapon:
|
|
if (MyValue.sdata.Get_PCEvolution(pcid) < 3)
|
|
{
|
|
ToastUI.Ins.Set(1000133, 3);
|
|
return;
|
|
}
|
|
break;
|
|
case eEquipmentParts.Ring:
|
|
if (MyValue.sdata.Get_PCEvolution(pcid) < 2)
|
|
{
|
|
ToastUI.Ins.Set(1000133, 2);
|
|
return;
|
|
}
|
|
break;
|
|
case eEquipmentParts.Necklace:
|
|
if (MyValue.sdata.Get_PCEvolution(pcid) < 1)
|
|
{
|
|
ToastUI.Ins.Set(1000133, 1);
|
|
return;
|
|
}
|
|
break;
|
|
default:
|
|
gos[0].SetActive(false);
|
|
break;
|
|
}
|
|
}
|
|
|
|
LobbyUIManager.Ins.Get_MainMenu<MainMenu_Equipment>(MainMenuType.Equip).m_CommonPopup.Set(m_PopupType, m_sData);
|
|
}
|
|
} |