105 lines
2.4 KiB
C#
105 lines
2.4 KiB
C#
using BrewMonster.UI;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
[DisallowMultipleComponent]
|
|
public class AUISubDialog : MonoBehaviour
|
|
{
|
|
[SerializeField] private CDlgSkillSubListItem m_subDialog;
|
|
[SerializeField] private RectTransform m_rectTransform;
|
|
[SerializeField] private TextMeshProUGUI label;
|
|
|
|
private int m_data;
|
|
|
|
private void Reset()
|
|
{
|
|
if (m_rectTransform == null)
|
|
{
|
|
m_rectTransform = transform as RectTransform;
|
|
}
|
|
if (m_subDialog == null)
|
|
{
|
|
m_subDialog = GetComponent<CDlgSkillSubListItem>();
|
|
}
|
|
}
|
|
|
|
public void SetDialog(CDlgSkillSubListItem dialog)
|
|
{
|
|
m_subDialog = dialog;
|
|
}
|
|
|
|
public CDlgSkillSubListItem GetSubDialog()
|
|
{
|
|
return m_subDialog;
|
|
}
|
|
|
|
public string GetName()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
public void SetName(string newName)
|
|
{
|
|
name = newName;
|
|
}
|
|
public void SetLabel(string strLabel)
|
|
{
|
|
if (label != null)
|
|
{
|
|
label.text = strLabel;
|
|
}
|
|
}
|
|
public Vector2Int GetSize()
|
|
{
|
|
if (m_rectTransform == null)
|
|
{
|
|
m_rectTransform = transform as RectTransform;
|
|
}
|
|
|
|
return m_rectTransform != null
|
|
? Vector2Int.RoundToInt(m_rectTransform.rect.size)
|
|
: Vector2Int.zero;
|
|
}
|
|
|
|
public Vector2 GetPos()
|
|
{
|
|
if (m_rectTransform == null)
|
|
{
|
|
m_rectTransform = transform as RectTransform;
|
|
}
|
|
|
|
return m_rectTransform != null ? m_rectTransform.anchoredPosition : Vector2.zero;
|
|
}
|
|
|
|
public void SetPos(float x, float y)
|
|
{
|
|
if (m_rectTransform == null)
|
|
{
|
|
m_rectTransform = transform as RectTransform;
|
|
}
|
|
|
|
if (m_rectTransform != null)
|
|
{
|
|
m_rectTransform.anchoredPosition = new Vector2(x, y);
|
|
}
|
|
}
|
|
|
|
public void Show(bool value)
|
|
{
|
|
gameObject.SetActive(value);
|
|
}
|
|
|
|
public void SetData(int data)
|
|
{
|
|
m_data = data;
|
|
}
|
|
|
|
public int GetData()
|
|
{
|
|
return m_data;
|
|
}
|
|
}
|
|
}
|