_xiaofang/xiaofang/Assets/yhj/scripts/ClassItem.cs
2024-12-01 19:24:07 +08:00

54 lines
1.4 KiB
C#

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>();
jueseChoicePop.SetClassItem(this);
}
// Update is called once per frame
void Update()
{
}
}