using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ClassItem : MonoBehaviour { public Text classname; public Button NoSelectedBtn; public Button SelectedBtn; public Text SelectedBtntext; public Text NoSelectedBtntext; public GameObject JuesechoicePop; public bool isSet = false; // Start is called before the first frame update void Start() { NoSelectedBtn.onClick.AddListener(OpenJueseChoicePop); //SelectedBtn.onClick.AddListener(OpenJueseChoicePop); setClassItem(""); } public void setClassItem(string s) { if(!isSet) { NoSelectedBtn.gameObject.SetActive(true); SelectedBtn.gameObject.SetActive(false); } else { //NoSelectedBtn.gameObject.SetActive(true); //SelectedBtn.gameObject.SetActive(false); SelectedBtn.gameObject.SetActive(true); SelectedBtntext.text = s; NoSelectedBtn.gameObject.SetActive(false); } } void OpenJueseChoicePop() { JuesechoicePop.SetActive(true); JueseChoicePop jueseChoicePop = JuesechoicePop.GetComponent(); jueseChoicePop.SetClassItem(this); } // Update is called once per frame void Update() { } }