ServerRoomManager.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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. wendulist[i].GetComponent<RoomToggleChoose>().id = data.serverList[i].id;
  24. shidulist[i].GetComponent<RoomToggleChoose>().id = data.serverList[i].id;
  25. }
  26. wendupj = wendupj / 8f;
  27. pjwendu.text = wendupj.ToString("F2") + "℃";
  28. shidupj = shidupj / 8f;
  29. pjshidu.text = shidupj.ToString("F2") + "%";
  30. });
  31. }
  32. public static int chooswsd = 0;
  33. }