| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class BengZhanJianKongItem : MonoBehaviour{    public BengZhanJianKongData _currentData;    private Text _nameText;    private Text _flowValueText;    private Text _stateText;    public void Init()    {        _nameText = this.transform.Find("name").GetComponent<Text>();        _flowValueText = this.transform.Find("LiuLiang").GetComponent<Text>();        _stateText = this.transform.Find("ZhuangTai").GetComponent<Text>();    }        public void SetData(BengZhanJianKongData data)    {        _currentData = data;        _nameText.text = _currentData.name;        _flowValueText.text = $"流量:<color=#FFFFFF>{_currentData.flowValue}</color> m\u00b3/s";        string stateStr = "未知";        switch (_currentData.state)        {            case BengZhanState.close:                stateStr = "状态:\t<color=#FFFFFF>关闭</color>";                break;            case BengZhanState.open:                stateStr = "状态:\t<color=#15DCFC>开启</color>";                break;            case BengZhanState.fix:                stateStr = "状态:\t<color=#FFBC1D>养护</color>";                break;            case BengZhanState.warning:                stateStr = "状态:\t<color=#EF491C>告警</color>";                break;        }        _stateText.text = stateStr;    }}
 |