using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public enum AearInfoType { 摄像, 湿度和可见度, PM2_5, 噪音, } public class AearInfo : MonoBehaviour { public string _aearID; public Text aearTxt; public Text cameraTxt; public Button cameraBtn; public Text shiduTxt; public Text kejianduTxt; public Text pm2_5Txt; public Text zaoyinTxt; public Text yiChangTxt; public float shidu=0; public float kejiandu=0; public float pm2_5=0; public float zaoyin=0; public void Init() { if (aearTxt != null) { aearTxt.text = _aearID; } } private void Update() { if (shidu != 0) { shiduTxt.text = shidu.ToString() + "℃"; } if (kejiandu != 0) { kejianduTxt.text = kejiandu.ToString() + "M"; } if (pm2_5 != 0) { pm2_5Txt.text = pm2_5.ToString() + "μg/m3"; } if (zaoyin != 0) { zaoyin += Random.Range(-0.25f, 0.2f); zaoyinTxt.text = zaoyin.ToString("0") + "DB"; } } public void SetCameraBtn() { //cameraTxt.gameObject.SetActive(false); cameraTxt.text = "已部署"; //cameraBtn.gameObject.SetActive(true); cameraBtn.onClick.AddListener(() => { }); } }