Files
Ultimate-Fishing-Simulator-…/Assets/Scripts/Assembly-CSharp/UI_ItemTooltip.cs
2026-03-04 09:37:33 +08:00

57 lines
1.1 KiB
C#

using System.Collections;
using TMPro;
using UFS3;
using UnityEngine;
using UnityEngine.UI;
public class UI_ItemTooltip : MonoBehaviour
{
[SerializeField]
private Image iconImage;
[SerializeField]
private TextMeshProUGUI nameTextMesh;
[SerializeField]
private TextMeshProUGUI descriptionTextMesh;
private CanvasGroup canvasGroup;
private void Start()
{
canvasGroup = GetComponent<CanvasGroup>();
SetOff();
}
public void DrawItemData(BaseItemData item)
{
string text = "\n";
if (item is RodData)
{
RodData rodData = (RodData)item;
text = text + rodData.AttachedLine?.ToString() + "\n";
text = text + rodData.AttachedLure?.ToString() + "\n";
text = text + rodData.AttachedReel?.ToString() + "\n";
}
nameTextMesh.text = item.name;
descriptionTextMesh.text = item.Description + text;
canvasGroup.alpha = 1f;
StartCoroutine(TargetPointer());
}
public void SetOff()
{
canvasGroup.alpha = 0f;
StopAllCoroutines();
}
private IEnumerator TargetPointer()
{
while (true)
{
base.transform.position = Input.mousePosition - new Vector3(10f, 10f, 0f);
yield return null;
}
}
}