SheBeiShiShiType.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using XCharts.Runtime;
  6. public class SheBeiShiShiType : UpdateManager
  7. {
  8. public Text runtext;
  9. public Text guzhangtext;
  10. public Text daijitext;
  11. public Text lixiantext;
  12. public RingChart runrc;
  13. public RingChart guzhangrc;
  14. public RingChart daijirc;
  15. public RingChart lixianrc;
  16. override public void updateData()
  17. {
  18. base.updateData();
  19. DeMaDataManager.Instance.GetDeviceInfo( "0",(msg)=>{
  20. int total =int.Parse(msg["data"]["run"].ToString())+
  21. int.Parse(msg["data"]["standby"].ToString())+
  22. int.Parse(msg["data"]["fault"].ToString())+
  23. int.Parse(msg["data"]["offline"].ToString());
  24. if(total==0)
  25. {
  26. total = 1;
  27. }
  28. SerieData data1 = runrc.series[0].GetSerieData(0);
  29. data1.data[0] = int.Parse(msg["data"]["run"].ToString());
  30. data1.data[1] = total;
  31. runtext.text = msg["data"]["run"].ToString()+"台";
  32. SerieData data2 = daijirc.series[0].GetSerieData(0);
  33. data2.data[0] = int.Parse(msg["data"]["standby"].ToString());
  34. data2.data[1] = total;
  35. daijitext.text = msg["data"]["standby"].ToString()+"台";
  36. SerieData data3 = guzhangrc.series[0].GetSerieData(0);
  37. data3.data[0] = int.Parse(msg["data"]["fault"].ToString());
  38. data3.data[1] = total;
  39. guzhangtext.text = msg["data"]["fault"].ToString()+"台";
  40. SerieData data4 = lixianrc.series[0].GetSerieData(0);
  41. data4.data[0] = int.Parse(msg["data"]["offline"].ToString());
  42. data4.data[1] = total;
  43. lixiantext.text = msg["data"]["offline"].ToString()+"台";
  44. });
  45. }
  46. }