123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using XCharts.Runtime;
- using static GameManager;
- using static Manager;
- public class TuBiao : UpdateManager
- {
- public TuBiaoType type;
- public Toggle ritoggle;
- public Toggle zhoutoggle;
- public Toggle yuetoggle;
- public LineChart lc;
- override public void updateData()
- {
- base.updateData();
- switch(type)
- {
- case TuBiaoType.科技设备利用率:
- DeMaDataManager.Instance.GetKeJiZaiXian("/digital-twin/v1/device/ratio/run",(data) => {
- setLineData(lc, data);
- },index,1);
- break;
- case TuBiaoType.科技设备在线率:
- DeMaDataManager.Instance.GetKeJiZaiXian("/digital-twin/v1/device/ratio/online",(data) => {
- setLineData(lc, data);
- },index,1);
- break;
- case TuBiaoType.今日燃气流量:
- DeMaDataManager.Instance.GetJinRiRanQi((data) => {
- setLineData(lc, data);
- });
- break;
- case TuBiaoType.工业设备利用率:
- DeMaDataManager.Instance.GetKeJiZaiXian("/digital-twin/v1/device/ratio/run",(data) => {
- setLineData(lc, data);
- },index,2);
- break;
- case TuBiaoType.工业设备在线率:
- DeMaDataManager.Instance.GetKeJiZaiXian("/digital-twin/v1/device/ratio/online",(data) => {
- setLineData(lc, data);
- },index,2);
- break;
- case TuBiaoType.总用电量:
- DeMaDataManager.Instance.GetZongyongdianData((data) => {
- setLineData(lc, data);
- },index);
- break;
- case TuBiaoType.设备报警率:
- DeMaDataManager.Instance.GetGaoJingData((data) => {
- setLineData(lc, data);
- },index,0);
- break;
- case TuBiaoType.累计燃气用量:
- DeMaDataManager.Instance.GetLeiJiRanqi((data) => {
- setLineData(lc, data);
- });
- break;
- }
- }
- int index=1;
- private void Awake() {
-
- ritoggle?.onValueChanged.AddListener((b)=>{
- if(b)
- {
- index=1;
- updateData();
- }
- });
- zhoutoggle?.onValueChanged.AddListener((b)=>{
- if(b)
- {
- index=2;
- updateData();
- }
- });
- yuetoggle?.onValueChanged.AddListener((b)=>{
- if(b)
- {
- index=3;
- updateData();
- }
- });
- }
- }
|