64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class PCInfoUI_Center : UI3DModel
|
|
{
|
|
public PetCard m_MyPet;
|
|
public TextMeshProUGUI[] texts; // 0 코스튬 이름, 1 코스튬 대사
|
|
public GameObject[] gos; // 0 코스튬 착용 버튼
|
|
|
|
public int CostumeIdWhenEnter;
|
|
public bool firstInit = false;
|
|
|
|
CardBase SelectCard;
|
|
|
|
public void Set(CardBase choiceCard)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
if (!DSUtil.CheckNull(SelectCard))
|
|
SelectCard.Set_Selected(false);
|
|
|
|
SelectCard = choiceCard;
|
|
SelectCard.Set_Selected(true);
|
|
|
|
PCInfoUI.Ins.m_PCInfoUI_List.m_PCCostumeListUI.Select_Costume(choiceCard);
|
|
|
|
if (!firstInit)
|
|
{
|
|
firstInit = true;
|
|
m_MyPet.Set(table_petlist.Ins.Get_Data_orNull(sdata.Get_EqiupmentEquip(eItem.Pet)));
|
|
m_MyPet.Set_CardType(eUICardType.NoTouch);
|
|
CostumeIdWhenEnter = choiceCard.Get_IntData();
|
|
}
|
|
|
|
var costumeid = SelectCard.Get_IntData();
|
|
var costumeData = table_costumelist.Ins.Get_Data_orNull(costumeid);
|
|
texts[0].text = costumeData.Get_Name();
|
|
texts[1].text = costumeData.Get_Desc();
|
|
Set_2DIlust(costumeData);
|
|
Set_3DModel(true, costumeData.s_Prefab, tr => { tr.GetComponent<PCActor>().Set_Obj(); });
|
|
RawImage_costume.enabled = false;
|
|
|
|
gos[0].SetActive(CanEquip());
|
|
}
|
|
|
|
bool CanEquip()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
var costumeid = SelectCard.Get_IntData();
|
|
if (sdata.Get_EqiupmentEquip(eItem.PCCostume) == costumeid || !sdata.IsObtainItem(costumeid))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public void OnClick_EquipCostume()
|
|
{
|
|
if (!CanEquip()) return;
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
sdata.Equip.Set_Equip(eItem.PCCostume, SelectCard.Get_IntData());
|
|
PCInfoUI.Ins.Set_UI();
|
|
}
|
|
|
|
public CardBase Get_SelectCard() { return SelectCard; }
|
|
} |