코스튬 착용까지
This commit is contained in:
parent
39490d343f
commit
1b1dd5c045
|
|
@ -42,6 +42,6 @@ classconfig 에 의해 정해짐
|
|||
어드레서블 다운로드 % 정상적으로 나오게 수정
|
||||
|
||||
코스튬
|
||||
- 코스튬 이미지는 아틀라스가 아닌 동적 로딩
|
||||
- 코스튬 세트
|
||||
- 캐릭터 세팅 함수 만들기 (wizardactor 추가, 실드, 오른손 무기 부모 오브젝트) - 이 세팅은 직업 추가마다 필요
|
||||
// - 코스튬마다 PC프리팹 생성(메시 동적 로딩 시 렌더링이 안됨)
|
||||
|
|
|
|||
|
|
@ -44512,6 +44512,8 @@ MonoBehaviour:
|
|||
- {fileID: 3053266705143488882}
|
||||
- {fileID: 6175458548714744768}
|
||||
RawImage_costume: {fileID: 176841558950769759}
|
||||
gos:
|
||||
- {fileID: 8756686011241429274}
|
||||
--- !u!1 &3425753977039102381
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PCInfoUI_Center : UI3DModel
|
||||
{
|
||||
public TextMeshProUGUI[] texts; // 0 코스튬 이름, 1 코스튬 대사
|
||||
public RawImage RawImage_costume;
|
||||
public GameObject[] gos; // 0 코스튬 착용 버튼
|
||||
|
||||
PCInfoUI_PCListCard SelectCard;
|
||||
AsyncOperationHandle<Texture> currentHandle;
|
||||
|
||||
public void Set(PCInfoUI_PCListCard choiceCard)
|
||||
{
|
||||
|
|
@ -18,23 +22,44 @@ public class PCInfoUI_Center : UI3DModel
|
|||
SelectCard.gos[0].SetActive(true);
|
||||
|
||||
SelectCard = choiceCard;
|
||||
var costumeData = table_costumelist.Ins.Get_Data_orNull(SelectCard.Get_IntData());
|
||||
var costumeid = SelectCard.Get_IntData();
|
||||
var costumeData = table_costumelist.Ins.Get_Data_orNull(costumeid);
|
||||
RawImage_costume.enabled = false;
|
||||
if (!DSUtil.CheckNull(costumeData))
|
||||
{
|
||||
AddrResourceMgr.Ins.LoadObject<Texture>($"Assets/Res_Addr/PCCostumeImage/{costumeData.s_Image}.png", handle =>
|
||||
{
|
||||
if (currentHandle.IsValid())
|
||||
{
|
||||
Addressables.Release(currentHandle);
|
||||
RawImage_costume.texture = null; // 기존 Texture 참조 해제
|
||||
}
|
||||
|
||||
currentHandle = handle;
|
||||
RawImage_costume.enabled = true;
|
||||
RawImage_costume.texture = handle.Result;
|
||||
Resources.UnloadUnusedAssets();
|
||||
});
|
||||
|
||||
Set_3DModel($"Assets/Res_Addr/PC/{costumeData.s_Prefab}.prefab");
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
ToastUI.Ins.Set(174, "코스튬 착용");
|
||||
if (!CanEquip()) return;
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
sdata.Equip.Set_Equip(eItem.PCCostume, SelectCard.Get_IntData());
|
||||
PCInfoUI.Ins.Set();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,6 @@ public class PCInfoUI_PCListCard : CardBase
|
|||
|
||||
public void OnClick_Costume()
|
||||
{
|
||||
|
||||
PCInfoUI.Ins.m_PCInfoUI_Center.Set(this);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue