116 lines
4.5 KiB
C#
116 lines
4.5 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class DoublePlayIntroduceList : MonoBehaviour
|
||
{
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
private Text txt_introduce;
|
||
/// <summary>
|
||
/// 训练时间
|
||
/// </summary>
|
||
private Text txt_time;
|
||
/// <summary>
|
||
/// 训练时长
|
||
/// </summary>
|
||
private Text txt_duration ;
|
||
|
||
/// <summary>
|
||
/// 使用设备
|
||
/// </summary>
|
||
private Text txt_device;
|
||
/// <summary>
|
||
/// 训练方式
|
||
/// </summary>
|
||
private Text txt_train;
|
||
/// <summary>
|
||
/// 操作流程
|
||
/// </summary>
|
||
private Text txt_active;
|
||
/// <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>();
|
||
txt_time = transform.Find("Title/txt_time").GetComponent<Text>();
|
||
txt_duration = transform.Find("Title/txt_duration").GetComponent<Text>();
|
||
|
||
txt_device = transform.Find("Viewport/Content/txt_device/Text").GetComponent<Text>();
|
||
txt_train = transform.Find("Viewport/Content/txt_train/Text").GetComponent<Text>();
|
||
txt_active = transform.Find("Viewport/Content/txt_active/Text").GetComponent<Text>();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 展示数据
|
||
/// </summary>
|
||
/// <param name="dataItem"></param>
|
||
/// <param name="traininginformation"></param>
|
||
/// <param name="value"></param>
|
||
/// <param name="subjectInfo"></param>
|
||
public void IntroduceListShow(RDate.DataItem dataItem, Traininginformation traininginformation,int value,RSData.SubjectInfo subjectInfo)
|
||
{
|
||
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蓝方:重点打击红方重要设备";
|
||
tables.ForEach(x => x.gameObject.SetActive(false));
|
||
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>();
|
||
Text txt_post = _table.transform.Find("txt_post").GetComponent<Text>();
|
||
Text txt_staff = _table.transform.Find("txt_staff").GetComponent<Text>();
|
||
|
||
//赋值
|
||
txt_serialNumber.text = (i + 1).ToString() + "#";
|
||
txt_post.text = "学员";
|
||
txt_staff.text = subjectInfo.data[i].UserName + "/" + subjectInfo.data[i].UserAccount;
|
||
|
||
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;
|
||
_table.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
GameObject _table = Instantiate(tablePrefab, tableParent);
|
||
tables.Add(_table);
|
||
Text txt_serialNumber = _table.transform.Find("txt_serialNumber").GetComponent<Text>();
|
||
Text txt_post = _table.transform.Find("txt_post").GetComponent<Text>();
|
||
Text txt_staff = _table.transform.Find("txt_staff").GetComponent<Text>();
|
||
|
||
//赋值
|
||
txt_serialNumber.text = (i + 1).ToString() + "#";
|
||
txt_post.text = "学员";
|
||
txt_staff.text = subjectInfo.data[i].UserName + "/" + subjectInfo.data[i].UserAccount;
|
||
|
||
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;
|
||
_table.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
}
|