GCJKLayer.cs 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908
  1. using Newtonsoft.Json.Linq;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using UnityEngine;
  8. using UnityEngine.Networking;
  9. using UnityEngine.UI;
  10. using UnityEngine.UIElements;
  11. using Toggle = UnityEngine.UI.Toggle;
  12. using UnityAsync;
  13. using WaitUntil = UnityAsync.WaitUntil;
  14. using Unity.VisualScripting;
  15. using System.Threading.Tasks;
  16. using XCharts.Runtime;
  17. using Button = UnityEngine.UI.Button;
  18. [System.Serializable]
  19. public class QXZData
  20. {
  21. public int ADDVCD;
  22. public float ALT;
  23. public double LGTD;
  24. public double LTTD;
  25. public int ROWNUM_;
  26. public string STCD;
  27. public string STLC;
  28. public string STNM;
  29. public float dropSum6;
  30. }
  31. [System.Serializable]
  32. public class ServerObsDatas
  33. {
  34. public class ServerObsData
  35. {
  36. public string channelId;
  37. public string deviceId;
  38. public string name;
  39. public string ipAddress;
  40. public string ptzTypeText;
  41. public bool status;
  42. }
  43. public int total;
  44. public List<ServerObsData> list;
  45. }
  46. [System.Serializable]
  47. public class SensorAlert
  48. {
  49. public class SensorAlertData
  50. {
  51. public string projectName;
  52. public DateTime triggerTime;
  53. public string alertType;
  54. public string alertMessage;
  55. }
  56. public int total;
  57. public DateTime queryTime;
  58. public List<SensorAlertData> list;
  59. }
  60. [System.Serializable]
  61. public class SWZData
  62. {
  63. // 行政区划代码
  64. public string ADDVCD;
  65. // 行政管理单位
  66. public string ADMAUTH;
  67. // 观测站所属单位
  68. public string ATCUNIT;
  69. // 建站年月
  70. public string BGFRYM;
  71. // 河流名称
  72. public string BSNM;
  73. // 备注
  74. public string COMMENTS;
  75. // 流域名称
  76. public string DRNA;
  77. // 河流流域代码
  78. public string DSTRVM;
  79. // 站点更名前站名
  80. public string DTMEL;
  81. // 站点更名前名称
  82. public string DTMNM;
  83. // 数据处理人
  84. public string DTPR;
  85. // 建成年月
  86. public string ESSTYM;
  87. // 站点等级
  88. public string FRGRD;
  89. // 水系名称
  90. public string HNNM;
  91. // 经度
  92. public double LGTD;
  93. // 地区
  94. public string LOCALITY;
  95. // 纬度
  96. public double LTTD;
  97. // 修改时间
  98. public string MODITIME;
  99. // 水文站代码
  100. public string PHCD;
  101. // 行号
  102. public int ROWNUM_;
  103. // 河道名称
  104. public string RVNM;
  105. // 站点状态
  106. public string STAZT;
  107. // 站点基础
  108. public string STBK;
  109. // 站点代码
  110. public string STCD;
  111. // 站点位置
  112. public string STLC;
  113. // 站点名称
  114. public string STNM;
  115. // 站点类型
  116. public string STTP;
  117. // 是否使用
  118. public string USFL;
  119. // 最近6小时降水量
  120. public float dropSum6;
  121. // 天气
  122. public string wth;
  123. }
  124. public class GCJKLayer : YZTRootLayer
  125. {
  126. public static GCJKLayer _Instance;
  127. public Button bjjkBtn;
  128. public Button bjxxBtn;
  129. public GameObject bjScrollView;
  130. public GameObject bjxxScrollView;
  131. //泵站监控面板
  132. private RectTransform _bengZhanJianKongPanel;
  133. private RectTransform _bengZhanJianKongContent;
  134. //告警监控
  135. private RectTransform _gaoJingJianKongPanel;
  136. private RectTransform gaoJingJianKongContent;
  137. private List<YiChangJingGaoItem> currentYiChangJingGaoItems;
  138. public YiChangJingGaoItem YiChangJingGaoItemOri;
  139. [Header("泵站监控数据预制体")] public GameObject BengZhanJianKongItemOri;
  140. [Header("泵站监控数据")] public List<BengZhanJianKongData> BengZhanJianKongDatas;
  141. private List<BengZhanJianKongItem> currentBengZhanJianKongItems;
  142. //闸站监测
  143. private RectTransform _zhaZhanJianKongPanel;
  144. private RectTransform _zhaZhanJianKongContent;
  145. [Header("闸站监测数据预制体")] public GameObject ZhaZhanJianKongItemOri;
  146. private List<ZhaZhanJianKongItem> currentZhaZhanJianKongItems;
  147. //水文监测
  148. private RectTransform _shuiWenJianCePanel;
  149. private Text _wenduText;
  150. private Text _shiduText;
  151. private Text _qiyaText;
  152. private Text _fengXiangText;
  153. private Text _fengLiText;
  154. private Text _yuLiangText;
  155. [Header("水文监测数据")] public ShuiWenJianCeData currentShuiWenJianCeData;
  156. //工程安全检测
  157. //检测数据
  158. private Text _pingJunLiuLiangText;
  159. private Text _zuiGaoShuiWeiText;
  160. private Text _zuiDaLiuLiangText;
  161. private Text _gongChengGaoJingText;
  162. private Text _zhengChangYunXingText;
  163. [Header("工程安全检测-检测数据")] public GongChengJianCeData currentGongChengJianCeData;
  164. //工程列表
  165. private RectTransform _gongChengLieBiaoContent;
  166. public GameObject GongChengLieBiaoItemOri;
  167. private List<GongChengLieBiaoItem> currentGongChengLieBiaoItems = new List<GongChengLieBiaoItem>();
  168. private Button GClist_QuanBuButton;
  169. private Button GClist_ShiPinButton;
  170. private Button GClist_jingLiShuiZhunYiButton;
  171. private Button GClist_ShenYaJiButton;
  172. private Button GClist_ShuiWeiButton;
  173. private Button GClist_WenDuButton;
  174. private Button GClist_yinZhangXianYiButton;
  175. private Button GClist_chuiXianZuoBiaoYiButton;
  176. private Button GClist_tuYaLiJiButton;
  177. private Button GClist_yingLiJiButton;
  178. private Button GClist_sanXiangWeiCuoJiButton;
  179. private Button GClist_erXiangCeFengJiButton;
  180. private Button GClist_weiYiJiButton;
  181. //视频监控
  182. [Header("监控数据")] public ObsPlayerPanel obsPanel;
  183. public GameObject obsItemPrefab;
  184. private Transform obsItemContent;
  185. private List<ObsItem> _obsItems;
  186. public GameObject obsIconPrefab;
  187. private Transform _obsIconContent;
  188. private List<ObsIconCtrl> _obsIconCtrls;
  189. private InputField _obsSearchInputField;
  190. //水位图标
  191. [Header("水位数据")] public GameObject shuiweiIconPrefab;
  192. private List<ShuiWeiIconCtrl> _shuiWeiIconCtrls = new List<ShuiWeiIconCtrl>();
  193. private Transform _shuiWeiIconContent;
  194. //水压
  195. public GameObject shuiYaIconPrefab;
  196. private List<ShuiYaIconCtrl> _shuiYaIconCtrls = new List<ShuiYaIconCtrl>();
  197. private Transform _shuiYaIconContent;
  198. //位移
  199. public GameObject weiYiIconPrefab;
  200. private List<WeiYiIconCtrl> _weiYiIconCtrls = new List<WeiYiIconCtrl>();
  201. private Transform _weiYiIconContent;
  202. public GameObject deviceIconPrefab;
  203. public List<DeviceIconCtrl> deviceIconCtrlList = new List<DeviceIconCtrl>();
  204. private Transform deviceIconContent;
  205. private Toggle ObsToggle;
  206. private Toggle shuiWeiToggle;
  207. private Toggle shenYaJiToggle;
  208. private Toggle jingLiShuiZhunYiToggle;
  209. private Toggle wenDuToggle;
  210. private Toggle yinZhangXianYiToggle;
  211. private Toggle chuiXianZuoBiaoYiToggle;
  212. private Toggle tuYaLiJiToggle;
  213. private Toggle yingLiJiToggle;
  214. private Toggle sanXiangWeiCuoJiToggle;
  215. private Toggle erXiangCeFengJiToggle;
  216. private Toggle weiYiJiToggle;
  217. public RectTransform main;
  218. public RectTransform miniMap;
  219. public Button globalWeatherBtn;
  220. public Button exitGlobalWeatherBtn;
  221. private ShuiWeiHistoryPanel _shuiWeiHistoryPanel;
  222. public RectTransform miniMapQXContent;
  223. public RectTransform miniMapSWContent;
  224. public GameObject dropUnitPrefab;
  225. public GameObject weatherUnitPrefab;
  226. public Button qxDataBtn;
  227. public Button swDataBtn;
  228. public Sprite highLightBtn;
  229. public Sprite normalBtn;
  230. public Toggle dropToggle;
  231. public Toggle weatherToggle;
  232. List<DropUnit> dropUnits = new List<DropUnit>();
  233. List<WeatherUnit> weatherUnits = new List<WeatherUnit>();
  234. public GameObject runtimePointObj;
  235. private int currentDataType = -1;
  236. public GameObject loading;
  237. public Button currentAreaBtn;
  238. public Button[] areaBtn;
  239. public GameObject areaBtnParent;
  240. public Button areaBtnPrefab;
  241. private List<GongChengLieBiaoData> _DevivesDatas = new List<GongChengLieBiaoData>();
  242. public GameObject _DeviceTrendPanelOri;
  243. private Dictionary<string, DeviceTrendPanel> openDeviceTrendPanelList = new Dictionary<string, DeviceTrendPanel>();
  244. //public GongChengLieBiaoItem currentSelectItem;
  245. //上下游水位
  246. public ShuiWeiCtrl swSY;
  247. public ShuiWeiCtrl swXY;
  248. private void Awake()
  249. {
  250. _Instance = this;
  251. Init();
  252. _shuiWeiHistoryPanel = this.transform.Find("Main/ShuiWeiHistoryPanel").GetComponent<ShuiWeiHistoryPanel>();
  253. _shuiWeiHistoryPanel.Init();
  254. _shuiWeiHistoryPanel.gameObject.SetActive(false);
  255. currentAreaBtn.onClick.AddListener(() =>
  256. {
  257. areaBtnParent.transform.parent.parent.gameObject.SetActive(!areaBtnParent.transform.parent.parent.gameObject.activeSelf);
  258. });
  259. for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++) {
  260. if (GlobalData.layerUnitDatas[i].type == LayerUnitType.ZZ) {
  261. Button newBtn = Instantiate(areaBtnPrefab);
  262. newBtn.transform.SetParent(areaBtnParent.transform);
  263. newBtn.transform.localScale = Vector3.one;
  264. newBtn.GetComponentInChildren<Text>().text = GlobalData.layerUnitDatas[i].name;
  265. int temp = i;
  266. newBtn.onClick.AddListener(() =>
  267. {
  268. currentAreaBtn.GetComponentInChildren<Text>().text = GlobalData.layerUnitDatas[temp].name;
  269. areaBtnParent.transform.parent.parent.gameObject.SetActive(false);
  270. if (temp == 0)
  271. {
  272. OnBuYuanClick();
  273. }
  274. else if (temp == 1)
  275. {
  276. OnTaoKouClick();
  277. }
  278. else {
  279. OnOtherClick(GlobalData.layerUnitDatas[temp].namePri);
  280. }
  281. });
  282. }
  283. }
  284. //buyuanBtn.onClick.AddListener(OnBuYuanClick);
  285. //taokouBtn.onClick.AddListener(OnTaoKouClick);
  286. }
  287. public void OnBuYuanClick() {
  288. currentAreaBtn.GetComponentInChildren<Text>().text = "补元退洪闸";
  289. SetCurrentDataToPanel(0);
  290. }
  291. public void OnTaoKouClick()
  292. {
  293. currentAreaBtn.GetComponentInChildren<Text>().text = "套口进洪闸";
  294. SetCurrentDataToPanel(1);
  295. }
  296. public void OnOtherClick(string namePri)
  297. {
  298. currentDataType = 2;
  299. SetCurrentDataToEmpty(namePri);
  300. SetGongChengLieBiaoData();
  301. SetZhaZhanJianKongData();
  302. }
  303. void SetCurrentDataToEmpty(string namePri) {
  304. if (_obsItems != null)
  305. {
  306. for (int i = 0; i < _obsItems.Count; i++)
  307. {
  308. _obsItems[i].gameObject.SetActive(false);
  309. }
  310. }
  311. if (_obsIconCtrls != null)
  312. {
  313. for (int i = 0; i < _obsIconCtrls.Count; i++)
  314. {
  315. _obsIconCtrls[i].gameObject.SetActive(false);
  316. }
  317. }
  318. _gongChengGaoJingText.text = "-";
  319. _zhengChangYunXingText.text = "-";
  320. StaticLod.instance.OnFoucusStatic(namePri);
  321. }
  322. private async void OnEnable()
  323. {
  324. StaticLod.instance.OnFoucusStatic(1);
  325. if (GlobalData.BuYuanShuiWeiDataList.Count < 1)
  326. {
  327. await HttpHelper._Instance.InitSWYJData();
  328. }
  329. if (GlobalData.BuYuanShuiYaDataList.Count < 1)
  330. {
  331. HttpHelper._Instance.GetBuYuanDevicesGroupInfo();
  332. }
  333. if (GlobalData.TaoKouShuiYaDataList.Count < 1)
  334. {
  335. HttpHelper._Instance.GetTaoKouDevicesGroupInfo();
  336. }
  337. if(GlobalData.layerUnitDatas.Count > 0)
  338. currentAreaBtn.GetComponentInChildren<Text>().text = GlobalData.layerUnitDatas[1].name;
  339. SetCurrentDataToPanel(1);
  340. }
  341. public void Init()
  342. {
  343. swSY.Init();
  344. swXY.Init();
  345. //泵站监控面板
  346. _bengZhanJianKongPanel = this.transform.Find("BengZhanJianKong").GetComponent<RectTransform>();
  347. _bengZhanJianKongContent =
  348. _bengZhanJianKongPanel.Find("ScrollView/Viewport/Content").GetComponent<RectTransform>();
  349. currentBengZhanJianKongItems = new List<BengZhanJianKongItem>();
  350. if (BengZhanJianKongDatas != null && BengZhanJianKongDatas.Count > 0)
  351. {
  352. for (int i = 0; i < BengZhanJianKongDatas.Count; i++)
  353. {
  354. BengZhanJianKongItem tempItem = Instantiate(BengZhanJianKongItemOri, _bengZhanJianKongContent)
  355. .GetComponent<BengZhanJianKongItem>();
  356. tempItem.Init();
  357. tempItem.SetData(BengZhanJianKongDatas[i]);
  358. currentBengZhanJianKongItems.Add(tempItem);
  359. }
  360. }
  361. bjjkBtn.onClick.AddListener(() =>
  362. {
  363. bjScrollView.gameObject.SetActive(true);
  364. bjxxScrollView.gameObject.SetActive(false);
  365. bjjkBtn.GetComponentInChildren<Text>().color = Color.white;
  366. bjxxBtn.GetComponentInChildren<Text>().color = Color.gray;
  367. });
  368. bjxxBtn.onClick.AddListener(() =>
  369. {
  370. bjScrollView.gameObject.SetActive(false);
  371. bjxxScrollView.gameObject.SetActive(true);
  372. bjjkBtn.GetComponentInChildren<Text>().color = Color.gray;
  373. bjxxBtn.GetComponentInChildren<Text>().color = Color.white;
  374. });
  375. //闸站
  376. _zhaZhanJianKongPanel = this.transform.Find("ZhaZhanJianKong").GetComponent<RectTransform>();
  377. _zhaZhanJianKongContent =
  378. _zhaZhanJianKongPanel.Find("ZhaMenScrollView/Viewport/Content").GetComponent<RectTransform>();
  379. currentZhaZhanJianKongItems = new List<ZhaZhanJianKongItem>();
  380. //告警监控面板
  381. _gaoJingJianKongPanel = this.transform.Find("ZhaZhanJianKong").GetComponent<RectTransform>();
  382. gaoJingJianKongContent =
  383. _gaoJingJianKongPanel.Find("BaoJingScrollView/Viewport/Content").GetComponent<RectTransform>();
  384. currentYiChangJingGaoItems = new List<YiChangJingGaoItem>();
  385. //水文
  386. _shuiWenJianCePanel = this.transform.Find("ShuiWenJianCe").GetComponent<RectTransform>();
  387. _wenduText = _shuiWenJianCePanel.Find("WenDu/Text/numText").GetComponent<Text>();
  388. _shiduText = _shuiWenJianCePanel.Find("ShiDu/Text/numText").GetComponent<Text>();
  389. _qiyaText = _shuiWenJianCePanel.Find("QiYa/Text/numText").GetComponent<Text>();
  390. _fengXiangText = _shuiWenJianCePanel.Find("FengXiang/Text/numText").GetComponent<Text>();
  391. _fengLiText = _shuiWenJianCePanel.Find("FengLi/Text/numText").GetComponent<Text>();
  392. _yuLiangText = _shuiWenJianCePanel.Find("YuLiang/Text/numText").GetComponent<Text>();
  393. if (currentShuiWenJianCeData != null)
  394. {
  395. _wenduText.text = $"{currentShuiWenJianCeData.wendu}<size=12><color=#A5BBE2>\u2103</color></size>";
  396. _shiduText.text = $"{currentShuiWenJianCeData.shidu} <size=12><color=#A5BBE2>%</color></size>";
  397. _qiyaText.text = $"{currentShuiWenJianCeData.qiya} <size=12><color=#A5BBE2>kPa</color></size>";
  398. _fengXiangText.text = $"{currentShuiWenJianCeData.fengxiang} <size=12><color=#A5BBE2>风</color></size>";
  399. _fengLiText.text = $"{currentShuiWenJianCeData.fengli} <size=12><color=#A5BBE2>级</color></size>";
  400. _yuLiangText.text = $"{currentShuiWenJianCeData.yuliang} <size=12><color=#A5BBE2>mm</color></size>";
  401. }
  402. //监测数据
  403. _pingJunLiuLiangText = this.transform.Find("RightUp/ShuJuJianCe/PingJunLiuLiang/title/numText")
  404. .GetComponent<Text>();
  405. _zuiGaoShuiWeiText = this.transform.Find("RightUp/ShuJuJianCe/ZuiGaoShuiWei/title/numText")
  406. .GetComponent<Text>();
  407. _zuiDaLiuLiangText = this.transform.Find("RightUp/ShuJuJianCe/ZuiDaLiuLiang/title/numText")
  408. .GetComponent<Text>();
  409. _gongChengGaoJingText = this.transform.Find("RightUp/ShuJuJianCe/DangRiJingGao/title/numText")
  410. .GetComponent<Text>();
  411. _zhengChangYunXingText = this.transform.Find("RightUp/ShuJuJianCe/ZhengChangGongCheng/title/numText")
  412. .GetComponent<Text>();
  413. if (currentGongChengJianCeData != null)
  414. {
  415. //_pingJunLiuLiangText.text = $"{currentGongChengJianCeData.pinJunLiuLiang}";
  416. //_zuiGaoShuiWeiText.text = $"{currentGongChengJianCeData.zuiGaoShuiWei}";
  417. //_zuiDaLiuLiangText.text = $"{currentGongChengJianCeData.zuiDaLiuLiang}";
  418. //_gongChengGaoJingText.text = $"{currentGongChengJianCeData.gongChengJingGao}";
  419. //_zhengChangYunXingText.text = $"{currentGongChengJianCeData.zhengChangYunXing}";
  420. }
  421. //工程列表
  422. _gongChengLieBiaoContent = this.transform.Find("RightUp/GongChengLieBiao/ScrollView/Viewport/Content")
  423. .GetComponent<RectTransform>();
  424. GClist_QuanBuButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_QuanBuButton").GetComponent<Button>();
  425. GClist_QuanBuButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.all); });
  426. GClist_ShuiWeiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_ShuiWeiButton").GetComponent<Button>();
  427. GClist_ShuiWeiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.shuiWei); });
  428. GClist_ShenYaJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_ShenYaJiButton").GetComponent<Button>();
  429. GClist_ShenYaJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.shenYaJi); });
  430. GClist_jingLiShuiZhunYiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_jingLiShuiZhunYiButton").GetComponent<Button>();
  431. GClist_jingLiShuiZhunYiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.jingLiShuiZhunYi); });
  432. GClist_ShiPinButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_ShiPinButton").GetComponent<Button>();
  433. GClist_ShiPinButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.shiPin); });
  434. GClist_WenDuButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_WenDuButton").GetComponent<Button>();
  435. GClist_WenDuButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.wenDu); });
  436. GClist_yinZhangXianYiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_yinZhangXianYiButton").GetComponent<Button>();
  437. GClist_yinZhangXianYiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.yinZhangXianYi); });
  438. GClist_chuiXianZuoBiaoYiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_chuiXianZuoBiaoYiButton").GetComponent<Button>();
  439. GClist_chuiXianZuoBiaoYiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.chuiXianZuoBiaoYi); });
  440. GClist_tuYaLiJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_tuYaLiJiButton").GetComponent<Button>();
  441. GClist_tuYaLiJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.tuYaLiJi); });
  442. GClist_yingLiJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_yingLiJiButton").GetComponent<Button>();
  443. GClist_yingLiJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.yingLiJi); });
  444. GClist_sanXiangWeiCuoJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_sanXiangWeiCuoJiButton").GetComponent<Button>();
  445. GClist_sanXiangWeiCuoJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.sanXiangWeiCuoJi); });
  446. GClist_erXiangCeFengJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_erXiangCeFengJiButton").GetComponent<Button>();
  447. GClist_erXiangCeFengJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.erXiangCeFengJi); });
  448. GClist_weiYiJiButton = this.transform.Find("RightUp/GongChengLieBiao/buttons/GClist_weiYiJiButton").GetComponent<Button>();
  449. GClist_weiYiJiButton.onClick.AddListener(() => { SeachGongChengList(GongChengType.weiYiJi); });
  450. //监控
  451. //obsPanel = this.transform.Find("Main/ObsPlayerPanel").GetComponent<ObsPlayerPanel>();
  452. obsPanel.gameObject.SetActive(false);
  453. obsItemContent = this.transform.Find("ShiPinJianKong/ScrollView/Viewport/Content").transform;
  454. _obsIconContent = this.transform.Find("Main/LittleItem/ObsIconContent").transform;
  455. _obsSearchInputField = this.transform.Find("ShiPinJianKong/InputField").GetComponent<InputField>();
  456. _obsSearchInputField.onValueChanged.AddListener(SearchObsItem);
  457. CreatObsItem();
  458. //水位
  459. _shuiWeiIconContent = this.transform.Find("Main/LittleItem/ShuiWeiIconContent").transform;
  460. _shuiYaIconContent = this.transform.Find("Main/LittleItem/ShuiYaIconContent").transform;
  461. _weiYiIconContent = this.transform.Find("Main/LittleItem/WeiYiIconContent").transform;
  462. deviceIconContent = this.transform.Find("Main/LittleItem/DeviceIconContent").transform;
  463. ObsToggle = this.transform.Find("Main/IconToggles/ObsToggle").GetComponent<Toggle>();
  464. shuiWeiToggle = this.transform.Find("Main/IconToggles/shuiWeiToggle").GetComponent<Toggle>();
  465. shenYaJiToggle = this.transform.Find("Main/IconToggles/shenYaJiToggle").GetComponent<Toggle>();
  466. jingLiShuiZhunYiToggle = this.transform.Find("Main/IconToggles/jingLiShuiZhunYiToggle").GetComponent<Toggle>();
  467. wenDuToggle = this.transform.Find("Main/IconToggles/wenDuToggle").GetComponent<Toggle>();
  468. yinZhangXianYiToggle = this.transform.Find("Main/IconToggles/yinZhangXianYiToggle").GetComponent<Toggle>();
  469. chuiXianZuoBiaoYiToggle = this.transform.Find("Main/IconToggles/chuiXianZuoBiaoYiToggle").GetComponent<Toggle>();
  470. tuYaLiJiToggle = this.transform.Find("Main/IconToggles/tuYaLiJiToggle").GetComponent<Toggle>();
  471. yingLiJiToggle = this.transform.Find("Main/IconToggles/yingLiJiToggle").GetComponent<Toggle>();
  472. sanXiangWeiCuoJiToggle = this.transform.Find("Main/IconToggles/sanXiangWeiCuoJiToggle").GetComponent<Toggle>();
  473. erXiangCeFengJiToggle = this.transform.Find("Main/IconToggles/erXiangCeFengJiToggle").GetComponent<Toggle>();
  474. weiYiJiToggle = this.transform.Find("Main/IconToggles/weiYiJiToggle").GetComponent<Toggle>();
  475. ObsToggle.onValueChanged.AddListener(SetObsIconActive);
  476. shuiWeiToggle.onValueChanged.AddListener(Set_shuiWeiJi_IconActive);
  477. shenYaJiToggle.onValueChanged.AddListener(Set_shenYaJi_IconActive);
  478. jingLiShuiZhunYiToggle.onValueChanged.AddListener(Set_jingLiShuiZhunYi_IconActive);
  479. wenDuToggle.onValueChanged.AddListener(Set_wenDu_IconActive);
  480. yinZhangXianYiToggle.onValueChanged.AddListener(Set_yinZhangXianYi_IconActive);
  481. chuiXianZuoBiaoYiToggle.onValueChanged.AddListener(Set_chuiXianZuoBiaoYi_IconActive);
  482. tuYaLiJiToggle.onValueChanged.AddListener(Set_tuYaLiJi_IconActive);
  483. yingLiJiToggle.onValueChanged.AddListener(Set_yingLiJi_IconActive);
  484. sanXiangWeiCuoJiToggle.onValueChanged.AddListener(Set_sanXiangWeiCuoJi_IconActive);
  485. erXiangCeFengJiToggle.onValueChanged.AddListener(Set_erXiangCeFengJi_IconActive);
  486. weiYiJiToggle.onValueChanged.AddListener(Set_weiYiJi_IconActive);
  487. globalWeatherBtn.onClick.AddListener(OnGlobalWeatherClick);
  488. exitGlobalWeatherBtn.onClick.AddListener(() =>
  489. {
  490. CameraManager.SwitchCamera(0);
  491. viewMode = ViewMode.normal;
  492. miniMap.gameObject.SetActive(false);
  493. main.gameObject.SetActive(true);
  494. });
  495. //qxDataBtn.onClick.AddListener(() =>
  496. //{
  497. // miniMapQXContent.gameObject.SetActive(true);
  498. // miniMapSWContent.gameObject.SetActive(false);
  499. // qxDataBtn.GetComponent<UnityEngine.UI.Image>().sprite = highLightBtn;
  500. // swDataBtn.GetComponent<UnityEngine.UI.Image>().sprite = normalBtn;
  501. // dropToggle.gameObject.SetActive(true);
  502. // weatherToggle.gameObject.SetActive(false);
  503. //});
  504. //swDataBtn.onClick.AddListener(() =>
  505. //{
  506. // miniMapQXContent.gameObject.SetActive(false);
  507. // miniMapSWContent.gameObject.SetActive(true);
  508. // swDataBtn.GetComponent<UnityEngine.UI.Image>().sprite = highLightBtn;
  509. // qxDataBtn.GetComponent<UnityEngine.UI.Image>().sprite = normalBtn;
  510. // dropToggle.gameObject.SetActive(false);
  511. // weatherToggle.gameObject.SetActive(true);
  512. //});
  513. miniMapQXContent.gameObject.SetActive(false);
  514. miniMapSWContent.gameObject.SetActive(true);
  515. swDataBtn.gameObject.SetActive(false);
  516. qxDataBtn.gameObject.SetActive(false);
  517. dropToggle.gameObject.SetActive(false);
  518. weatherToggle.gameObject.SetActive(false);
  519. dropToggle.onValueChanged.AddListener((active) =>
  520. {
  521. for (int i = 0; i < dropUnits.Count; i++)
  522. {
  523. dropUnits[i].gameObject.SetActive(active);
  524. }
  525. });
  526. weatherToggle.onValueChanged.AddListener((active) =>
  527. {
  528. for (int i = 0; i < weatherUnits.Count; i++)
  529. {
  530. weatherUnits[i].gameObject.SetActive(active);
  531. }
  532. });
  533. }
  534. public override void OnUILeave()
  535. {
  536. base.OnUILeave();
  537. viewMode = ViewMode.normal;
  538. miniMap.gameObject.SetActive(false);
  539. main.gameObject.SetActive(true);
  540. }
  541. public async void OnGlobalWeatherClick()
  542. {
  543. if (GlobalData.sWZDatas.Count < 1)
  544. await HttpHelper._Instance.InitGCJKData();
  545. GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
  546. CameraManager.SwitchCamera(1);
  547. if (weatherUnits.Count <= 0)
  548. {
  549. for (int i = 0; i < GlobalData.sWZDatas.Count; i++)
  550. {
  551. GameObject gameObject = Instantiate(weatherUnitPrefab);
  552. WeatherUnit weatherUnit = gameObject.GetComponent<WeatherUnit>();
  553. weatherUnit.transform.SetParent(miniMapSWContent.transform);
  554. weatherUnit.Init(GlobalData.sWZDatas[i].LGTD, GlobalData.sWZDatas[i].LTTD, GlobalData.sWZDatas[i].STNM,
  555. GlobalData.sWZDatas[i].wth, GlobalData.sWZDatas[i].dropSum6);
  556. weatherUnit.transform.localScale = Vector3.one * 1.1f;
  557. weatherUnits.Add(weatherUnit);
  558. weatherUnit.bingObj = Instantiate(runtimePointObj).gameObject;
  559. weatherUnit.bingObj.transform.SetParent(shaPan.transform.GetChild(10));
  560. weatherUnit.bingObj.transform.localEulerAngles = Vector3.zero;
  561. weatherUnit.bingObj.transform.localScale = Vector3.one;
  562. weatherUnit.bingObj.transform.localPosition =
  563. CoordinateConverter.GeoToUGUISmall(GlobalData.sWZDatas[i].LGTD, GlobalData.sWZDatas[i].LTTD);
  564. weatherUnit.bingObj.name = GlobalData.sWZDatas[i].STNM;
  565. }
  566. }
  567. else
  568. {
  569. for (int i = 0; i < GlobalData.sWZDatas.Count; i++)
  570. {
  571. weatherUnits[i].Init(GlobalData.sWZDatas[i].LGTD, GlobalData.sWZDatas[i].LTTD,
  572. GlobalData.sWZDatas[i].STNM, GlobalData.sWZDatas[i].wth, GlobalData.sWZDatas[i].dropSum6);
  573. }
  574. }
  575. miniMap.gameObject.SetActive(true);
  576. main.gameObject.SetActive(false);
  577. }
  578. public void SetBengZhanJianKongData(BengZhanJianKongData[] datas)
  579. {
  580. for (int i = 0; i < currentBengZhanJianKongItems.Count; i++)
  581. {
  582. Destroy(currentBengZhanJianKongItems[i].gameObject);
  583. }
  584. BengZhanJianKongDatas = new List<BengZhanJianKongData>();
  585. BengZhanJianKongDatas.AddRange(datas);
  586. if (BengZhanJianKongDatas != null && BengZhanJianKongDatas.Count > 0)
  587. {
  588. for (int i = 0; i < BengZhanJianKongDatas.Count; i++)
  589. {
  590. BengZhanJianKongItem tempItem = Instantiate(BengZhanJianKongItemOri, _bengZhanJianKongContent)
  591. .GetComponent<BengZhanJianKongItem>();
  592. tempItem.Init();
  593. tempItem.SetData(BengZhanJianKongDatas[i]);
  594. currentBengZhanJianKongItems.Add(tempItem);
  595. }
  596. }
  597. }
  598. public async void SetCurrentDataToPanel(int type)
  599. {
  600. if (currentDataType == type)
  601. {
  602. return;
  603. }
  604. GongChengJianCeData data = new GongChengJianCeData();
  605. data.gongChengJingGao = 13;
  606. data.zhengChangYunXing = 198;
  607. SetGongChengJianCe(data);
  608. StaticLod.instance.OnFoucusStatic(type);
  609. currentDataType = type;
  610. await new UnityAsync.WaitUntil(() =>
  611. {
  612. return GlobalData.swDatas.Count > 10;
  613. });
  614. if (currentDataType == 0)
  615. {
  616. string swUp = null;
  617. string swDown =null;
  618. string swUpName="";
  619. string swDownName="";
  620. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  621. {
  622. if (GlobalData.swDatas[i].stnm == "补元(闸上)")
  623. {
  624. swUp = GlobalData.swDatas[i].upz;
  625. swUpName = GlobalData.swDatas[i].stnm;
  626. }
  627. if (GlobalData.swDatas[i].stnm == "补元(闸下)")
  628. {
  629. swDown = GlobalData.swDatas[i].dwz;
  630. swDownName = GlobalData.swDatas[i].stnm;
  631. }
  632. }
  633. var swTargets = GameObject.FindGameObjectsWithTag("BY_SW");
  634. for (int i = 0; i < swTargets.Length; i++)
  635. {
  636. if (swTargets[i].name.Equals("BY_ZhaQian"))
  637. {
  638. swSY.SetData(swUpName,swUp,swTargets[i].transform);
  639. }
  640. if (swTargets[i].name.Equals("BY_ZhaHou"))
  641. {
  642. swXY.SetData(swDownName,swDown,swTargets[i].transform);
  643. }
  644. }
  645. GClist_ShuiWeiButton.gameObject.SetActive(false);
  646. GClist_WenDuButton.gameObject.SetActive(true);
  647. GClist_yinZhangXianYiButton.gameObject.SetActive(false);
  648. GClist_chuiXianZuoBiaoYiButton.gameObject.SetActive(false);
  649. GClist_tuYaLiJiButton.gameObject.SetActive(false);
  650. GClist_yingLiJiButton.gameObject.SetActive(false);
  651. GClist_sanXiangWeiCuoJiButton.gameObject.SetActive(false);
  652. GClist_erXiangCeFengJiButton.gameObject.SetActive(false);
  653. GClist_weiYiJiButton.gameObject.SetActive(false);
  654. shuiWeiToggle.gameObject.SetActive(false);
  655. wenDuToggle.gameObject.SetActive(true);
  656. yinZhangXianYiToggle.gameObject.SetActive(false);
  657. chuiXianZuoBiaoYiToggle.gameObject.SetActive(false);
  658. tuYaLiJiToggle.gameObject.SetActive(false);
  659. yingLiJiToggle.gameObject.SetActive(false);
  660. sanXiangWeiCuoJiToggle.gameObject.SetActive(false);
  661. erXiangCeFengJiToggle.gameObject.SetActive(false);
  662. weiYiJiToggle.gameObject.SetActive(false);
  663. }
  664. else
  665. {
  666. string swUp = null;
  667. string swDown =null;
  668. string swUpName="";
  669. string swDownName="";
  670. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  671. {
  672. if (GlobalData.swDatas[i].stnm == "套口(闸上)")
  673. {
  674. swUp = GlobalData.swDatas[i].upz;
  675. swUpName = GlobalData.swDatas[i].stnm;
  676. }
  677. if (GlobalData.swDatas[i].stnm == "套口(闸下)")
  678. {
  679. swDown = GlobalData.swDatas[i].dwz;
  680. swDownName = GlobalData.swDatas[i].stnm;
  681. }
  682. }
  683. var swTargets = GameObject.FindGameObjectsWithTag("TK_SW");
  684. for (int i = 0; i < swTargets.Length; i++)
  685. {
  686. if (swTargets[i].name.Equals("TK_ZhaQian"))
  687. {
  688. swSY.SetData(swUpName,swUp,swTargets[i].transform);
  689. }
  690. if (swTargets[i].name.Equals("TK_ZhaHou"))
  691. {
  692. swXY.SetData(swDownName,swDown,swTargets[i].transform);
  693. }
  694. }
  695. GClist_ShuiWeiButton.gameObject.SetActive(false);
  696. GClist_WenDuButton.gameObject.SetActive(false);
  697. GClist_yinZhangXianYiButton.gameObject.SetActive(true);
  698. GClist_chuiXianZuoBiaoYiButton.gameObject.SetActive(true);
  699. GClist_tuYaLiJiButton.gameObject.SetActive(true);
  700. GClist_yingLiJiButton.gameObject.SetActive(true);
  701. GClist_sanXiangWeiCuoJiButton.gameObject.SetActive(true);
  702. GClist_erXiangCeFengJiButton.gameObject.SetActive(true);
  703. GClist_weiYiJiButton.gameObject.SetActive(true);
  704. shuiWeiToggle.gameObject.SetActive(false);
  705. wenDuToggle.gameObject.SetActive(false);
  706. yinZhangXianYiToggle.gameObject.SetActive(true);
  707. chuiXianZuoBiaoYiToggle.gameObject.SetActive(true);
  708. tuYaLiJiToggle.gameObject.SetActive(true);
  709. yingLiJiToggle.gameObject.SetActive(true);
  710. sanXiangWeiCuoJiToggle.gameObject.SetActive(true);
  711. erXiangCeFengJiToggle.gameObject.SetActive(true);
  712. weiYiJiToggle.gameObject.SetActive(true);
  713. }
  714. // //水位图标
  715. // CreatShuiWeiIcon();
  716. // FindShuiWeiTargetObje();
  717. //
  718. // //水压图标
  719. // CreatShuiYaIcon();
  720. // FindShuiYaTargetObje();
  721. //
  722. // //位移图标
  723. // CreatWeiYiIcon();
  724. // FindWeiYiTargetObje();
  725. //隐藏不是当前站点的监控
  726. var currentObsType = currentDataType == 0 ? obsType.BuYuanObs : obsType.TaoKouObs;
  727. if (_obsItems != null)
  728. {
  729. for (int i = 0; i < _obsItems.Count; i++)
  730. {
  731. _obsItems[i].gameObject.SetActive(_obsItems[i]._data.type == currentObsType);
  732. }
  733. }
  734. if (_obsIconCtrls != null)
  735. {
  736. for (int i = 0; i < _obsIconCtrls.Count; i++)
  737. {
  738. _obsIconCtrls[i].gameObject.SetActive(_obsIconCtrls[i]._data.type == currentObsType);
  739. }
  740. }
  741. SetGongChengLieBiaoData();
  742. //新的增加图标
  743. CreatIcons();
  744. SetObsIconActive(ObsToggle.isOn);
  745. shuiWeiToggle.isOn = false;
  746. shenYaJiToggle.isOn = false;
  747. jingLiShuiZhunYiToggle.isOn = false;
  748. wenDuToggle.isOn = false;
  749. yinZhangXianYiToggle.isOn = false;
  750. chuiXianZuoBiaoYiToggle.isOn = false;
  751. tuYaLiJiToggle.isOn = false;
  752. yingLiJiToggle.isOn = false;
  753. sanXiangWeiCuoJiToggle.isOn = false;
  754. erXiangCeFengJiToggle.isOn = false;
  755. weiYiJiToggle.isOn = false;
  756. Set_shuiWeiJi_IconActive(false);
  757. Set_shenYaJi_IconActive(false);
  758. Set_jingLiShuiZhunYi_IconActive(false);
  759. Set_wenDu_IconActive(false);
  760. Set_yinZhangXianYi_IconActive(false);
  761. Set_chuiXianZuoBiaoYi_IconActive(false);
  762. Set_tuYaLiJi_IconActive(false);
  763. Set_yingLiJi_IconActive(false);
  764. Set_sanXiangWeiCuoJi_IconActive(false);
  765. Set_erXiangCeFengJi_IconActive(false);
  766. Set_weiYiJi_IconActive(false);
  767. loading.gameObject.SetActive(true);
  768. if (currentDataType == 0)
  769. {
  770. if (GlobalData.buYuanSensorData == null || GlobalData.buYuanSensorData.data.Count < 1)
  771. {
  772. await HttpHelper._Instance.SendBuYuan_GetSensorData();
  773. }
  774. }
  775. else
  776. {
  777. if (GlobalData.taoKouSensorData == null || GlobalData.taoKouSensorData.data.Count < 1)
  778. {
  779. await HttpHelper._Instance.SendTaoKou_GetSensorData();
  780. }
  781. }
  782. loading.gameObject.SetActive(false);
  783. SetZhaZhanJianKongData();
  784. }
  785. public async void OpenDeviceTrendPanel(string _name, GongChengType _type, string _gid, string _sid)
  786. {
  787. if (openDeviceTrendPanelList.ContainsKey(_name))
  788. {
  789. return;
  790. }
  791. var tempTrendPanel = Instantiate(_DeviceTrendPanelOri, this.transform).GetComponent<DeviceTrendPanel>();
  792. tempTrendPanel.currentType = currentDataType;
  793. tempTrendPanel.InitDatePicker();
  794. int openCount = openDeviceTrendPanelList.Count;
  795. tempTrendPanel.transform.localPosition += new Vector3(40*openCount,-20*openCount,0);
  796. await tempTrendPanel.Show(_name, _type, _gid, _sid);
  797. openDeviceTrendPanelList.Add(_name, tempTrendPanel);
  798. }
  799. public void RemovePanel(DeviceTrendPanel panel)
  800. {
  801. if (openDeviceTrendPanelList.ContainsKey(panel.dataName))
  802. {
  803. openDeviceTrendPanelList.Remove(panel.dataName);
  804. }
  805. }
  806. private void OnDisable()
  807. {
  808. foreach (var item in openDeviceTrendPanelList.Values)
  809. {
  810. item.Hide();
  811. }
  812. }
  813. public void SetZhaZhanJianKongData()
  814. {
  815. List<ZhaZhanJianKongData> datas = new List<ZhaZhanJianKongData>();
  816. var tempSensorData = new List<SensorData>();
  817. if (currentDataType == 0)
  818. {
  819. tempSensorData = GlobalData.buYuanSensorData.data;
  820. }
  821. else if (currentDataType == 1) {
  822. tempSensorData = GlobalData.taoKouSensorData.data;
  823. }
  824. //Debug.Log(tempSensorData.Count);
  825. for (int i = 0; i < tempSensorData.Count; i++)
  826. {
  827. datas.Add(new ZhaZhanJianKongData()
  828. {
  829. name = tempSensorData[i].sensor_id + "#闸门",
  830. openValue = tempSensorData[i].opening_degree * 0.01f,
  831. //openValue = 2f,
  832. state = tempSensorData[i].gate_open
  833. ? ZhaZhanState.open
  834. : ZhaZhanState.close,
  835. });
  836. }
  837. for (int i = 0; i < currentZhaZhanJianKongItems.Count; i++)
  838. {
  839. Destroy(currentZhaZhanJianKongItems[i].gameObject);
  840. }
  841. currentZhaZhanJianKongItems.Clear();
  842. if (datas != null && datas.Count > 0)
  843. {
  844. for (int i = 0; i < datas.Count; i++)
  845. {
  846. ZhaZhanJianKongItem tempItem = Instantiate(ZhaZhanJianKongItemOri, _zhaZhanJianKongContent)
  847. .GetComponent<ZhaZhanJianKongItem>();
  848. tempItem.Init();
  849. tempItem.SetData(i,datas[i]);
  850. currentZhaZhanJianKongItems.Add(tempItem);
  851. }
  852. }
  853. for (int i = 0; i < currentYiChangJingGaoItems.Count; i++)
  854. {
  855. Destroy(currentYiChangJingGaoItems[i].gameObject);
  856. }
  857. currentYiChangJingGaoItems.Clear();
  858. if (GlobalData.sensorAlertDone) {
  859. for (int i = 0; i < GlobalData.sensorAlert.list.Count; i++) {
  860. YiChangJingGaoItem tempItem = Instantiate(YiChangJingGaoItemOri, gaoJingJianKongContent)
  861. .GetComponent<YiChangJingGaoItem>();
  862. tempItem.Init();
  863. tempItem.gameObject.SetActive(false);
  864. if (currentDataType == 0)
  865. {
  866. if (GlobalData.sensorAlert.list[i].projectName.Contains("补元")) {
  867. tempItem.gameObject.SetActive(true);
  868. }
  869. }
  870. else if(currentDataType == 1) {
  871. if (GlobalData.sensorAlert.list[i].projectName.Contains("套口"))
  872. {
  873. tempItem.gameObject.SetActive(true);
  874. }
  875. }
  876. tempItem.SetData(GlobalData.sensorAlert.list[i]);
  877. currentYiChangJingGaoItems.Add(tempItem);
  878. }
  879. }
  880. float[] modelAniValues = new float[datas.Count];
  881. for (int i = 0; i < modelAniValues.Length; i++)
  882. {
  883. modelAniValues[i] = datas[i].openValue;
  884. }
  885. if (currentDataType < 2)
  886. {
  887. ActionInstance._Instance.ModelAni_On?.Invoke(currentDataType == 0 ? AniType.buYuan : AniType.taoKou,
  888. modelAniValues);
  889. }
  890. }
  891. public void SetShuiWenJianCeData(ShuiWenJianCeData data)
  892. {
  893. currentShuiWenJianCeData = data;
  894. if (currentShuiWenJianCeData != null)
  895. {
  896. _wenduText.text = $"{currentShuiWenJianCeData.wendu}<size=12><color=#A5BBE2>\u2103</color></size>";
  897. _shiduText.text = $"{currentShuiWenJianCeData.shidu} <size=12><color=#A5BBE2>%</color></size>";
  898. _qiyaText.text = $"{currentShuiWenJianCeData.qiya} <size=12><color=#A5BBE2>kPa</color></size>";
  899. _fengXiangText.text = $"{currentShuiWenJianCeData.fengxiang} <size=12><color=#A5BBE2>风</color></size>";
  900. _fengLiText.text = $"{currentShuiWenJianCeData.fengli} <size=12><color=#A5BBE2>级</color></size>";
  901. _yuLiangText.text = $"{currentShuiWenJianCeData.yuliang} <size=12><color=#A5BBE2>mm</color></size>";
  902. }
  903. }
  904. public void SetGongChengJianCe(GongChengJianCeData data)
  905. {
  906. currentGongChengJianCeData = data;
  907. if (currentGongChengJianCeData != null)
  908. {
  909. _pingJunLiuLiangText.text = $"-";
  910. _zuiGaoShuiWeiText.text = $"-";
  911. _zuiDaLiuLiangText.text = $"-";
  912. _gongChengGaoJingText.text = $"{currentGongChengJianCeData.gongChengJingGao}";
  913. _zhengChangYunXingText.text = $"{currentGongChengJianCeData.zhengChangYunXing}";
  914. }
  915. }
  916. public void SetGongChengLieBiaoData()
  917. {
  918. _DevivesDatas.Clear();
  919. string stationName = "";
  920. if (currentDataType == 0)
  921. {
  922. stationName = "补元";
  923. }
  924. else if (currentDataType == 1)
  925. {
  926. stationName = "套口";
  927. }
  928. else {
  929. stationName = "";
  930. }
  931. foreach (var devicesData in GlobalData._devicesIdDatas.Values)
  932. {
  933. if (devicesData.stationName.Equals(stationName))
  934. {
  935. GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
  936. tempLieBiaoData.name = devicesData.sensorName;
  937. tempLieBiaoData.stationName = currentDataType == 0 ? $"BY_{devicesData.sensorName}" : $"TK_{devicesData.sensorName}";
  938. tempLieBiaoData.value = devicesData.realtimeValue1;
  939. tempLieBiaoData.valueType = devicesData.unitValue1;
  940. switch (devicesData.sensorType)
  941. {
  942. case "水位计":
  943. tempLieBiaoData.type = GongChengType.shuiWei;
  944. break;
  945. case "渗压计":
  946. tempLieBiaoData.type = GongChengType.shenYaJi;
  947. break;
  948. case "静力水准仪":
  949. tempLieBiaoData.type = GongChengType.jingLiShuiZhunYi;
  950. break;
  951. case "温度":
  952. tempLieBiaoData.type = GongChengType.wenDu;
  953. break;
  954. case "引张线仪":
  955. tempLieBiaoData.type = GongChengType.yinZhangXianYi;
  956. break;
  957. case "垂线坐标仪":
  958. tempLieBiaoData.type = GongChengType.chuiXianZuoBiaoYi;
  959. break;
  960. case "土压力计":
  961. tempLieBiaoData.type = GongChengType.tuYaLiJi;
  962. break;
  963. case "应力计":
  964. tempLieBiaoData.type = GongChengType.yingLiJi;
  965. break;
  966. case "三向位错计":
  967. tempLieBiaoData.type = GongChengType.sanXiangWeiCuoJi;
  968. break;
  969. case "二向测缝计":
  970. tempLieBiaoData.type = GongChengType.erXiangCeFengJi;
  971. break;
  972. case "位移计":
  973. tempLieBiaoData.type = GongChengType.weiYiJi;
  974. break;
  975. }
  976. tempLieBiaoData.state = (GongChengState)devicesData.status;
  977. tempLieBiaoData.sid = devicesData.dataSid;
  978. tempLieBiaoData.gid = devicesData.dataGid;
  979. _DevivesDatas.Add(tempLieBiaoData);
  980. }
  981. }
  982. if (currentDataType < 2)
  983. {
  984. //监控
  985. foreach (var tempData in currentDataType == 0 ? GlobalData.obsDatas_by : GlobalData.obsDatas_tk)
  986. {
  987. GongChengLieBiaoData tempLieBiaoData = new GongChengLieBiaoData();
  988. tempLieBiaoData.name = tempData.name;
  989. tempLieBiaoData.type = GongChengType.shiPin;
  990. tempLieBiaoData.state = tempData.status ? GongChengState.normal : GongChengState.warning;
  991. tempLieBiaoData.sid = "";
  992. tempLieBiaoData.gid = ""; //监控没有这玩意
  993. _DevivesDatas.Add(tempLieBiaoData);
  994. }
  995. }
  996. GClist_QuanBuButton.GetComponentInChildren<Text>().color = Color.white;
  997. GClist_ShuiWeiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  998. GClist_ShenYaJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  999. GClist_jingLiShuiZhunYiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1000. GClist_ShiPinButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1001. for (int i = 0; i < currentGongChengLieBiaoItems.Count; i++)
  1002. {
  1003. Destroy(currentGongChengLieBiaoItems[i].gameObject);
  1004. }
  1005. currentGongChengLieBiaoItems = new List<GongChengLieBiaoItem>();
  1006. for (int i = 0; i < _DevivesDatas.Count; i++)
  1007. {
  1008. GongChengLieBiaoItem tempItem = Instantiate(GongChengLieBiaoItemOri, _gongChengLieBiaoContent)
  1009. .GetComponent<GongChengLieBiaoItem>();
  1010. tempItem.Init();
  1011. _DevivesDatas[i].index = i + 1;
  1012. tempItem.SetData(_DevivesDatas[i]);
  1013. currentGongChengLieBiaoItems.Add(tempItem);
  1014. }
  1015. }
  1016. //筛选工程列表
  1017. public void SeachGongChengList(GongChengType type)
  1018. {
  1019. GClist_QuanBuButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1020. GClist_ShuiWeiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1021. GClist_ShenYaJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1022. GClist_jingLiShuiZhunYiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1023. GClist_ShiPinButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1024. GClist_WenDuButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1025. GClist_yinZhangXianYiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1026. GClist_chuiXianZuoBiaoYiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1027. GClist_tuYaLiJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1028. GClist_yingLiJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1029. GClist_sanXiangWeiCuoJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1030. GClist_erXiangCeFengJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1031. GClist_weiYiJiButton.GetComponentInChildren<Text>().color = new Color(0.6470588f, 0.7490196f, 0.8862745f);
  1032. switch (type)
  1033. {
  1034. case GongChengType.all:
  1035. GClist_QuanBuButton.GetComponentInChildren<Text>().color = Color.white;
  1036. foreach (var obj in currentGongChengLieBiaoItems)
  1037. {
  1038. obj.gameObject.SetActive(true);
  1039. }
  1040. break;
  1041. case GongChengType.shuiWei:
  1042. GClist_ShuiWeiButton.GetComponentInChildren<Text>().color = Color.white;
  1043. foreach (var obj in currentGongChengLieBiaoItems)
  1044. {
  1045. obj.gameObject.SetActive(obj._currentData.type == GongChengType.shuiWei);
  1046. }
  1047. break;
  1048. case GongChengType.shenYaJi:
  1049. GClist_ShenYaJiButton.GetComponentInChildren<Text>().color = Color.white;
  1050. foreach (var obj in currentGongChengLieBiaoItems)
  1051. {
  1052. obj.gameObject.SetActive(obj._currentData.type == GongChengType.shenYaJi);
  1053. }
  1054. break;
  1055. case GongChengType.jingLiShuiZhunYi:
  1056. GClist_jingLiShuiZhunYiButton.GetComponentInChildren<Text>().color = Color.white;
  1057. foreach (var obj in currentGongChengLieBiaoItems)
  1058. {
  1059. obj.gameObject.SetActive(obj._currentData.type == GongChengType.jingLiShuiZhunYi);
  1060. }
  1061. break;
  1062. case GongChengType.shiPin:
  1063. GClist_ShiPinButton.GetComponentInChildren<Text>().color = Color.white;
  1064. foreach (var obj in currentGongChengLieBiaoItems)
  1065. {
  1066. obj.gameObject.SetActive(obj._currentData.type == GongChengType.shiPin);
  1067. }
  1068. break;
  1069. case GongChengType.wenDu:
  1070. GClist_WenDuButton.GetComponentInChildren<Text>().color = Color.white;
  1071. foreach (var obj in currentGongChengLieBiaoItems)
  1072. {
  1073. obj.gameObject.SetActive(obj._currentData.type == GongChengType.wenDu);
  1074. }
  1075. break;
  1076. case GongChengType.yinZhangXianYi:
  1077. GClist_yinZhangXianYiButton.GetComponentInChildren<Text>().color = Color.white;
  1078. foreach (var obj in currentGongChengLieBiaoItems)
  1079. {
  1080. obj.gameObject.SetActive(obj._currentData.type == GongChengType.yinZhangXianYi);
  1081. }
  1082. break;
  1083. case GongChengType.chuiXianZuoBiaoYi:
  1084. GClist_chuiXianZuoBiaoYiButton.GetComponentInChildren<Text>().color = Color.white;
  1085. foreach (var obj in currentGongChengLieBiaoItems)
  1086. {
  1087. obj.gameObject.SetActive(obj._currentData.type == GongChengType.chuiXianZuoBiaoYi);
  1088. }
  1089. break;
  1090. case GongChengType.tuYaLiJi:
  1091. GClist_tuYaLiJiButton.GetComponentInChildren<Text>().color = Color.white;
  1092. foreach (var obj in currentGongChengLieBiaoItems)
  1093. {
  1094. obj.gameObject.SetActive(obj._currentData.type == GongChengType.tuYaLiJi);
  1095. }
  1096. break;
  1097. case GongChengType.yingLiJi:
  1098. GClist_yingLiJiButton.GetComponentInChildren<Text>().color = Color.white;
  1099. foreach (var obj in currentGongChengLieBiaoItems)
  1100. {
  1101. obj.gameObject.SetActive(obj._currentData.type == GongChengType.yingLiJi);
  1102. }
  1103. break;
  1104. case GongChengType.sanXiangWeiCuoJi:
  1105. GClist_sanXiangWeiCuoJiButton.GetComponentInChildren<Text>().color = Color.white;
  1106. foreach (var obj in currentGongChengLieBiaoItems)
  1107. {
  1108. obj.gameObject.SetActive(obj._currentData.type == GongChengType.sanXiangWeiCuoJi);
  1109. }
  1110. break;
  1111. case GongChengType.erXiangCeFengJi:
  1112. GClist_erXiangCeFengJiButton.GetComponentInChildren<Text>().color = Color.white;
  1113. foreach (var obj in currentGongChengLieBiaoItems)
  1114. {
  1115. obj.gameObject.SetActive(obj._currentData.type == GongChengType.erXiangCeFengJi);
  1116. }
  1117. break;
  1118. case GongChengType.weiYiJi:
  1119. GClist_weiYiJiButton.GetComponentInChildren<Text>().color = Color.white;
  1120. foreach (var obj in currentGongChengLieBiaoItems)
  1121. {
  1122. obj.gameObject.SetActive(obj._currentData.type == GongChengType.weiYiJi);
  1123. }
  1124. break;
  1125. }
  1126. }
  1127. Dictionary<string, bool> BYObsUseLib = new Dictionary<string, bool>();
  1128. Dictionary<string, bool> TKObsUseLib = new Dictionary<string, bool>();
  1129. //监控列表
  1130. public async void CreatObsItem()
  1131. {
  1132. await new WaitUntil(() => { return GlobalData.obsDatas_by.Count > 0 && GlobalData.obsDatas_tk.Count > 0; });
  1133. _obsItems = new List<ObsItem>();
  1134. _obsIconCtrls = new List<ObsIconCtrl>();
  1135. for (int i = 0; i < _obsItems.Count; i++)
  1136. {
  1137. Destroy(_obsItems[i].gameObject);
  1138. }
  1139. for (int i = 0; i < _obsIconCtrls.Count; i++)
  1140. {
  1141. Destroy(_obsIconCtrls[i].gameObject);
  1142. }
  1143. for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++)
  1144. {
  1145. if (GlobalData.layerUnitDatas[i].type == LayerUnitType.JK)
  1146. {
  1147. if (GlobalData.layerUnitDatas[i].text1 == "补元退洪闸")
  1148. {
  1149. BYObsUseLib.Add(GlobalData.layerUnitDatas[i].namePri, false);
  1150. }
  1151. else if (GlobalData.layerUnitDatas[i].text1 == "套口进洪闸")
  1152. {
  1153. TKObsUseLib.Add(GlobalData.layerUnitDatas[i].namePri, false);
  1154. }
  1155. }
  1156. }
  1157. for (int i = 0; i < GlobalData.obsDatas_by.Count; i++)
  1158. {
  1159. if (BYObsUseLib.ContainsKey(GlobalData.obsDatas_by[i].targetName))
  1160. {
  1161. BYObsUseLib[GlobalData.obsDatas_by[i].targetName] = true;
  1162. }
  1163. //Debug.Log(GlobalData.obsDatas_by[i].name + ":000:" + GlobalData.obsDatas_by[i].targetName);
  1164. ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
  1165. tempItem.SetData(GlobalData.obsDatas_by[i]);
  1166. int tempi = i;
  1167. tempItem._button.onClick.AddListener(() =>
  1168. {
  1169. GCJKLayer._Instance.ShowObsPlayerPanel(GlobalData.obsDatas_by[tempi]);
  1170. });
  1171. _obsItems.Add(tempItem);
  1172. ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
  1173. //Debug.Log(GlobalData.obsDatas_by[i].name + ":111:" + GlobalData.obsDatas_by[i].targetName);
  1174. tempIcon.Init(GlobalData.obsDatas_by[i]);
  1175. _obsIconCtrls.Add(tempIcon);
  1176. //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
  1177. }
  1178. foreach (string keyName in BYObsUseLib.Keys)
  1179. {
  1180. if (!BYObsUseLib[keyName])
  1181. {
  1182. ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
  1183. ObsData errorObs = new ObsData();
  1184. errorObs.name = keyName + "(丢失)";
  1185. errorObs.targetName = keyName;
  1186. errorObs.type = obsType.BuYuanObs;
  1187. errorObs.status = false;
  1188. tempIcon.Init(errorObs);
  1189. _obsIconCtrls.Add(tempIcon);
  1190. }
  1191. }
  1192. for (int i = 0; i < GlobalData.obsDatas_tk.Count; i++)
  1193. {
  1194. if (TKObsUseLib.ContainsKey(GlobalData.obsDatas_tk[i].targetName))
  1195. {
  1196. TKObsUseLib[GlobalData.obsDatas_tk[i].targetName] = true;
  1197. }
  1198. ObsItem tempItem = Instantiate(obsItemPrefab, obsItemContent).GetComponent<ObsItem>();
  1199. tempItem.SetData(GlobalData.obsDatas_tk[i]);
  1200. int tempi = i;
  1201. tempItem._button.onClick.AddListener(() =>
  1202. {
  1203. GCJKLayer._Instance.ShowObsPlayerPanel(GlobalData.obsDatas_tk[tempi]);
  1204. });
  1205. _obsItems.Add(tempItem);
  1206. ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
  1207. tempIcon.Init(GlobalData.obsDatas_tk[i]);
  1208. _obsIconCtrls.Add(tempIcon);
  1209. //Debug.Log(StaticLod.instance.GetStaticObj(GlobalData.obsDatas[i].name).gameObject.name);
  1210. }
  1211. foreach (string keyName in TKObsUseLib.Keys)
  1212. {
  1213. if (!TKObsUseLib[keyName])
  1214. {
  1215. ObsIconCtrl tempIcon = Instantiate(obsIconPrefab, _obsIconContent).GetComponent<ObsIconCtrl>();
  1216. ObsData errorObs = new ObsData();
  1217. errorObs.name = keyName + "(丢失)";
  1218. errorObs.targetName = keyName;
  1219. errorObs.type = obsType.TaoKouObs;
  1220. errorObs.status = false;
  1221. tempIcon.Init(errorObs);
  1222. _obsIconCtrls.Add(tempIcon);
  1223. }
  1224. }
  1225. //隐藏不是当前站点的监控
  1226. var currentObsType = currentDataType == 0 ? obsType.BuYuanObs : obsType.TaoKouObs;
  1227. if (_obsItems != null)
  1228. {
  1229. for (int i = 0; i < _obsItems.Count; i++)
  1230. {
  1231. _obsItems[i].gameObject.SetActive(_obsItems[i]._data.type == currentObsType);
  1232. }
  1233. }
  1234. if (_obsIconCtrls != null)
  1235. {
  1236. for (int i = 0; i < _obsIconCtrls.Count; i++)
  1237. {
  1238. _obsIconCtrls[i].gameObject.SetActive(_obsIconCtrls[i]._data.type == currentObsType);
  1239. }
  1240. }
  1241. SetObsIconActive(ObsToggle.isOn);
  1242. }
  1243. public void SearchObsItem(string s_name)
  1244. {
  1245. if (s_name.Equals(""))
  1246. {
  1247. for (int i = 0; i < _obsItems.Count; i++)
  1248. {
  1249. _obsItems[i].gameObject.SetActive(true);
  1250. }
  1251. }
  1252. else
  1253. {
  1254. for (int i = 0; i < _obsItems.Count; i++)
  1255. {
  1256. _obsItems[i].gameObject.SetActive(_obsItems[i]._data.name.Contains(s_name));
  1257. }
  1258. }
  1259. }
  1260. //查找场景中的监控坐标对象
  1261. public void FindObsTargetObje()
  1262. {
  1263. if (_obsItems == null)
  1264. {
  1265. return;
  1266. }
  1267. GameObject[] BY_targs = GameObject.FindGameObjectsWithTag(obsType.BuYuanObs.ToString());
  1268. GameObject[] TK_targs = GameObject.FindGameObjectsWithTag(obsType.TaoKouObs.ToString());
  1269. for (int i = 0; i < _obsItems.Count; i++)
  1270. {
  1271. string objName = _obsItems[i]._data.targetName;
  1272. if (_obsItems[i]._data.type == obsType.BuYuanObs)
  1273. {
  1274. for (int j = 0; j < BY_targs.Length; j++)
  1275. {
  1276. if (BY_targs[j].gameObject.name == objName)
  1277. {
  1278. _obsItems[i]._data.targetTransform = BY_targs[j].transform;
  1279. _obsIconCtrls[i].targetTransForm = BY_targs[j].transform;
  1280. break;
  1281. }
  1282. }
  1283. }
  1284. else
  1285. {
  1286. for (int j = 0; j < TK_targs.Length; j++)
  1287. {
  1288. if (TK_targs[j].gameObject.name == objName)
  1289. {
  1290. _obsItems[i]._data.targetTransform = TK_targs[j].transform;
  1291. _obsIconCtrls[i].targetTransForm = TK_targs[j].transform;
  1292. break;
  1293. }
  1294. }
  1295. }
  1296. }
  1297. }
  1298. public void ShowObsPlayerPanel(ObsData _data)
  1299. {
  1300. obsPanel.gameObject.SetActive(true);
  1301. obsPanel.SetObsData(_data);
  1302. obsPanel.SetTitle(_data.name);
  1303. }
  1304. public void ShowHistoryPanle(ShuiWeiData data)
  1305. {
  1306. _shuiWeiHistoryPanel.SetData(data);
  1307. _shuiWeiHistoryPanel.gameObject.SetActive(true);
  1308. }
  1309. public void SetObsIconActive(bool show)
  1310. {
  1311. if (_obsIconCtrls == null)
  1312. {
  1313. return;
  1314. }
  1315. for (int i = 0; i < _obsIconCtrls.Count; i++)
  1316. {
  1317. _obsIconCtrls[i].gameObject.SetActive(_obsIconCtrls[i]._data.type == (obsType)currentDataType && show);
  1318. }
  1319. }
  1320. public void CreatIcons()
  1321. {
  1322. foreach (var t in deviceIconCtrlList)
  1323. {
  1324. Destroy(t.gameObject);
  1325. }
  1326. deviceIconCtrlList = new List<DeviceIconCtrl>();
  1327. GameObject[] IconTargets = GameObject.FindGameObjectsWithTag("DeviceIconTarget");
  1328. foreach (var t in _DevivesDatas)
  1329. {
  1330. if (t.type==GongChengType.shiPin||t.stationName == null)
  1331. {
  1332. continue;
  1333. }
  1334. foreach (var iconTarget in IconTargets)
  1335. {
  1336. if (t.stationName.Equals(iconTarget.gameObject.name))
  1337. {
  1338. Debug.Log(t.stationName);
  1339. var tempIcon= Instantiate(deviceIconPrefab, deviceIconContent).GetComponent<DeviceIconCtrl>();
  1340. DeviceIconData tempData = new DeviceIconData();
  1341. tempData.name = t.name;
  1342. tempData.targetName = iconTarget.gameObject.name;
  1343. tempData.type = t.type;
  1344. tempData.targetTransform = iconTarget.gameObject.transform;
  1345. tempData.value = t.value;
  1346. tempData.valueType = t.valueType;
  1347. tempData.sid = t.sid;
  1348. tempData.gid = t.gid;
  1349. tempIcon.Init(tempData);
  1350. deviceIconCtrlList.Add(tempIcon);
  1351. break;
  1352. }
  1353. }
  1354. }
  1355. }
  1356. //水位图标
  1357. public void CreatShuiWeiIcon()
  1358. {
  1359. for (int i = 0; i < _shuiWeiIconCtrls.Count; i++)
  1360. {
  1361. Destroy(_shuiWeiIconCtrls[i].gameObject);
  1362. }
  1363. _shuiWeiIconCtrls = new List<ShuiWeiIconCtrl>();
  1364. var DataList = currentDataType == 0 ? GlobalData.BuYuanShuiWeiDataList : GlobalData.TaoKouShuiWeiDataList;
  1365. for (int i = 0; i < DataList.Count; i++)
  1366. {
  1367. ShuiWeiIconCtrl tempIcon =
  1368. Instantiate(shuiweiIconPrefab, _shuiWeiIconContent).GetComponent<ShuiWeiIconCtrl>();
  1369. tempIcon.Init(DataList[i]);
  1370. _shuiWeiIconCtrls.Add(tempIcon);
  1371. }
  1372. Debug.Log(DataList.Count);
  1373. }
  1374. //查找场景中的水位坐标对象
  1375. public void FindShuiWeiTargetObje()
  1376. {
  1377. if (_shuiWeiIconCtrls == null)
  1378. {
  1379. return;
  1380. }
  1381. GameObject[] BY_targs = GameObject.FindGameObjectsWithTag(shuiWeiType.BuYuanShuiWei.ToString());
  1382. GameObject[] TK_targs = GameObject.FindGameObjectsWithTag(shuiWeiType.TaoKouShuiWei.ToString());
  1383. for (int i = 0; i < _shuiWeiIconCtrls.Count; i++)
  1384. {
  1385. string objName = _shuiWeiIconCtrls[i]._data.targetName;
  1386. if (_shuiWeiIconCtrls[i]._data.type == shuiWeiType.BuYuanShuiWei)
  1387. {
  1388. for (int j = 0; j < BY_targs.Length; j++)
  1389. {
  1390. if (BY_targs[j].gameObject.name == objName)
  1391. {
  1392. _shuiWeiIconCtrls[i].targetTransForm = BY_targs[j].transform;
  1393. break;
  1394. }
  1395. }
  1396. }
  1397. else
  1398. {
  1399. for (int j = 0; j < TK_targs.Length; j++)
  1400. {
  1401. if (TK_targs[j].gameObject.name == objName)
  1402. {
  1403. _shuiWeiIconCtrls[i].targetTransForm = TK_targs[j].transform;
  1404. break;
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. //水压图标
  1411. public void CreatShuiYaIcon()
  1412. {
  1413. for (int i = 0; i < _shuiYaIconCtrls.Count; i++)
  1414. {
  1415. Destroy(_shuiYaIconCtrls[i].gameObject);
  1416. }
  1417. _shuiYaIconCtrls = new List<ShuiYaIconCtrl>();
  1418. var DataList = currentDataType == 0 ? GlobalData.BuYuanShuiYaDataList : GlobalData.TaoKouShuiYaDataList;
  1419. for (int i = 0; i < DataList.Count; i++)
  1420. {
  1421. ShuiYaIconCtrl tempIcon = Instantiate(shuiYaIconPrefab, _shuiYaIconContent).GetComponent<ShuiYaIconCtrl>();
  1422. tempIcon.Init(DataList[i]);
  1423. _shuiYaIconCtrls.Add(tempIcon);
  1424. }
  1425. }
  1426. public void FindShuiYaTargetObje()
  1427. {
  1428. if (_shuiYaIconCtrls == null)
  1429. {
  1430. return;
  1431. }
  1432. GameObject[] BY_targs = GameObject.FindGameObjectsWithTag(shuiYaType.BuYuanShuiYa.ToString());
  1433. GameObject[] TK_targs = GameObject.FindGameObjectsWithTag(shuiYaType.TaoKouShuiYa.ToString());
  1434. for (int i = 0; i < _shuiYaIconCtrls.Count; i++)
  1435. {
  1436. string objName = _shuiYaIconCtrls[i]._data.targetName;
  1437. if (_shuiYaIconCtrls[i]._data.type == shuiYaType.BuYuanShuiYa)
  1438. {
  1439. for (int j = 0; j < BY_targs.Length; j++)
  1440. {
  1441. if (BY_targs[j].gameObject.name == objName)
  1442. {
  1443. _shuiYaIconCtrls[i].targetTransForm = BY_targs[j].transform;
  1444. break;
  1445. }
  1446. }
  1447. }
  1448. else
  1449. {
  1450. for (int j = 0; j < TK_targs.Length; j++)
  1451. {
  1452. if (TK_targs[j].gameObject.name == objName)
  1453. {
  1454. _shuiYaIconCtrls[i].targetTransForm = TK_targs[j].transform;
  1455. break;
  1456. }
  1457. }
  1458. }
  1459. }
  1460. }
  1461. //位移图标
  1462. public void CreatWeiYiIcon()
  1463. {
  1464. for (int i = 0; i < _weiYiIconCtrls.Count; i++)
  1465. {
  1466. Destroy(_weiYiIconCtrls[i].gameObject);
  1467. }
  1468. _weiYiIconCtrls = new List<WeiYiIconCtrl>();
  1469. var DataList = currentDataType == 0 ? GlobalData.BuYuanWeiYiDataList : GlobalData.TaoKouWeiYiDataList;
  1470. for (int i = 0; i < DataList.Count; i++)
  1471. {
  1472. WeiYiIconCtrl tempIcon = Instantiate(weiYiIconPrefab, _weiYiIconContent).GetComponent<WeiYiIconCtrl>();
  1473. tempIcon.Init(DataList[i]);
  1474. _weiYiIconCtrls.Add(tempIcon);
  1475. }
  1476. }
  1477. public void FindWeiYiTargetObje()
  1478. {
  1479. if (_weiYiIconCtrls == null)
  1480. {
  1481. return;
  1482. }
  1483. GameObject[] BY_targs = GameObject.FindGameObjectsWithTag(weiYiType.BuYuanWeiYi.ToString());
  1484. GameObject[] TK_targs = GameObject.FindGameObjectsWithTag(weiYiType.TaoKouWeiYi.ToString());
  1485. for (int i = 0; i < _weiYiIconCtrls.Count; i++)
  1486. {
  1487. string objName = _weiYiIconCtrls[i]._data.targetName;
  1488. if (_weiYiIconCtrls[i]._data.type == weiYiType.BuYuanWeiYi)
  1489. {
  1490. for (int j = 0; j < BY_targs.Length; j++)
  1491. {
  1492. if (BY_targs[j].gameObject.name == objName)
  1493. {
  1494. _weiYiIconCtrls[i].targetTransForm = BY_targs[j].transform;
  1495. break;
  1496. }
  1497. }
  1498. }
  1499. else
  1500. {
  1501. for (int j = 0; j < TK_targs.Length; j++)
  1502. {
  1503. if (TK_targs[i].gameObject.name == objName)
  1504. {
  1505. _weiYiIconCtrls[i].targetTransForm = TK_targs[j].transform;
  1506. break;
  1507. }
  1508. }
  1509. }
  1510. }
  1511. }
  1512. public void Set_shuiWeiJi_IconActive(bool show)
  1513. {
  1514. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.shuiWei))
  1515. {
  1516. t.gameObject.SetActive(show);
  1517. }
  1518. }
  1519. public void Set_shenYaJi_IconActive(bool show)
  1520. {
  1521. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.shenYaJi))
  1522. {
  1523. t.gameObject.SetActive(show);
  1524. }
  1525. }
  1526. public void Set_jingLiShuiZhunYi_IconActive(bool show)
  1527. {
  1528. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.jingLiShuiZhunYi))
  1529. {
  1530. t.gameObject.SetActive(show);
  1531. }
  1532. }
  1533. public void Set_wenDu_IconActive(bool show)
  1534. {
  1535. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.wenDu))
  1536. {
  1537. t.gameObject.SetActive(show);
  1538. }
  1539. }
  1540. public void Set_yinZhangXianYi_IconActive(bool show)
  1541. {
  1542. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.yinZhangXianYi))
  1543. {
  1544. t.gameObject.SetActive(show);
  1545. }
  1546. }
  1547. public void Set_chuiXianZuoBiaoYi_IconActive(bool show)
  1548. {
  1549. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.chuiXianZuoBiaoYi))
  1550. {
  1551. t.gameObject.SetActive(show);
  1552. }
  1553. }
  1554. public void Set_tuYaLiJi_IconActive(bool show)
  1555. {
  1556. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.tuYaLiJi))
  1557. {
  1558. t.gameObject.SetActive(show);
  1559. }
  1560. }
  1561. public void Set_yingLiJi_IconActive(bool show)
  1562. {
  1563. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.yingLiJi))
  1564. {
  1565. t.gameObject.SetActive(show);
  1566. }
  1567. }
  1568. public void Set_sanXiangWeiCuoJi_IconActive(bool show)
  1569. {
  1570. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.sanXiangWeiCuoJi))
  1571. {
  1572. t.gameObject.SetActive(show);
  1573. }
  1574. }
  1575. public void Set_erXiangCeFengJi_IconActive(bool show)
  1576. {
  1577. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.erXiangCeFengJi))
  1578. {
  1579. t.gameObject.SetActive(show);
  1580. }
  1581. }
  1582. public void Set_weiYiJi_IconActive(bool show)
  1583. {
  1584. foreach (var t in deviceIconCtrlList.Where(t => t._data.type == GongChengType.weiYiJi))
  1585. {
  1586. t.gameObject.SetActive(show);
  1587. }
  1588. }
  1589. public GameObject gongChengPanel;
  1590. public Text zhaZhanMingCheng;
  1591. public Text zhaMenKaiDu;
  1592. public Text guoZhaLiuLiang;
  1593. public Text zhaQianShuiWei;
  1594. public Text zhaHouShuiWei;
  1595. public BarChart shuiweiChart;
  1596. public void OpenZhaMenInfoPanel(int _index, ZhaZhanJianKongData itemData)
  1597. {
  1598. gongChengPanel.SetActive(true);
  1599. zhaZhanMingCheng.text = itemData.name;
  1600. var floorGateData = currentDataType == 0 ? GlobalData.floorGateData.buYuan : GlobalData.floorGateData.taoKou;
  1601. zhaMenKaiDu.text = $"{itemData.openValue:0.00}<size=14><color=#A5BFE2>m</color></size>";
  1602. guoZhaLiuLiang.text = $"-<size=14><color=#A5BFE2>m\u00b3/s</color></size>";
  1603. if (currentDataType == 0)
  1604. {
  1605. string swUp = null;
  1606. string swDown = null;
  1607. string swUpName = "";
  1608. string swDownName = "";
  1609. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  1610. {
  1611. if (GlobalData.swDatas[i].stnm == "补元(闸上)")
  1612. {
  1613. swUp = GlobalData.swDatas[i].upz;
  1614. swUpName = GlobalData.swDatas[i].stnm;
  1615. }
  1616. if (GlobalData.swDatas[i].stnm == "补元(闸下)")
  1617. {
  1618. swDown = GlobalData.swDatas[i].dwz;
  1619. swDownName = GlobalData.swDatas[i].stnm;
  1620. }
  1621. }
  1622. zhaQianShuiWei.text = swUp == null ? $"- <size=14><color=#A5BFE2>m</color></size>" : $"{swUp} <size=14><color=#A5BFE2>m</color></size>";
  1623. zhaHouShuiWei.text = swDown == null ? $"- <size=14><color=#A5BFE2>m</color></size>" : $"{swDown} <size=14><color=#A5BFE2>m</color></size>";
  1624. }
  1625. else
  1626. {
  1627. string swUp = null;
  1628. string swDown =null;
  1629. string swUpName="";
  1630. string swDownName="";
  1631. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  1632. {
  1633. if (GlobalData.swDatas[i].stnm == "套口(闸上)")
  1634. {
  1635. swUp = GlobalData.swDatas[i].upz;
  1636. swUpName = GlobalData.swDatas[i].stnm;
  1637. }
  1638. if (GlobalData.swDatas[i].stnm == "套口(闸下)")
  1639. {
  1640. swDown = GlobalData.swDatas[i].dwz;
  1641. swDownName = GlobalData.swDatas[i].stnm;
  1642. }
  1643. }
  1644. zhaQianShuiWei.text = swUp == null ? $"- <size=14><color=#A5BFE2>m</color></size>" : $"{swUp} <size=14><color=#A5BFE2>m</color></size>";
  1645. zhaHouShuiWei.text = swDown == null ? $"- <size=14><color=#A5BFE2>m</color></size>" : $"{swDown} <size=14><color=#A5BFE2>m</color></size>";
  1646. }
  1647. var shuiweiData = currentDataType == 0 ? GlobalData.floorGateData.swzxtBY : GlobalData.floorGateData.swzxtTK;
  1648. var finalData = new CharData_water[shuiweiData.Length];
  1649. for (int i = 0; i < shuiweiData.Length; i++)
  1650. {
  1651. finalData[i] = shuiweiData[shuiweiData.Length - 1 - i];
  1652. }
  1653. XAxis tempXaxis = shuiweiChart.GetChartComponent<XAxis>();
  1654. tempXaxis.data.Clear();
  1655. for (int i = 0; i < finalData.Length; i++)
  1656. {
  1657. tempXaxis.AddData(finalData[i].key);
  1658. }
  1659. var tempSeries = shuiweiChart.series;
  1660. tempSeries[0].serieName = "水位";
  1661. SerieData[] tempDatas = new SerieData[finalData.Length];
  1662. for (int i = 0; i < tempDatas.Length; i++)
  1663. {
  1664. tempDatas[i] = new SerieData();
  1665. tempDatas[i].data = new List<double>();
  1666. tempDatas[i].data.Add(i);
  1667. string value = finalData[i].value;
  1668. if (value == "-") {
  1669. value = "-1";
  1670. }
  1671. tempDatas[i].data.Add(float.Parse(value));
  1672. }
  1673. tempSeries[0].data.Clear();
  1674. tempSeries[0].data.AddRange(tempDatas);
  1675. }
  1676. }