62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class FarmFarmerCard : CardBase
|
|
{
|
|
public Image[] images; // 0 등급, 1 일꾼, 2 상태
|
|
public TextMeshProUGUI[] texts; // 0 이름, 1 상태
|
|
|
|
static Color32 textColor = new Color32(45, 48, 98, 255);
|
|
FarmerListTableData m_Data;
|
|
|
|
public override void Set<T>(T _base)
|
|
{
|
|
base.Set(_base);
|
|
m_Data = _base as FarmerListTableData;
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
//images[0].sprite = UIAtlasMgr.Ins.Get_GradeSprite(m_Data.Get_Grade());
|
|
images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_FarmerID);
|
|
texts[0].text = m_Data.Get_Name();
|
|
|
|
if (sdata.Get_EqiupmentEquip(eItem.Farmer) == m_Data.n_FarmerID)
|
|
{ // 장착중
|
|
texts[1].text = table_localtext.Ins.Get_Text(207);
|
|
texts[1].color = textColor;
|
|
images[2].sprite = UIAtlasMgr.Ins.Get_Sprite("label 5");
|
|
}
|
|
else if (sdata.IsObtainItem(m_Data.n_FarmerID))
|
|
{ // 보유중
|
|
texts[1].text = table_localtext.Ins.Get_Text(402);
|
|
texts[1].color = textColor;
|
|
images[2].sprite = UIAtlasMgr.Ins.Get_Sprite("label 3");
|
|
}
|
|
else
|
|
{ // 미보유
|
|
texts[1].text = table_localtext.Ins.Get_Text(208);
|
|
texts[1].color = Color.white;
|
|
images[2].sprite = UIAtlasMgr.Ins.Get_Sprite("label 3 black");
|
|
}
|
|
|
|
Set_Selected(false);
|
|
}
|
|
public override void Set(int _val)
|
|
{
|
|
if (m_Data.n_FarmerID == _val)
|
|
OnClick_Select();
|
|
}
|
|
|
|
public override void Set_Selected(bool active)
|
|
{
|
|
images[0].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_FarmerID; }
|
|
|
|
public void OnClick_Select()
|
|
{
|
|
FarmFarmerUI.Ins.Set_SelectCard(this);
|
|
}
|
|
} |