first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user