- Redone most UIs (WIP) - New world map - Game LOGO - main menus updated (WIP)
42 lines
857 B
C#
42 lines
857 B
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
using TMPro;
|
|
|
|
namespace Kryz.CharacterStats.Examples
|
|
{
|
|
public class StatDisplay : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
|
{
|
|
public TMP_Text NameText;
|
|
public TMP_Text ValueText;
|
|
|
|
[NonSerialized]
|
|
public CharacterStat Stat;
|
|
|
|
private void OnValidate()
|
|
{
|
|
//TMP_Text[] texts = GetComponentsInChildren<TMP_Text>();
|
|
//NameText = texts[0];
|
|
//ValueText = texts[1];
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
StatTooltip.Instance.HideTooltip();
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
if(Stat != null)
|
|
StatTooltip.Instance.ShowTooltip(Stat, NameText.text);
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
if (Stat != null)
|
|
StatTooltip.Instance.HideTooltip();
|
|
}
|
|
}
|
|
}
|