_xiaofang/xiaofang/Assets/yhj/scripts/ClassItem.cs

54 lines
1.4 KiB
C#
Raw Normal View History

2024-11-30 17:43:21 +08:00
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;
2024-12-01 19:24:07 +08:00
public Text NoSelectedBtntext;
2024-11-30 17:43:21 +08:00
public GameObject JuesechoicePop;
2024-12-01 19:24:07 +08:00
public bool isSet = false;
2024-11-30 17:43:21 +08:00
// Start is called before the first frame update
void Start()
{
NoSelectedBtn.onClick.AddListener(OpenJueseChoicePop);
2024-12-01 19:24:07 +08:00
//SelectedBtn.onClick.AddListener(OpenJueseChoicePop);
setClassItem("");
2024-11-30 17:43:21 +08:00
}
2024-12-01 19:24:07 +08:00
public void setClassItem(string s)
2024-11-30 17:43:21 +08:00
{
2024-12-01 19:24:07 +08:00
if(!isSet)
2024-11-30 17:43:21 +08:00
{
2024-12-01 19:24:07 +08:00
NoSelectedBtn.gameObject.SetActive(true);
SelectedBtn.gameObject.SetActive(false);
2024-11-30 17:43:21 +08:00
}
else
{
2024-12-01 19:24:07 +08:00
//NoSelectedBtn.gameObject.SetActive(true);
//SelectedBtn.gameObject.SetActive(false);
SelectedBtn.gameObject.SetActive(true);
SelectedBtntext.text = s;
NoSelectedBtn.gameObject.SetActive(false);
2024-11-30 17:43:21 +08:00
}
}
void OpenJueseChoicePop()
{
JuesechoicePop.SetActive(true);
2024-12-01 19:24:07 +08:00
JueseChoicePop jueseChoicePop = JuesechoicePop.GetComponent<JueseChoicePop>();
jueseChoicePop.SetClassItem(this);
2024-11-30 17:43:21 +08:00
}
// Update is called once per frame
void Update()
{
}
}