ServerRoomManager.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class ServerRoomManager : UpdateManager
  6. {
  7. public Text pjwendu;
  8. public Text pjshidu;
  9. public List<Text> wendulist;
  10. public List<Text> shidulist;
  11. public override void updateData()
  12. {
  13. base.updateData();
  14. DataManager.Instance.GetWSD((data)=> {
  15. float wendupj = 0;
  16. float shidupj = 0;
  17. for (int i = 0; i < data.serverList.Count; i++)
  18. {
  19. wendupj = wendupj + data.serverList[i].wendu;
  20. shidupj = shidupj + data.serverList[i].shidu;
  21. wendulist[i].text = data.serverList[i].name + "\n" + data.serverList[i].wendu.ToString("F2") + "℃";
  22. shidulist[i].text = data.serverList[i].name + "\n" + data.serverList[i].shidu.ToString("F2") + "%";
  23. }
  24. wendupj = wendupj / 8f;
  25. pjwendu.text = wendupj.ToString("F2") + "℃";
  26. shidupj = shidupj / 8f;
  27. pjshidu.text = shidupj.ToString("F2") + "%";
  28. });
  29. }
  30. }