84 lines
2.5 KiB
C#
84 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipmentSimpleCard : CardBase
|
|
{
|
|
public Image[] images; // 0 등급, 1 아이콘
|
|
public TextMeshProUGUI[] texts; // 0 보유/필요 갯수
|
|
public GameObject[] gos; // 0 선택, 1 오른쪽 화살표, 2 자식2 라인, 3 자식3 라인
|
|
public Transform[] tfs_child2, tfs_child3; // 자식 재료 위치
|
|
|
|
ItemListTableData m_ItemData;
|
|
EquipmentListTableData m_Data;
|
|
|
|
public override void Set<T>(T _base)
|
|
{
|
|
base.Set(_base);
|
|
m_ItemData = _base as ItemListTableData;
|
|
texts[0].text = "";
|
|
if (!DSUtil.CheckNull(m_ItemData))
|
|
{
|
|
m_Data = table_equipitemlist.Ins.Get_Data_orNull(m_ItemData.n_ItemID);
|
|
|
|
images[0].sprite = UIAtlasMgr.Ins.Get_GradeSprite(m_ItemData.n_ItemGrade);
|
|
images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_ItemData.s_ItemIcon);
|
|
|
|
DSUtil.InActivateGameObjects(gos);
|
|
}
|
|
else
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void Set_Child()
|
|
{
|
|
if (!DSUtil.CheckNull(m_Data))
|
|
{
|
|
var craftData = table_equipcrafting.Ins.Get_Data(m_Data.n_EquipID);
|
|
|
|
if (!DSUtil.CheckNull(craftData))
|
|
{
|
|
if (craftData.MaterialCount == 2)
|
|
{
|
|
gos[2].SetActive(true);
|
|
gos[3].SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
gos[2].SetActive(false);
|
|
gos[3].SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Set_NeedAmount(int need)
|
|
{
|
|
if (!DSUtil.CheckNull(m_ItemData))
|
|
{
|
|
var curamount = ServerInfo.Ins.m_ServerData.Get_ItemAmount(m_ItemData.n_ItemID);
|
|
if (curamount >= need)
|
|
texts[0].text = $"<color=green>{curamount}/{need}";
|
|
else
|
|
texts[0].text = $"<color=red>{curamount}/{need}";
|
|
}
|
|
}
|
|
|
|
public void Set_Select(bool active) { gos[0].SetActive(active); }
|
|
public void Set_Arrow(bool active) { gos[1].SetActive(active); }
|
|
|
|
public EquipmentListTableData Get_Data() { return m_Data; }
|
|
|
|
public void OnClick_Card()
|
|
{
|
|
switch (CardType)
|
|
{
|
|
case eUICardType.MakeMaterial:
|
|
if (m_ItemData.IsEquipItem())
|
|
PopupMgr.Ins.m_EquipmentMakePopup.Set(m_Data);
|
|
break;
|
|
}
|
|
}
|
|
} |