using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static InterfaceManager;
using RDate;
using UnityEngine.UI;
public class DoublePlayMain : MonoBehaviour
{
public static DoublePlayMain instance;
///
/// 所有房间数据接口
///
[Header("所有房间数据接口")]
public RoomData roomdata = new RoomData();
///
/// 复盘回访预制体
///
[Header("复盘回访预制体")]
public GameObject DuplexPrefab;
///
/// 复盘回访预制体父物体
///
[Header("复盘回访预制体父物体")]
public Transform DuplexPrefabParent;
///
/// 基本信息 脚本
///
public DoublePlayIntroduceList doublePlayIntroduceList;
///
/// 训练评估 脚本
///
public DoublePlayEvaluatePanel doublePlayEvaluatePanel;
///
/// 基本信息tog
///
private Toggle tog_informition;
///
/// 训练评估tog
///
private Toggle tog_evaluate;
///
/// 训练回放
///
private Button btn_video;
///
/// 基本信息obj
///
public GameObject IntroduceList;
///
/// 训练评估obj
///
public GameObject EvaluatePanel;
// Start is called before the first frame update
void Start()
{
instance = this;
Debug.Log("url.:"+ Url_RoomList);
tog_informition = transform.Find("IntroducePanel/tog_informition").GetComponent();
tog_evaluate = transform.Find("IntroducePanel/tog_evaluate").GetComponent();
StartCoroutine(GetString(Url_RoomList, data => {
Debug.Log(data);
roomdata= JsonUtility.FromJson(data);
for (int i = 0; i < roomdata.data.Count; i++)
{
GameObject obj = Instantiate(DuplexPrefab, DuplexPrefabParent);
DropdownDouble dropdownDouble = obj.GetComponent();
if (dropdownDouble)
{
dropdownDouble.dataItem = roomdata.data[i];
//Debug.Log(roomdata.data[i].Name);
dropdownDouble.Label = roomdata.data[i].Name;
}
obj.SetActive(true);
}
}));
tog_informition.onValueChanged.AddListener(isOn => {
IntroduceList.transform.localScale = isOn ? Vector3.one : Vector3.zero;
EvaluatePanel.transform.localScale = isOn ? Vector3.zero : Vector3.one;
}
);
}
// Update is called once per frame
void Update()
{
}
}