Project_WL/Assets/Script/UI/PC/Info/PCInfoUI_Center.cs

60 lines
1.8 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using TMPro;
using UnityEngine;
2024-12-30 05:00:34 +00:00
public class PCInfoUI_Center : UI3DModel
2024-12-15 01:39:39 +00:00
{
2025-02-14 23:33:26 +00:00
public PetCard m_MyPet;
2024-12-15 01:39:39 +00:00
public TextMeshProUGUI[] texts; // 0 코스튬 이름, 1 코스튬 대사
2024-12-31 04:49:01 +00:00
public GameObject[] gos; // 0 코스튬 착용 버튼
2024-12-15 01:39:39 +00:00
2024-12-31 06:30:12 +00:00
public int CostumeIdWhenEnter;
2025-02-14 23:41:33 +00:00
public bool firstInit = false;
2024-12-31 06:30:12 +00:00
2025-07-17 00:38:14 +00:00
CardBase SelectCard;
2024-12-31 03:16:50 +00:00
2025-07-17 00:38:14 +00:00
public void Set(CardBase choiceCard)
2024-12-15 01:39:39 +00:00
{
2025-02-14 23:33:26 +00:00
var sdata = ServerInfo.Ins.m_ServerData;
2024-12-31 03:16:50 +00:00
if (!DSUtil.CheckNull(SelectCard))
2025-07-16 18:19:14 +00:00
SelectCard.Set_Selected(false);
2024-12-31 03:16:50 +00:00
SelectCard = choiceCard;
2025-07-16 18:19:14 +00:00
SelectCard.Set_Selected(true);
2024-12-31 03:16:50 +00:00
2025-02-14 23:41:33 +00:00
if (!firstInit)
2025-02-14 23:33:26 +00:00
{
2025-02-14 23:41:33 +00:00
firstInit = true;
2025-02-14 23:33:26 +00:00
m_MyPet.Set(table_petlist.Ins.Get_Data_orNull(sdata.Get_EqiupmentEquip(eItem.Pet)));
m_MyPet.Set_CardType(eUICardType.NoTouch);
2025-02-14 23:41:33 +00:00
CostumeIdWhenEnter = choiceCard.Get_IntData();
2025-02-14 23:33:26 +00:00
}
2024-12-31 06:30:12 +00:00
2024-12-31 04:49:01 +00:00
var costumeid = SelectCard.Get_IntData();
var costumeData = table_costumelist.Ins.Get_Data_orNull(costumeid);
2025-04-10 05:13:09 +00:00
texts[0].text = costumeData.Get_Name();
texts[1].text = costumeData.Get_Desc();
2025-02-17 22:30:54 +00:00
Set_2DIlust(costumeData);
2025-02-17 23:53:54 +00:00
Set_3DModel(true, costumeData.s_Prefab, tr => { tr.GetComponent<PCActor>().Set_Obj(); });
RawImage_costume.enabled = false;
2024-12-31 04:49:01 +00:00
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;
2024-12-15 01:39:39 +00:00
}
2024-12-31 03:16:50 +00:00
public void OnClick_EquipCostume()
{
2024-12-31 04:49:01 +00:00
if (!CanEquip()) return;
var sdata = ServerInfo.Ins.m_ServerData;
sdata.Equip.Set_Equip(eItem.PCCostume, SelectCard.Get_IntData());
2025-02-14 07:19:07 +00:00
PCInfoUI.Ins.Set_UI();
2024-12-31 03:16:50 +00:00
}
2024-12-15 01:39:39 +00:00
}