40 lines
1013 B
C#
40 lines
1013 B
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
namespace OTGIntegrated.Talents
|
||
|
|
{
|
||
|
|
public sealed class TalentTooltipUI : MonoBehaviour
|
||
|
|
{
|
||
|
|
public GameObject panelRoot;
|
||
|
|
public Text contentText;
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
if (panelRoot == null)
|
||
|
|
{
|
||
|
|
panelRoot = gameObject;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Show(TalentData talent, TalentManager manager)
|
||
|
|
{
|
||
|
|
if (talent == null || panelRoot == null || contentText == null)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
string requirement = manager != null ? manager.GetBlockingReason(talent) : string.Empty;
|
||
|
|
contentText.text = $"{talent.displayName}\n\n{talent.description}\n\nСтоимость: {talent.cost}\n{requirement}";
|
||
|
|
panelRoot.SetActive(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Hide()
|
||
|
|
{
|
||
|
|
if (panelRoot != null)
|
||
|
|
{
|
||
|
|
panelRoot.SetActive(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|