Files
beyond/Assets/Scripts/UI/SkillSlot.cs
2024-11-20 15:21:28 +01:00

67 lines
1.8 KiB
C#

using System;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Beyond
{
//could combine a lot of code with guilt slot
public class SkillSlot : MonoBehaviour, IPointerEnterHandler
{
public Image image;
public Image quantaImage;
public Image levelImage;
public TMP_Text title;
public Action Clicked;
public GameObject notSeenMark;
public Skills skillType;
[Header("Description Data")]
public string description;
public Sprite quantaBackgroundImage;
public void OnPointerEnter(PointerEventData eventData)
{
Clicked?.Invoke();
}
public void SetAsSelected()
{
title.color = bItemSlot.GetSelectedButtonTextColor();
if (!NewItemPopupSaver.skillsSeen.Contains(skillType))
{
NewItemPopupSaver.skillsSeen.Add(skillType);
SetNotSeenIcon(skillType);
}
image.color = bItemSlot.GetSelectedImageColor();
quantaImage.color = image.color;
levelImage.color = image.color;
}
public void SetNotSeenIcon(Skills skillType)
{
if (notSeenMark == null)
{
return;
}
if (NewItemPopupSaver.skillsSeen.Contains(skillType))
{
notSeenMark.SetActive(false);
}
else
{
notSeenMark.SetActive(true);
}
}
public void SetAsDeselected()
{
title.color = bItemSlot.GetDefaultButtonTextColor();
image.color = bItemSlot.GetDeselectedImageColor();
quantaImage.color = image.color;
levelImage.color = image.color;
}
}
}