WXMC/.svn/pristine/3d/3dfeb3bf952aa570695877b9edc9f14bf39cbb39.svn-base

44 lines
637 B
Plaintext
Raw Normal View History

2024-12-04 16:18:46 +08:00
using UnityEngine;
using UnityEngine.UI;
public class SpriteSwapper : MonoBehaviour
{
public Sprite enabledSprite;
public Sprite disabledSprite;
private bool m_swapped = true;
private Image m_image;
public void Awake()
{
m_image = GetComponent<Image>();
}
public void SwapSprite()
{
if (m_swapped)
{
m_swapped = false;
m_image.sprite = disabledSprite;
}
else
{
m_swapped = true;
m_image.sprite = enabledSprite;
}
}
public bool IsEnabled()
{
if (m_swapped == true)
{
return true;
}
else
{
return false;
}
}
}