54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using TMPro;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
public class RelicCard : CardBase
|
||
|
|
{
|
||
|
|
public Image[] images; // 0 유물, 1 작은 유물
|
||
|
|
public GameObject go_Need; // 필요 유물 갯수 (별 없을 때)
|
||
|
|
public TextMeshProUGUI[] texts; // 0 필요 유물 갯수 (별 없을 때), 1 유물 이름
|
||
|
|
public Transform tf_starParent;
|
||
|
|
public GameObject go_star;
|
||
|
|
|
||
|
|
RelicListTableData m_Data;
|
||
|
|
List<GameObject> list_star = new List<GameObject>();
|
||
|
|
|
||
|
|
public override void Set<T>(T _base)
|
||
|
|
{
|
||
|
|
if (list_star.Count == 0)
|
||
|
|
{
|
||
|
|
var maxstar = table_GlobalValue.Ins.Get_Int("n_RelicMaxStar");
|
||
|
|
for (int i = 0; i < maxstar; i++)
|
||
|
|
list_star.Add(DSUtil.Get_Clone(go_star, tf_starParent));
|
||
|
|
}
|
||
|
|
|
||
|
|
base.Set(_base);
|
||
|
|
m_Data = _base as RelicListTableData;
|
||
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
||
|
|
var star = sdata.Get_RelicStar(m_Data.n_RelicID);
|
||
|
|
|
||
|
|
images[0].sprite = images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_RelicID);
|
||
|
|
texts[1].text = m_Data.Get_Name();
|
||
|
|
for (int i = 0; i < list_star.Count; i++)
|
||
|
|
list_star[i].SetActive(star > i);
|
||
|
|
|
||
|
|
if (star > 0)
|
||
|
|
{
|
||
|
|
go_Need.SetActive(false);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
go_Need.SetActive(true);
|
||
|
|
texts[0].text = $"{sdata.Get_ItemAmount(m_Data.n_RelicID)}/{m_Data.n_FirstOpenCost}";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TableDataBase Get_Data() { return m_Data; }
|
||
|
|
|
||
|
|
public void OnClick_Relic()
|
||
|
|
{
|
||
|
|
CollectionRelicUI.Ins.Set(m_Data);
|
||
|
|
}
|
||
|
|
}
|