NewN_UAVPlane/Assets/Zion/Scripts/SituationDisplay.cs

55 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AdamThinkDevicesData;
using static InterfaceManager;
using Newtonsoft.Json;
using UnityEngine.UI;
/// <summary>
/// 态势显示
/// </summary>
public class SituationDisplay : MonoBehaviour
{
/// <summary>
///
/// </summary>
public Transform Content;
/// <summary>
/// 预制体
/// </summary>
public GameObject txtViewPrefab;
/// <summary>
/// 接收条数
/// </summary>
public int NumberOfAcceptances = 0;
// Start is called before the first frame update
void Start()
{
Debug.Log(GlobalFlag.currentThinkId);
Debug.Log(GlobalFlag.practiceSubjectID);
string PracticeId = GlobalFlag.practiceSubjectID;
StartCoroutine(GetString(Url_Querypracticelog+ PracticeId, 5, data => {
Debug.Log(data);
ReceivingLogMain receivingLogMain = new ReceivingLogMain();
receivingLogMain = JsonConvert.DeserializeObject<ReceivingLogMain>(data);
for (int i = NumberOfAcceptances; i < receivingLogMain.data.Count; i++)
{
NumberOfAcceptances++;
GameObject txtView = Instantiate(txtViewPrefab, Content);
Text _text = txtView.GetComponentInChildren<Text>();
_text.text = receivingLogMain.data[i].log;
txtView.transform.SetAsFirstSibling();
txtView.SetActive(true);
}
}));
}
// Update is called once per frame
void Update()
{
}
}