NewN_UAVPlane/Assets/Zion/Scripts/Wzx/DoublePlayEvaluatePanel.cs

96 lines
4.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DoublePlayEvaluatePanel : MonoBehaviour
{
/// <summary>
/// 席位列表预制体
/// </summary>
public GameObject tablePrefab;
/// <summary>
/// 席位列表父物体
/// </summary>
public Transform tableParent;
/// <summary>
/// 席位列表
/// </summary>
public List<GameObject> tables = new List<GameObject>();
// Start is called before the first frame update
void Start()
{
//txt_introduce = transform.Find("Title/txt_introduce").GetComponent<Text>();
}
/// <summary>
///
/// </summary>
/// <param name="dataItem"></param>
/// <param name="traininginformation"></param>
/// <param name="value"></param>
/// <param name="subjectInfo"></param>
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>();
Text txt_active = _table.transform.Find("txt_active").GetComponent<Text>();
Text txt_position = _table.transform.Find("txt_position").GetComponent<Text>();
Text txt_person = _table.transform.Find("txt_person").GetComponent<Text>();
Text txt_complete = _table.transform.Find("txt_complete").GetComponent<Text>();
Text txt_score = _table.transform.Find("txt_score").GetComponent<Text>();
//赋值
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>();
Text txt_active = _table.transform.Find("txt_active").GetComponent<Text>();
Text txt_position = _table.transform.Find("txt_position").GetComponent<Text>();
Text txt_person = _table.transform.Find("txt_person").GetComponent<Text>();
Text txt_complete = _table.transform.Find("txt_complete").GetComponent<Text>();
Text txt_score = _table.transform.Find("txt_score").GetComponent<Text>();
//赋值
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);
}
}
}
}