using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DoublePlayIntroduceList : MonoBehaviour
{
///
/// 名称
///
private Text txt_introduce;
///
/// 训练时间
///
private Text txt_time;
///
/// 训练时长
///
private Text txt_duration ;
///
/// 使用设备
///
private Text txt_device;
///
/// 训练方式
///
private Text txt_train;
///
/// 操作流程
///
private Text txt_active;
///
/// 席位列表预制体
///
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();
txt_time = transform.Find("Title/txt_time").GetComponent();
txt_duration = transform.Find("Title/txt_duration").GetComponent();
txt_device = transform.Find("Viewport/Content/txt_device/Text").GetComponent();
txt_train = transform.Find("Viewport/Content/txt_train/Text").GetComponent();
txt_active = transform.Find("Viewport/Content/txt_active/Text").GetComponent();
}
///
/// 展示数据
///
///
///
///
public void IntroduceListShow(RDate.DataItem dataItem, Traininginformation traininginformation,int value)
{
txt_introduce.text = dataItem.Name + "_" + traininginformation.subjectsInfo[value].subjectName;
txt_time.text = dataItem.StartTime;
txt_duration.text =traininginformation.subjectsInfo[value].SubTime.ToString();
txt_device.text = "红方:探测雷达,激光火控平台,地面无线电干扰,频谱探测设备,微波武器\n蓝方:蜂群无人机";
txt_train.text =traininginformation.subjectsInfo[value].mode;
txt_active.text = "红方:摧毁所有蓝方无人机,保护我方重要设备\n蓝方:重点打击红方重要设备";
for(int i=0;i< traininginformation.subjectsInfo[value].seatInfos.Count; i++)
{
if (tables.Count > i)
{
GameObject _table = tables[i];
Text txt_serialNumber = _table.transform.Find("txt_serialNumber").GetComponent();
Text txt_post = _table.transform.Find("txt_post").GetComponent();
Text txt_staff = _table.transform.Find("txt_staff").GetComponent();
txt_staff.text = traininginformation.subjectsInfo[value].seatInfos[i].seatName;
Color _color = traininginformation.subjectsInfo[value].seatInfos[i].role == "0" ? Color.red : Color.blue;
txt_serialNumber.color = _color;
txt_post.color = _color;
txt_staff.color = _color;
}
else
{
GameObject _table = Instantiate(tablePrefab, tableParent);
tables.Add(_table);
Text txt_serialNumber = _table.transform.Find("txt_serialNumber").GetComponent();
Text txt_post = _table.transform.Find("txt_post").GetComponent();
Text txt_staff = _table.transform.Find("txt_staff").GetComponent();
txt_serialNumber.text = (i + 1).ToString() + "#";
txt_post.text = "学员";
txt_staff.text = traininginformation.subjectsInfo[value].seatInfos[i].seatName;
Color _color = traininginformation.subjectsInfo[value].seatInfos[i].role == "0" ? Color.red : Color.blue;
txt_serialNumber.color = _color;
txt_post.color = _color;
txt_staff.color = _color;
}
}
}
}