using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class DoublePlayEvaluatePanel : MonoBehaviour { /// /// 席位列表预制体 /// public GameObject tablePrefab; /// /// 席位列表父物体 /// public Transform tableParent; /// /// 席位列表 /// public List tables = new List(); // Start is called before the first frame update void Start() { //txt_introduce = transform.Find("Title/txt_introduce").GetComponent(); } /// /// /// /// /// /// /// public void DoublePlayEvaluatePanelShow(RDate.DataItem dataItem, Traininginformation traininginformation, int value, RSData.SubjectInfo subjectInfo) { tables.ForEach(x => x.gameObject.SetActive(false)); for (int i = 0; i < subjectInfo.data.Count; i++) { if (tables.Count > i) { GameObject _table = tables[i]; Text txt_id = _table.transform.Find("txt_id").GetComponent(); Text txt_active = _table.transform.Find("txt_active").GetComponent(); Text txt_position = _table.transform.Find("txt_position").GetComponent(); Text txt_person = _table.transform.Find("txt_person").GetComponent(); Text txt_complete = _table.transform.Find("txt_complete").GetComponent(); Text txt_score = _table.transform.Find("txt_score").GetComponent(); //赋值 txt_id.text = (i + 1).ToString(); txt_active.text = ""; txt_position.text = "学员"; txt_person.text = subjectInfo.data[i].UserName + "/" + subjectInfo.data[i].UserAccount; txt_complete.text = ""; txt_score.text = ""; Color _color = traininginformation.subjectsInfo[value].seatInfos[i].role == "0" ? Color.red : Color.blue; txt_id.color = _color; txt_active.color = _color; txt_position.color = _color; txt_person.color = _color; txt_complete.color = _color; txt_score.color = _color; _table.SetActive(true); } else { GameObject _table = Instantiate(tablePrefab, tableParent); tables.Add(_table); Text txt_id = _table.transform.Find("txt_id").GetComponent(); Text txt_active = _table.transform.Find("txt_active").GetComponent(); Text txt_position = _table.transform.Find("txt_position").GetComponent(); Text txt_person = _table.transform.Find("txt_person").GetComponent(); Text txt_complete = _table.transform.Find("txt_complete").GetComponent(); Text txt_score = _table.transform.Find("txt_score").GetComponent(); //赋值 txt_id.text = (i + 1).ToString(); txt_active.text = ""; txt_position.text = "学员"; txt_person.text = subjectInfo.data[i].UserName + "/" + subjectInfo.data[i].UserAccount; txt_complete.text = ""; txt_score.text = ""; Color _color = traininginformation.subjectsInfo[value].seatInfos[i].role == "0" ? Color.red : Color.blue; txt_id.color = _color; txt_active.color = _color; txt_position.color = _color; txt_person.color = _color; txt_complete.color = _color; txt_score.color = _color; _table.SetActive(true); } } } }