_xiaofang/xiaofang/Assets/yhj/scripts/JueseChoicePop.cs
2024-12-01 22:24:03 +08:00

91 lines
2.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class JueseChoicePop : MonoBehaviour
{
public ClassMate classMate;
public ClassItem classItem;
public Button CloseBtn;
public Button Surebtn;
public GameObject classmatePrefab;
public Transform content;
public List<ClassMate> classMateList = new List<ClassMate> ();
//public string s;
// Start is called before the first frame update
void Start()
{
this.gameObject.SetActive(false);
CloseBtn.onClick.AddListener(CLosePop);
Surebtn.onClick.AddListener(CLosePop);
Surebtn.onClick.AddListener(SetFenguan);
SetClass();
}
void CLosePop()
{
this.gameObject.SetActive(false);
}
public void openPop()
{
this.gameObject.SetActive(true);
}
void SetFenguan()
{
//设置此区分的分管人员为用户选中的角色,并刷新界面信息
classItem.isSet = true;
//classItem.setClassItem();
}
// Update is called once per frame
void Update()
{
}
public void SetClass()
{
for (int i = 0; i < 10; i++)
{
GameObject item = GameObject.Instantiate<GameObject>(classmatePrefab, content);
ClassMate classMate = item.GetComponent<ClassMate>();
classMateList.Add(classMate);
classMate.SetJc(this);
}
}
public void SetClassItem(ClassItem classItem)
{
this.classItem = classItem;
}
public void SetClassMate(ClassMate classMate,string a = "")
{
classMate.isBeSet = true;
classItem.isSet = true;
this.classMate = classMate;
classItem.setClassItem(classMate.classmatename.text);
//s = classMate.classmatename.text;
this.classMate.classmatename.text = classMate.classmatename.text + "(" + classItem.classname.text + ")";
}
public void ClearClassMate()
{
}
public void ChangeClassMate()
{
}
}