SixServerManager.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using XCharts.Runtime;
  6. public class SixServerManager : UpdateManager
  7. {
  8. public List<PieChart> items;
  9. public Text flops;
  10. public override void updateData()
  11. {
  12. base.updateData();
  13. DataManager.Instance.GetSixServer((data) => {
  14. for (int i = 0; i < items.Count; i++)
  15. {
  16. items[i].GetChartComponent<Title>().text = data[i].title;
  17. items[i].GetComponent<PieValue>().setData(data[i]);
  18. items[i].series[0].GetSerieData(0).data[1] = data[i].items[0].value;
  19. items[i].series[0].GetSerieData(0).name = data[i].items[0].name + " " + data[i].items[0].value + "%";
  20. items[i].series[0].GetSerieData(1).data[1] = data[i].items[1].value;
  21. items[i].series[0].GetSerieData(1).name = data[i].items[1].name + " " + data[i].items[1].value + "%";
  22. }
  23. flops.text= data[5].value.ToString();
  24. });
  25. }
  26. }