using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using UnityEngine.Events; namespace Lemon.GenericLib.UI { public class TabButtonScript : MonoBehaviour, IPointerEnterHandler, IPointerClickHandler, IPointerExitHandler { [SerializeField] TabGroup tabGroup; [SerializeField] private UnityEvent onTabEnter; [SerializeField] private UnityEvent onTabExit; [SerializeField] private UnityEvent onTabSelected; [SerializeField] private UnityEvent onTabDeselected; public void OnPointerClick(PointerEventData eventData) { tabGroup.OnTabSelected(this); } public void OnPointerEnter(PointerEventData eventData) { tabGroup.OnTabEnter(this); } public void OnPointerExit(PointerEventData eventData) { tabGroup.OnTabExit(this); } public void OnEnter() { onTabEnter?.Invoke(); } public void OnExit() { onTabExit?.Invoke(); } public void OnSelected() { onTabSelected?.Invoke(); } public void OnDeselected() { onTabDeselected?.Invoke(); } } }