DeMaGongYeCheJian.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using XCharts.Runtime;
  6. public class DeMaGongYeCheJian : MonoBehaviour
  7. {
  8. public RingChart rcr;
  9. public RingChart rcg;
  10. public RingChart rcd;
  11. public RingChart rcl;
  12. public Text rcrt;
  13. public Text rcgt;
  14. public Text rcdt;
  15. public Text rclt;
  16. private void OnEnable() {
  17. DeMaDataManager.Instance.GetDeviceInfo( GameManager.Instance.getID(this.gameObject.GetComponent<GameType>().tapName),(msg)=>{
  18. int total =int.Parse(msg["data"]["run"].ToString())+
  19. int.Parse(msg["data"]["standby"].ToString())+
  20. int.Parse(msg["data"]["fault"].ToString())+
  21. int.Parse(msg["data"]["offline"].ToString());
  22. if(total==0)
  23. {
  24. total = 1;
  25. }
  26. SerieData data1 = rcr.series[0].GetSerieData(0);
  27. data1.data[0] = int.Parse(msg["data"]["run"].ToString());
  28. data1.data[1] = total;
  29. rcrt.text = msg["data"]["run"].ToString()+"台";
  30. SerieData data2 = rcg.series[0].GetSerieData(0);
  31. data2.data[0] = int.Parse(msg["data"]["standby"].ToString());
  32. data2.data[1] = total;
  33. rcgt.text = msg["data"]["standby"].ToString()+"台";
  34. SerieData data3 = rcd.series[0].GetSerieData(0);
  35. data3.data[0] = int.Parse(msg["data"]["fault"].ToString());
  36. data3.data[1] = total;
  37. rcdt.text = msg["data"]["fault"].ToString()+"台";
  38. SerieData data4 = rcl.series[0].GetSerieData(0);
  39. data4.data[0] = int.Parse(msg["data"]["offline"].ToString());
  40. data4.data[1] = total;
  41. rclt.text = msg["data"]["offline"].ToString()+"台";
  42. });
  43. }
  44. }