using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; /// /// 选项 /// public class Option : MonoBehaviour { private Image image; private Text text; public Image Image { get { if (image == null) image = GetComponent(); return image; } set => image = value; } public Text Text { get { if (text == null) text = GetComponentInChildren(); return text; } set => text = value; } /// /// 该按钮是否切换场景 /// public bool CutScreen; public void OnSelected() { Color imgColor = Image.color; imgColor.a = 1; Image.color = imgColor; Text.color = Color.white; } public void UnSelected() { Color imgColor = Image.color; imgColor.a = 0; Image.color = imgColor; Text.color = Color.black; } }