123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class GongChengLieBiaoItem : MonoBehaviour
- {
- public GongChengLieBiaoData _currentData;
- private Text _indexText;
- private Text _nameText;
- private Text _stateText;
- private Button _button;
- public void Init()
- {
- _indexText = this.transform.Find("index").GetComponent<Text>();
- _nameText = this.transform.Find("type").GetComponent<Text>();
- _stateText = this.transform.Find("state").GetComponent<Text>();
- _button = this.GetComponent<Button>();
- _button.onClick.AddListener(ItemClick);
- }
- public void ItemClick()
- {
- switch (_currentData.type)
- {
- case GongChengType.shuiWei:
- case GongChengType.shuiYa:
- case GongChengType.weiYi:
- GCJKLayer._Instance._DeviceTrendPanel.Show(_currentData.name,_currentData.type,_currentData.gid,_currentData.sid);
- break;
- }
- }
- public void SetData(GongChengLieBiaoData data)
- {
- _currentData = data;
- _indexText.text = $"{_currentData.index:00}";
- _nameText.text = $"{_currentData.name}";
- switch (_currentData.state)
- {
- case GongChengState.normal:
- _stateText.text = $"<color=#15DCFC>正常</color>";
- break;
- case GongChengState.runing:
- _stateText.text = $"<color=#15DCFC>运行</color>";
- break;
- case GongChengState.fix:
- _stateText.text = $"<color=#FFBC1D>养护</color>";
- break;
- case GongChengState.warning:
- _stateText.text = $"<color=#EF491C>告警</color>";
- break;
- }
- }
- }
|