| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | using System.Runtime.ConstrainedExecution;using UnityEngine;using UnityEngine.EventSystems;using UnityEngine.UI;using static SensorAlert;public class YiChangJingGaoItem : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler{    public YiChangJingGaoData currentData;    public SWAlert currentSWAlertData;    public SensorAlertData currentSensorData;    private Text _timeText;    private Text _posText;    private Text _typeText;    private Text _infoText;    private Text _stateText;        public void Init()    {        _timeText = this.transform.Find("time").GetComponent<Text>();        _posText = this.transform.Find("pos").GetComponent<Text>();        _typeText = this.transform.Find("type").GetComponent<Text>();        _infoText = this.transform.Find("info").GetComponent<Text>();        _stateText = this.transform.Find("state").GetComponent<Text>();    }    public void OnPointerEnter(PointerEventData eventData)    {        Debug.Log(11);    }    public void OnPointerExit(PointerEventData eventData)    {        Debug.Log(22);    }    public void SetData(YiChangJingGaoData data)    {        currentData = data;        _timeText.text = currentData.time;        _posText.text = currentData.pos;        _typeText.text = currentData.type;        _infoText.text = currentData.info;        _stateText.text = currentData.state;    }    public void SetData(SWAlert data)    {        currentSWAlertData = data;        _timeText.text = data.triggerTime.ToString();        _posText.text = data.projectName.ToString().Substring(0,2);        _typeText.text = data.alertType.ToString();        if (data.alertMessage.Contains('£¬'))        {            string[] per = data.alertMessage.Split('£¬');            _infoText.text = per[per.Length - 1];        }        else{            _infoText.text = data.alertMessage;        }    }    public void SetData(SensorAlertData data)    {        currentSensorData = data;        _timeText.text = data.triggerTime.ToString();        _posText.text = data.projectName.ToString().Substring(0, 2);        if(data.alertType != null)            _typeText.text = data.alertType.ToString();        _infoText.text = data.alertMessage;    }}
 |