using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; public class CusButton : MonoBehaviour { /// /// 选中图标 /// public Sprite SelectSprite; /// /// 未选中图标 /// public Sprite NormalSprite; public TextMeshProUGUI Text; public string SelectStr; public string NormalStr; /// /// /// public Image ThisButton; /// /// /// public void SetStatus(bool selected) { if (ThisButton != null) { ThisButton.sprite = selected ? SelectSprite : NormalSprite; } if (Text != null) { Text.text = selected ? SelectStr : NormalStr; } } }