OccPanel.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class OccPanel : MonoBehaviour
  6. {
  7. public Image stateImage;
  8. public Text stateText;
  9. public Text deviceId;
  10. public Text dispText;
  11. public Text speedText;
  12. public Text TempText;
  13. public string state;
  14. private OscillateMqttData data;
  15. public void SetData(OscillateMqttData data)
  16. {
  17. if (data == null)
  18. return;
  19. this.data = data;
  20. switch (state)
  21. {
  22. case "ą¨žŻ":
  23. stateImage.color = new Color32(255, 3, 7, 100);
  24. stateText.text = "Ň쳣";
  25. stateText.color = new Color32(255, 3, 7, 255);
  26. break;
  27. default:
  28. stateImage.color = new Color32(34, 187, 67, 100);
  29. stateText.text = "ŐýłŁ";
  30. stateText.color = new Color32(34, 187, 67, 255);
  31. break;
  32. }
  33. deviceId.text = data.device.deviceName;
  34. dispText.text = data.disp.value + data.disp.unit;
  35. speedText.text = data.speed.value + data.speed.unit;
  36. TempText.text = data.temp.value + data.temp.unit;
  37. }
  38. }