37 lines
904 B
C#
37 lines
904 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class MenuBtOnClick : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler
|
|
{
|
|
[SerializeField] private Sprite defaultSprite;
|
|
[SerializeField] private Sprite clickSprite;
|
|
[SerializeField] private Sprite notClickSprite;
|
|
[SerializeField] private GameObject pop;
|
|
private Image _image;
|
|
private void Start()
|
|
{
|
|
_image = this.GetComponent<Image>();
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
_image.sprite = clickSprite;
|
|
pop.SetActive(true);
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
_image.sprite = defaultSprite;
|
|
pop.SetActive(false);
|
|
}
|
|
|
|
public void SetActive()
|
|
{
|
|
_image.sprite = notClickSprite;
|
|
}
|
|
}
|