123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class NoisePanel : MonoBehaviour
- {
- public Image stateImage;
- public Text stateText;
- public Text deviceId;
- public Text noiseText;
-
- public string state;
- private NoiseMqttData data;
- public void SetData(NoiseMqttData 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;
- noiseText.text = data.value + data.unit;
-
- }
- }
|