35 lines
634 B
C#
35 lines
634 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BtnImage : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
Sprite img;
|
|
|
|
[SerializeField]
|
|
Sprite hoverImg;
|
|
|
|
/// <summary>
|
|
/// 是否显示子按钮
|
|
/// </summary>
|
|
[HideInInspector]
|
|
public bool isOpen;
|
|
/// <summary>
|
|
/// 点击按钮更换的图片
|
|
/// </summary>
|
|
public void OnEnterBtn()
|
|
{
|
|
GetComponent<Image>().sprite = hoverImg;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 推出按钮更换的图片
|
|
/// </summary>
|
|
public void OnExitBtn()
|
|
{
|
|
GetComponent<Image>().sprite = img;
|
|
}
|
|
}
|