Project_WL/Assets/Script/UI/ETC/ItemDescUI.cs

50 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemDescUI : MonoBehaviourSingletonTemplateBackKeyAdd<ItemDescUI>
{
public GameObject go_child;
public UIItemCard m_UIItemCard;
public UILabel[] labels; // 0 이름, 1 설명
protected override void Awake()
{
base.Awake();
DontDestroy();
}
public void Set(ItemData itemData)
{
if (itemData == null || itemData.Desc.Equals("?")) return;
base.Set();
go_child.SetActive(true);
m_UIItemCard.Set(itemData);
m_UIItemCard.sprites[(int)eUICardSprite.Back].canvasRenderer.SetAlpha(0f);
m_UIItemCard.Set_CardType(eUICardType.NoTouch);
m_UIItemCard.Set_CardEffectOrder(20);
m_UIItemCard.labels[2].text = m_UIItemCard.labels[4].text = "";
labels[0].text = DSUtil.Format("{0}{1}", MyValue.Get_GradeColor((int)itemData.Grade), itemData.Name);
labels[1].text = itemData.Desc;
}
public void Set(string _icon, string _name, string _desc)
{
base.Set();
go_child.SetActive(true);
m_UIItemCard.Set_CardType(eUICardType.NoTouch);
m_UIItemCard.Off_Objs();
m_UIItemCard.sprites[1].sprite = UIAtlasMgr.Ins.Get_Sprite(_icon);
m_UIItemCard.sprites[1].SetNativeSize();
labels[0].text = _name;
labels[1].text = _desc;
}
public override void OnClick_Back()
{
base.OnClick_Back();
go_child.SetActive(false);
}
}