ict.shenzhi/Assets/ZHYscrip/scrip/SelectIn.cs

52 lines
1.0 KiB
C#

using GLTFast;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class SelectIn : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
public Sprite InUI;
public Sprite OutUI;
public bool selected=false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnPointerClick(PointerEventData eventData)
{
}
public void OnPointerEnter(PointerEventData eventData)
{
if (!selected)
{
this.GetComponent<Image>().sprite = InUI;
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (!selected)
{
this.GetComponent<Image>().sprite = OutUI;
}
}
private void OnDisable()
{
this.GetComponent<Image>().sprite = OutUI;
}
}