68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RelicCard : CardBase
|
|
{
|
|
public Image[] images; // 0 유물, 1 bg
|
|
public GameObject go_Need; // 필요 유물 갯수 (별 없을 때)
|
|
public Slider slider_Need;
|
|
public TextMeshProUGUI[] texts; // 0 필요 유물 갯수 (별 없을 때), 1 유물 이름, 2 능력치, 3 능력치 값
|
|
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 = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_RelicID);
|
|
//images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(star > 0 ? "pet list slot" : "slot lock 3");
|
|
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}";
|
|
slider_Need.value = DSUtil.Get_SliderValue((float)sdata.Get_ItemAmount(m_Data.n_RelicID) / m_Data.n_FirstOpenCost);
|
|
}
|
|
|
|
var lvData = table_optionconfig.Ins.Get_Data(m_Data.n_DefaultOptionID);
|
|
texts[2].text = MyText.Get_StatName(lvData.e_OptionType);
|
|
texts[3].text = MyText.Get_StatValueText(lvData.e_OptionType, lvData.Get_Value(sdata.Get_RelicLv(m_Data.n_RelicID)));
|
|
|
|
Set_Selected(false);
|
|
}
|
|
|
|
public override void Set_Selected(bool active)
|
|
{
|
|
images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(active ? "slot 2" : "slot 1");
|
|
}
|
|
|
|
public override TableDataBase Get_Data() { return m_Data; }
|
|
public override int Get_IntData() { return m_Data.n_RelicID; }
|
|
|
|
public void OnClick_Relic()
|
|
{
|
|
CollectionRelicUI.Ins.Set(this);
|
|
}
|
|
} |