58 lines
1.7 KiB
C#
58 lines
1.7 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;
|
|
|
|
PCInfoUI_PCListCard SelectCard;
|
|
|
|
public void Set(PCInfoUI_PCListCard choiceCard)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
if (!DSUtil.CheckNull(SelectCard))
|
|
SelectCard.gos[0].SetActive(false);
|
|
|
|
SelectCard = choiceCard;
|
|
SelectCard.gos[0].SetActive(true);
|
|
|
|
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);
|
|
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();
|
|
}
|
|
} |