123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using TMPro;
- using UnityEngine.EventSystems;
- using UnityEngine;
- using UnityEngine.UI;
- public class GuideButtonChangeUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
- {
- public Image guideButtonBG;
- public Image guideIcon;
- public TextMeshProUGUI txt;
- public Sprite targetBG;
- public Sprite targetIcon;
- private Sprite curBG;
- private Sprite curIcon;
- private void Awake()
- {
- curBG = guideButtonBG.sprite;
- curIcon = guideIcon.sprite;
- }
- public void OnPointerEnter(PointerEventData eventData)
- {
- ChangeUI();
- }
- public void OnPointerExit(PointerEventData eventData)
- {
- ResetUI();
- }
- public void ChangeUI()
- {
- guideButtonBG.sprite = targetBG;
- guideIcon.sprite = targetIcon;
- txt.color = Color.black;
- }
- public void ResetUI()
- {
- guideButtonBG.sprite = curBG;
- guideIcon.sprite = curIcon;
- txt.color = Color.white;
- }
- }
|