70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipItemCard : CardBase
|
|
{
|
|
public bool IsCenterEquipItem = false;
|
|
public Image[] images; // 0 등급, 1 아이템 아이콘, 2 장비 타입
|
|
public Image[] images_enchant; // 0 ~ 1 인챈트 슬롯
|
|
public TextMeshProUGUI[] texts; // 0 레벨, 1 제련
|
|
|
|
EquipItemData m_EquipItemData;
|
|
ItemListTableData m_ItemData;
|
|
EquipmentListTableData m_Data;
|
|
|
|
public override void Set<T>(T _base)
|
|
{
|
|
base.Set(_base);
|
|
m_EquipItemData = _base as EquipItemData;
|
|
if (!IsCenterEquipItem)
|
|
images[2].sprite = UIAtlasMgr.Ins.Get_Sprite($"chest_{m_EquipItemData.itemType.ToString().ToLower()}");
|
|
m_Data = table_equipitemlist.Ins.Get_Data_orNull(m_EquipItemData.id);
|
|
if (!DSUtil.CheckNull(m_Data))
|
|
{
|
|
m_ItemData = table_itemlist.Ins.Get_Data(m_EquipItemData.id);
|
|
images[1].enabled = true;
|
|
images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_ItemData.s_ItemIcon);
|
|
|
|
var smeltinglv = ServerInfo.Ins.m_ServerData.Get_SmeltingLv(m_ItemData.n_ItemID);
|
|
var slotdata = ServerInfo.Ins.m_ServerData.Get_SlotData(m_ItemData.e_ItemType);
|
|
|
|
texts[0].text = $"Lv.{slotdata.Lv}";
|
|
texts[1].text = smeltinglv.ToString();
|
|
|
|
if (!IsCenterEquipItem)
|
|
{
|
|
for (int i = 0; i < slotdata.Enchant.Count; i++)
|
|
images_enchant[i].color = table_enchantgradeconfig.Ins.Get_Color(slotdata.Enchant[i].Lv);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
texts[0].text = "Lv.0";
|
|
texts[1].text = "0";
|
|
images[1].enabled = false;
|
|
if (!IsCenterEquipItem)
|
|
{
|
|
for (int i = 0; i < images_enchant.Length; i++)
|
|
images_enchant[i].enabled = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void Set_CardType(eUICardType _type)
|
|
{
|
|
base.Set_CardType(_type);
|
|
images[0].raycastTarget = _type != eUICardType.UIEquip;
|
|
}
|
|
|
|
public void OnClick_Card()
|
|
{
|
|
PopupMgr.Ins.m_EquipmentItemPopup.Set(m_Data);
|
|
}
|
|
}
|
|
|
|
public class EquipItemData
|
|
{
|
|
public int id;
|
|
public eItem itemType;
|
|
public string key;
|
|
} |