using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class OccPanel : MonoBehaviour { public Image stateImage; public Text stateText; public Text deviceId; public Text dispText; public Text speedText; public Text TempText; public string state; private OscillateMqttData data; public void SetData(OscillateMqttData data) { if (data == null) return; this.data = data; switch (state) { case "±¨¾¯": stateImage.color = new Color32(255, 3, 7, 100); stateText.text = "Òì³£"; stateText.color = new Color32(255, 3, 7, 255); break; default: stateImage.color = new Color32(34, 187, 67, 100); stateText.text = "Õý³£"; stateText.color = new Color32(34, 187, 67, 255); break; } deviceId.text = data.device.deviceName; dispText.text = data.disp.value + data.disp.unit; speedText.text = data.speed.value + data.speed.unit; TempText.text = data.temp.value + data.temp.unit; } }