YZTLayer.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Threading.Tasks;
  7. using UnityEngine;
  8. using UnityEngine.Networking;
  9. using UnityEngine.UI;
  10. using UnityAsync;
  11. using WaitUntil = UnityAsync.WaitUntil;
  12. using DG.Tweening;
  13. using Unity.VisualScripting;
  14. using System.Reflection;
  15. using System.Linq;
  16. [System.Serializable]
  17. public class YZTLayerData
  18. {
  19. public string layerName;
  20. public int layerID;
  21. }
  22. public enum LayerUnitType
  23. {
  24. ZZ = 1,
  25. BZ,
  26. NC,
  27. QXZ,
  28. JK,
  29. QT
  30. }
  31. [System.Serializable]
  32. public class JKYJData
  33. {
  34. public int normal;
  35. public int total;
  36. public int fault;
  37. public List<JKYJChildData> items;
  38. }
  39. [System.Serializable]
  40. public class JKYJChildData
  41. {
  42. public string name;
  43. public string model;
  44. public string ipAddress;
  45. public string deviceId;
  46. public string channelId;
  47. public bool onlineStatus;
  48. }
  49. public class GCGKData
  50. {
  51. public string name;
  52. public string type;
  53. public int count;
  54. }
  55. [System.Serializable]
  56. public class LayerUnitData
  57. {
  58. public string special;
  59. public LayerUnitType type;
  60. public float longitude;
  61. public float latitude;
  62. public string name;
  63. public string namePri;
  64. public string text1;
  65. public string text2;
  66. public string GetTypeName()
  67. {
  68. string result = "";
  69. switch (type)
  70. {
  71. case LayerUnitType.ZZ:
  72. result = "闸站";
  73. break;
  74. case LayerUnitType.BZ:
  75. result = "泵站";
  76. break;
  77. case LayerUnitType.NC:
  78. result = "农场";
  79. break;
  80. case LayerUnitType.QXZ:
  81. result = "气象站";
  82. break;
  83. case LayerUnitType.JK:
  84. result = "监控";
  85. break;
  86. case LayerUnitType.QT:
  87. result = "其他";
  88. break;
  89. }
  90. return result;
  91. }
  92. }
  93. [System.Serializable]
  94. public class HotPointData
  95. {
  96. public LayerUnitType type;
  97. public float longitude;
  98. public float latitude;
  99. public string name;
  100. public string namePri;
  101. }
  102. [System.Serializable]
  103. public class SWStationRecordData
  104. {
  105. public string name;
  106. public string time;
  107. public string value;
  108. public int dir;
  109. public string stcd = "0";
  110. }
  111. public class YZTLayer : YZTRootLayer
  112. {
  113. public VerticalLayoutGroup content;
  114. public Sprite[] layerSprite;
  115. public Sprite[] hotPointSprite;
  116. public LayerBtn layerBtnPrefab;
  117. public SecLayerBtn secLayerBtnPrefab;
  118. public YZTLayerData[] layerDatas;
  119. public RectTransform leftContent;
  120. public RectTransform middleContent;
  121. public RectTransform rightContent;
  122. List<LayerBtn> layerBtns = new List<LayerBtn>();
  123. public RuntimePoint pointPrefab;
  124. public GameObject runtimePointObj;
  125. public RectTransform pointParent;
  126. List<RuntimePoint> runtimePointLib = new List<RuntimePoint>();
  127. public GameObject yZTMini;
  128. public GameObject yZT;
  129. public RectTransform infoRight;
  130. public Button returnBtn;
  131. private float clickInterval;
  132. private Vector3 startClickPosition;
  133. public Button[] leftButtons;
  134. public Button layerButton;
  135. public int currentActiveLeft = 0;
  136. public RectTransform layerInfo;
  137. public Button layerInfoExitBtn;
  138. public Button[] baseLayerInfoBtns;
  139. public Button[] layerInfoBtns;
  140. public List<int> cancelLayer = new List<int>();
  141. public Sprite[] sprites;
  142. public Text rainText;
  143. public Text[] rainTextNum;
  144. public GameObject thingPrefab;
  145. public RectTransform thingParent;
  146. public List<SWStationRecordData> rescordSWStationData = new List<SWStationRecordData>();
  147. public List<GameObject> thing3s = new List<GameObject>();
  148. public Button clearBtn;
  149. public RectTransform regionParent;
  150. public RectTransform[] riverLayerInfo;
  151. public RectTransform[] lakeLayerInfo;
  152. public GameObject regionObjParent;
  153. public GameObject regionObjParent2;
  154. public GameObject[] regionLayerObj;
  155. public GameObject[] riverLayerObj;
  156. public GameObject[] lakeLayerObj;
  157. public GameObject[] aqqLayerObj;
  158. public List<GameObject> region2LayerObj = new List<GameObject>();
  159. // Start is called before the first frame update
  160. public GameObject waterTrendPanelOri;
  161. public WaterTrendPanel _waterTrendPanel;
  162. public Item0 item0Prefab;
  163. public GameObject item0Parent;
  164. public Text normalCount;
  165. public Text badCount;
  166. public Text stopCount;
  167. public Text allCount;
  168. public Thing0 thing0Prefab;
  169. public RectTransform thing0Content;
  170. public Text totalJKNum;
  171. public Text normalJKNum;
  172. public Text errorJKNum;
  173. public Text currentSWText;
  174. public Text avgSWText;
  175. public Text sfSWText;
  176. public Text jjSWText;
  177. public Text bzSWText;
  178. async void Awake()
  179. {
  180. viewMode = ViewMode.miniMap;
  181. _waterTrendPanel = Instantiate(waterTrendPanelOri, this.transform).GetComponent<WaterTrendPanel>();
  182. _waterTrendPanel.Init();
  183. _waterTrendPanel.gameObject.SetActive(false);
  184. HideMain();
  185. await InitData();
  186. Init();
  187. InitLeftBtn();
  188. InitLayerInfo();
  189. InitLayerBtns();
  190. InitReturnBtn();
  191. InitGCGKData();
  192. InitJKYJData();
  193. InitSWYJData();
  194. InitRainInfo();
  195. InitSWHeightInfo();
  196. await InitPointData();
  197. InitPoint();
  198. }
  199. void HideMain()
  200. {
  201. clearBtn.GetComponent<Image>().sprite = sprites[1];
  202. leftContent.GetComponent<RectTransform>().anchoredPosition = new Vector2(-219.74f, 0);
  203. leftContent.GetComponent<CanvasGroup>().alpha = 0;
  204. pointParent.gameObject.SetActive(true);
  205. middleContent.GetComponent<RectTransform>().anchoredPosition = new Vector2(400f, 540);
  206. rightContent.GetComponent<RectTransform>().anchoredPosition = new Vector2(220.6f, 419.8932f);
  207. rightContent.GetComponent<CanvasGroup>().alpha = 0;
  208. clearBtn.GetComponent<RectTransform>().anchoredPosition = new Vector2(-827f, clearBtn.GetComponent<RectTransform>().anchoredPosition.y);
  209. }
  210. async void InitGCGKData()
  211. {
  212. //await new WaitUntil(() =>
  213. //{
  214. // return GlobalData.gcgkContents.Count > 2;
  215. //});
  216. //normalCount.text = GlobalData.gcgkContents[0].count.ToString() + "个";
  217. //badCount.text = GlobalData.gcgkContents[1].count.ToString() + "个";
  218. //stopCount.text = GlobalData.gcgkContents[2].count.ToString() + "个";
  219. //allCount.text = (GlobalData.gcgkContents[0].count + GlobalData.gcgkContents[1].count + GlobalData.gcgkContents[2].count).ToString() + "个";
  220. }
  221. async void InitJKYJData()
  222. {
  223. // Debug.Log("111");
  224. await new WaitUntil(() =>
  225. {
  226. return GlobalData.byJKYJContents.total > 0 && GlobalData.tkJKYJContents.total > 0;
  227. });
  228. //Debug.Log("222");
  229. for (int i = 0; i < GlobalData.byJKYJContents.items.Count; i++)
  230. {
  231. Thing0 thing0 = Instantiate(thing0Prefab);
  232. thing0.transform.SetParent(thing0Content);
  233. thing0.transform.localPosition = Vector3.zero;
  234. thing0.transform.localScale = Vector3.one;
  235. thing0.SetData(i.ToString(), GlobalData.byJKYJContents.items[i].name, "补元", "开启", GlobalData.byJKYJContents.items[i].onlineStatus ? "正常" : "故障");
  236. }
  237. //Debug.Log("333");
  238. for (int i = 0; i < GlobalData.tkJKYJContents.items.Count; i++)
  239. {
  240. Thing0 thing0 = Instantiate(thing0Prefab);
  241. thing0.transform.SetParent(thing0Content);
  242. thing0.transform.localPosition = Vector3.zero;
  243. thing0.transform.localScale = Vector3.one;
  244. thing0.SetData((i + GlobalData.byJKYJContents.total).ToString(), GlobalData.tkJKYJContents.items[i].name, "套口", "开启", GlobalData.tkJKYJContents.items[i].onlineStatus ? "正常" : "故障");
  245. }
  246. // Debug.Log("444");
  247. totalJKNum.text = (GlobalData.byJKYJContents.total + GlobalData.tkJKYJContents.total).ToString();
  248. normalJKNum.text = (GlobalData.byJKYJContents.normal + GlobalData.tkJKYJContents.normal).ToString();
  249. errorJKNum.text = (GlobalData.byJKYJContents.fault + GlobalData.tkJKYJContents.fault).ToString();
  250. }
  251. async void InitSWYJData()
  252. {
  253. //Debug.Log("555");
  254. await new WaitUntil(() =>
  255. {
  256. return GlobalData.swDatas.Count > 1;
  257. //return GlobalData.TaoKouShuiWeiDataList.Count > 1;
  258. });
  259. //Debug.Log("666");
  260. //float value1 = GlobalData.TaoKouShuiWeiDataList[0].value;
  261. //float value2 = GlobalData.TaoKouShuiWeiDataList[1].value;
  262. //if (value1 > 1000)
  263. //{
  264. // value1 = value1 / 100.0f;
  265. //}
  266. //if (value2 > 1000)
  267. //{
  268. // value2 = value2 / 100.0f;
  269. //}
  270. int index1 = FindIndexByHotPointName("套口(闸上)");
  271. int index2 = FindIndexByHotPointName("套口(闸下)");
  272. string value1 = GlobalData.swDatas[index1].upz ;
  273. string value2 = GlobalData.swDatas[index1].dwz;
  274. float avgValue = 0f;
  275. bool hasNumber1 = float.TryParse(value1, out float num1);
  276. bool hasNumber2 = float.TryParse(value2, out float num2);
  277. if (value1 == "-" && value2 == "-")
  278. {
  279. avgSWText.text = "-";
  280. }
  281. else if (hasNumber1 && hasNumber2)
  282. {
  283. avgValue = (num1 + num2) / 2;
  284. avgSWText.text = avgValue.ToString("0.00");
  285. }
  286. else if (hasNumber1)
  287. {
  288. avgSWText.text = num1.ToString("0.00");
  289. }
  290. else if (hasNumber2)
  291. {
  292. avgSWText.text = num2.ToString("0.00");
  293. }
  294. sfSWText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].floodProtectionLevel}";
  295. jjSWText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].warningLevel}";
  296. bzSWText.text = $"{GlobalData.threeLevelShuiWeiDatas[1].guaranteeLevel}";
  297. currentSWText.text = value1;
  298. }
  299. void InitLeftBtn()
  300. {
  301. for (int i = 0; i < leftButtons.Length; i++)
  302. {
  303. int temp = i;
  304. leftButtons[i].onClick.AddListener(() =>
  305. {
  306. LeftBtnClick(temp);
  307. });
  308. }
  309. LeftBtnClick(0);
  310. clearBtn.onClick.AddListener(() =>
  311. {
  312. if (clearBtn.GetComponent<Image>().sprite == sprites[0])
  313. {
  314. for (int i = 0; i < leftButtons.Length; i++)
  315. leftButtons[i].gameObject.SetActive(false);
  316. clearBtn.GetComponent<Image>().sprite = sprites[1];
  317. DOTween.To(() => leftContent.GetComponent<RectTransform>().anchoredPosition, x => leftContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(-219.74f, 0), 0.3f);
  318. DOTween.To(() => leftContent.GetComponent<CanvasGroup>().alpha, x => leftContent.GetComponent<CanvasGroup>().alpha = x, 0, 0.3f);
  319. pointParent.gameObject.SetActive(true);
  320. DOTween.To(() => middleContent.GetComponent<RectTransform>().anchoredPosition, x => middleContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(400f, 540), 0.3f);
  321. DOTween.To(() => rightContent.GetComponent<RectTransform>().anchoredPosition, x => rightContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(220.6f, 419.8932f), 0.3f);
  322. DOTween.To(() => rightContent.GetComponent<CanvasGroup>().alpha, x => rightContent.GetComponent<CanvasGroup>().alpha = x, 0, 0.3f);
  323. clearBtn.GetComponent<RectTransform>().DOLocalMoveX(-827f, 0.3f);
  324. }
  325. else
  326. {
  327. for (int i = 0; i < leftButtons.Length; i++)
  328. leftButtons[i].gameObject.SetActive(true);
  329. clearBtn.GetComponent<Image>().sprite = sprites[0];
  330. DOTween.To(() => leftContent.GetComponent<RectTransform>().anchoredPosition, x => leftContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(219.74f, 0), 0.3f);
  331. DOTween.To(() => leftContent.GetComponent<CanvasGroup>().alpha, x => leftContent.GetComponent<CanvasGroup>().alpha = x, 1, 0.3f);
  332. pointParent.gameObject.SetActive(true);
  333. DOTween.To(() => middleContent.GetComponent<RectTransform>().anchoredPosition, x => middleContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(0f, 540), 0.3f);
  334. DOTween.To(() => rightContent.GetComponent<RectTransform>().anchoredPosition, x => rightContent.GetComponent<RectTransform>().anchoredPosition = x, new Vector2(-220.6f, 419.8932f), 0.3f);
  335. DOTween.To(() => rightContent.GetComponent<CanvasGroup>().alpha, x => rightContent.GetComponent<CanvasGroup>().alpha = x, 1, 0.3f);
  336. clearBtn.GetComponent<RectTransform>().DOLocalMoveX(-457f, 0.3f);
  337. }
  338. });
  339. for (int i = 0; i < leftButtons.Length; i++)
  340. leftButtons[i].gameObject.SetActive(false);
  341. }
  342. async void InitSWHeightInfo()
  343. {
  344. await new WaitUntil(() =>
  345. {
  346. return GlobalData.swDatas.Count > 0;
  347. });
  348. if (rescordSWStationData.Count < 1)
  349. {
  350. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  351. {
  352. SWStationRecordData sWStationRecordData = new SWStationRecordData();
  353. sWStationRecordData.dir = 0;
  354. sWStationRecordData.name = GlobalData.swDatas[i].stnm;
  355. float valueUpz = GlobalData.swDatas[i].upz == "-" ? float.MinValue : float.Parse(GlobalData.swDatas[i].upz);
  356. float valueDwz = GlobalData.swDatas[i].dwz == "-" ? float.MinValue : float.Parse(GlobalData.swDatas[i].dwz);
  357. if (valueUpz == float.MinValue && valueDwz == float.MinValue)
  358. {
  359. sWStationRecordData.value = "-";
  360. }
  361. else if (valueUpz == float.MinValue)
  362. {
  363. sWStationRecordData.value = GlobalData.swDatas[i].dwz;
  364. }
  365. else if (valueDwz == float.MinValue)
  366. {
  367. sWStationRecordData.value = GlobalData.swDatas[i].upz;
  368. }
  369. else
  370. {
  371. sWStationRecordData.value = (valueUpz > valueDwz) ? GlobalData.swDatas[i].upz : GlobalData.swDatas[i].dwz;
  372. }
  373. sWStationRecordData.time = DateTime.Now.ToString("MM/dd HH:mm");
  374. sWStationRecordData.stcd = GlobalData.swDatas[i].stcd;
  375. rescordSWStationData.Add(sWStationRecordData);
  376. }
  377. for (int i = 0; i < rescordSWStationData.Count; i++)
  378. {
  379. GameObject obj = Instantiate(thingPrefab);
  380. obj.GetComponent<RectTransform>().SetParent(thingParent);
  381. obj.transform.localScale = Vector3.one;
  382. obj.transform.GetChild(0).GetComponent<Text>().text = (i + 1).ToString();
  383. string rescordSW_name = rescordSWStationData[i].name.ToString(); ;
  384. obj.transform.GetChild(1).GetComponent<Text>().text = rescordSW_name;
  385. obj.transform.GetChild(2).GetComponent<Text>().text = rescordSWStationData[i].time.ToString();
  386. obj.transform.GetChild(3).GetComponent<Text>().text = rescordSWStationData[i].value.ToString();
  387. string rescordSW_stcd = rescordSWStationData[i].stcd;
  388. obj.transform.GetComponent<Button>().onClick.AddListener(() =>
  389. {
  390. _waterTrendPanel.ShowTrend(rescordSW_stcd, rescordSW_name,0);
  391. });
  392. if (rescordSWStationData[i].dir == 0)
  393. {
  394. obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 0);
  395. }
  396. else if (rescordSWStationData[i].dir == 1)
  397. {
  398. obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 90);
  399. }
  400. else
  401. {
  402. obj.transform.GetChild(4).localEulerAngles = new Vector3(0, 0, -90);
  403. }
  404. thing3s.Add(obj);
  405. }
  406. }
  407. else
  408. {
  409. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  410. {
  411. rescordSWStationData[i].name = GlobalData.swDatas[i].stnm;
  412. // float lastValue = rescordSWStationData[i].value;
  413. float valueUpz = GlobalData.swDatas[i].upz == "-" ? float.MinValue : float.Parse(GlobalData.swDatas[i].upz);
  414. float valueDwz = GlobalData.swDatas[i].dwz == "-" ? float.MinValue : float.Parse(GlobalData.swDatas[i].dwz);
  415. if (valueUpz == float.MinValue && valueDwz == float.MinValue)
  416. {
  417. rescordSWStationData[i].value = "-";
  418. }
  419. else if (valueUpz == float.MinValue)
  420. {
  421. rescordSWStationData[i].value = GlobalData.swDatas[i].dwz;
  422. }
  423. else if (valueDwz == float.MinValue)
  424. {
  425. rescordSWStationData[i].value = GlobalData.swDatas[i].upz;
  426. }
  427. else
  428. {
  429. rescordSWStationData[i].value = (valueUpz > valueDwz) ? GlobalData.swDatas[i].upz : GlobalData.swDatas[i].dwz;
  430. }
  431. rescordSWStationData[i].time = DateTime.Now.ToString("MM/dd HH:mm");
  432. //if (rescordSWStationData[i].value > lastValue)
  433. //{
  434. // rescordSWStationData[i].dir = 1;
  435. //}
  436. //else if (rescordSWStationData[i].value > lastValue)
  437. //{
  438. // rescordSWStationData[i].dir = 0;
  439. //}
  440. //else
  441. //{
  442. // rescordSWStationData[i].dir = -1;
  443. //}
  444. }
  445. for (int i = 0; i < rescordSWStationData.Count; i++)
  446. {
  447. thing3s[i].transform.GetChild(0).GetComponent<Text>().text = (i + 1).ToString();
  448. thing3s[i].transform.GetChild(1).GetComponent<Text>().text = rescordSWStationData[i].name.ToString();
  449. thing3s[i].transform.GetChild(2).GetComponent<Text>().text = rescordSWStationData[i].time.ToString();
  450. thing3s[i].transform.GetChild(3).GetComponent<Text>().text = rescordSWStationData[i].value.ToString();
  451. if (rescordSWStationData[i].dir == 0)
  452. {
  453. thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 0);
  454. }
  455. else if (rescordSWStationData[i].dir == 1)
  456. {
  457. thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, 90);
  458. }
  459. else
  460. {
  461. thing3s[i].transform.GetChild(4).localEulerAngles = new Vector3(0, 0, -90);
  462. }
  463. }
  464. }
  465. }
  466. async void InitRainInfo()
  467. {
  468. await new WaitUntil(() =>
  469. {
  470. return GlobalData.sWZDatas.Count > 0;
  471. });
  472. int swzCount = GlobalData.sWZDatas.Count;
  473. string maxName = "";
  474. float maxValue = -99f;
  475. int value010 = 0;
  476. int value1025 = 0;
  477. int value2550 = 0;
  478. int value50100 = 0;
  479. int value100200 = 0;
  480. int value200 = 0;
  481. for (int i = 0; i < swzCount; i++)
  482. {
  483. float value = GlobalData.sWZDatas[i].dropSum6;
  484. if (value > maxValue)
  485. {
  486. maxValue = value;
  487. maxName = GlobalData.sWZDatas[i].STNM;
  488. }
  489. if (value >= 0 && value < 10)
  490. {
  491. value010++;
  492. }
  493. else if (value >= 10 && value < 25)
  494. {
  495. value1025++;
  496. }
  497. else if (value >= 25 && value < 50)
  498. {
  499. value2550++;
  500. }
  501. else if (value >= 50 && value < 100)
  502. {
  503. value50100++;
  504. }
  505. else if (value >= 100 && value < 200)
  506. {
  507. value100200++;
  508. }
  509. else
  510. {
  511. value200++;
  512. }
  513. }
  514. rainText.text = $"数据时间:(过去24小时)\r\n蓄洪区共有{swzCount}个雨量站,其中几个雨量站监测有降雨最大降雨测站为{maxName}站点,降雨量{maxValue}mm.";
  515. rainTextNum[0].text = value010.ToString();
  516. rainTextNum[1].text = value1025.ToString();
  517. rainTextNum[2].text = value2550.ToString();
  518. rainTextNum[3].text = value50100.ToString();
  519. rainTextNum[4].text = value100200.ToString();
  520. rainTextNum[5].text = value200.ToString();
  521. }
  522. void InitLayerInfo()
  523. {
  524. //layerInfoBtns = layerInfo.GetComponentsInChildren<Button>();
  525. for (int i = 0; i < layerInfoBtns.Length; i++)
  526. {
  527. int temp = i;
  528. layerInfoBtns[i].onClick.AddListener(() =>
  529. {
  530. RunTimeLayerClick(temp);
  531. });
  532. }
  533. layerButton.onClick.AddListener(() =>
  534. {
  535. layerInfo.gameObject.SetActive(true);
  536. });
  537. layerInfoExitBtn.onClick.AddListener(() =>
  538. {
  539. layerInfo.gameObject.SetActive(false);
  540. });
  541. baseLayerInfoBtns[0].onClick.AddListener(() =>
  542. {
  543. bool active = baseLayerInfoBtns[0].GetComponent<CanvasGroup>().alpha > 0.5f;
  544. BaseLayer0BtnOnClick(!active);
  545. });
  546. baseLayerInfoBtns[0].GetComponent<CanvasGroup>().alpha = 0.5f;
  547. baseLayerInfoBtns[1].onClick.AddListener(() =>
  548. {
  549. bool active = baseLayerInfoBtns[1].GetComponent<CanvasGroup>().alpha > 0.5f;
  550. baseLayerInfoBtns[1].GetComponent<CanvasGroup>().alpha = active ? 0.5f : 1.0f;
  551. bool newActive = !active;
  552. for (int i = 0; i < riverLayerObj.Length; i++)
  553. {
  554. riverLayerObj[i].gameObject.SetActive(newActive);
  555. riverLayerInfo[i].gameObject.SetActive(newActive);
  556. }
  557. });
  558. baseLayerInfoBtns[1].GetComponent<CanvasGroup>().alpha = 0.5f;
  559. baseLayerInfoBtns[2].onClick.AddListener(() =>
  560. {
  561. bool active = baseLayerInfoBtns[2].GetComponent<CanvasGroup>().alpha > 0.5f;
  562. BaseLayer2BtnOnClick(!active);
  563. });
  564. baseLayerInfoBtns[2].GetComponent<CanvasGroup>().alpha = 0.5f;
  565. for (int i = 0; i < regionObjParent2.transform.childCount; i++)
  566. {
  567. region2LayerObj.Add(regionObjParent2.transform.GetChild(i).gameObject);
  568. }
  569. baseLayerInfoBtns[3].onClick.AddListener(() =>
  570. {
  571. bool active = baseLayerInfoBtns[3].GetComponent<CanvasGroup>().alpha > 0.5f;
  572. BaseLayer3BtnOnClick(!active);
  573. });
  574. baseLayerInfoBtns[3].GetComponent<CanvasGroup>().alpha = 0.5f;
  575. baseLayerInfoBtns[4].onClick.AddListener(() =>
  576. {
  577. bool active = baseLayerInfoBtns[4].GetComponent<CanvasGroup>().alpha > 0.5f;
  578. BaseLayer4BtnOnClick(!active);
  579. });
  580. baseLayerInfoBtns[4].GetComponent<CanvasGroup>().alpha = 0.5f;
  581. }
  582. void BaseLayer0BtnOnClick(bool newActive)
  583. {
  584. baseLayerInfoBtns[0].GetComponent<CanvasGroup>().alpha = newActive ? 1f : 0.5f;
  585. if (newActive)
  586. {
  587. //BaseLayer2BtnOnClick(false);
  588. //BaseLayer3BtnOnClick(false);
  589. }
  590. for (int i = 0; i < regionLayerObj.Length; i++)
  591. {
  592. regionLayerObj[i].gameObject.SetActive(newActive);
  593. }
  594. }
  595. void BaseLayer2BtnOnClick(bool newActive)
  596. {
  597. if (newActive)
  598. {
  599. //BaseLayer0BtnOnClick(false);
  600. //BaseLayer3BtnOnClick(false);
  601. }
  602. baseLayerInfoBtns[2].GetComponent<CanvasGroup>().alpha = newActive ? 1f : 0.5f;
  603. for (int i = 0; i < lakeLayerObj.Length; i++)
  604. {
  605. lakeLayerObj[i].gameObject.SetActive(newActive);
  606. lakeLayerInfo[i].gameObject.SetActive(newActive);
  607. }
  608. }
  609. void BaseLayer3BtnOnClick(bool newActive)
  610. {
  611. if (newActive)
  612. {
  613. //BaseLayer0BtnOnClick(false);
  614. //BaseLayer2BtnOnClick(false);
  615. }
  616. baseLayerInfoBtns[3].GetComponent<CanvasGroup>().alpha = newActive ? 1f : 0.5f;
  617. for (int i = 0; i < region2LayerObj.Count; i++)
  618. {
  619. region2LayerObj[i].gameObject.SetActive(newActive);
  620. }
  621. }
  622. void BaseLayer4BtnOnClick(bool newActive)
  623. {
  624. if (newActive)
  625. {
  626. }
  627. baseLayerInfoBtns[4].GetComponent<CanvasGroup>().alpha = newActive ? 1f : 0.5f;
  628. for (int i = 0; i < aqqLayerObj.Length; i++)
  629. {
  630. aqqLayerObj[i].gameObject.SetActive(newActive);
  631. }
  632. }
  633. void RunTimeLayerClick(int temp)
  634. {
  635. bool active = layerInfoBtns[temp].GetComponent<CanvasGroup>().alpha > 0.5f;
  636. layerInfoBtns[temp].GetComponent<CanvasGroup>().alpha = active ? 0.5f : 1.0f;
  637. bool newActive = !active;
  638. ChangeRuntimeLayer(temp, newActive);
  639. }
  640. void LeftBtnClick(int index, bool record = true)
  641. {
  642. if (record)
  643. currentActiveLeft = index;
  644. for (int i = 0; i < leftButtons.Length; i++)
  645. {
  646. leftButtons[i].GetComponent<Image>().sprite = sprites[1];
  647. }
  648. leftButtons[index].GetComponent<Image>().sprite = sprites[0];
  649. for (int i = 0; i < leftContent.childCount; i++)
  650. {
  651. leftContent.transform.GetChild(i).gameObject.SetActive(false);
  652. }
  653. leftContent.transform.GetChild(index).gameObject.SetActive(true);
  654. if (index == 1)
  655. {
  656. InitSWHeightInfo();
  657. }
  658. }
  659. void InitLayerBtns()
  660. {
  661. layerBtns = new List<LayerBtn>();
  662. for (int i = 0; i < layerDatas.Length; i++)
  663. {
  664. LayerBtn layerBtn = Instantiate(layerBtnPrefab);
  665. layerBtn.SetUseful(false);
  666. int index = i;
  667. int num = 0;
  668. if (i == 0)
  669. {
  670. List<LayerUnitData> tempDatas = new List<LayerUnitData>(GlobalData.layerUnitDatas);
  671. for (int j = 0; j < tempDatas.Count; j++)
  672. {
  673. if (tempDatas[j].special == "1")
  674. {
  675. int tempJ = j;
  676. SecLayerBtn secLayerBtn = Instantiate(secLayerBtnPrefab);
  677. secLayerBtn.SetLayerBtnData(tempDatas[j].name);
  678. secLayerBtn.GetComponent<RectTransform>().SetParent(layerBtn.secContent.GetComponent<RectTransform>());
  679. secLayerBtn.btn.onClick.AddListener(() =>
  680. {
  681. CameraManager.SwitchCamera(0);
  682. viewMode = ViewMode.normal;
  683. StaticLod.instance.OnFoucusStatic(tempDatas[tempJ].namePri);
  684. yZT.gameObject.SetActive(true);
  685. ChangeRightContent(tempJ);
  686. pointParent.gameObject.SetActive(false);
  687. clearBtn.gameObject.SetActive(false);
  688. middleContent.gameObject.SetActive(false);
  689. rightContent.gameObject.SetActive(false);
  690. LeftBtnClick(1, false);
  691. });
  692. num++;
  693. }
  694. }
  695. layerBtn.secContent.gameObject.SetActive(true);
  696. }
  697. else
  698. {
  699. List<LayerUnitData> tempDatas = new List<LayerUnitData>(GlobalData.layerUnitDatas);
  700. for (int j = 0; j < tempDatas.Count; j++)
  701. {
  702. if ((int)tempDatas[j].type == layerDatas[i].layerID)
  703. {
  704. int tempJ = j;
  705. SecLayerBtn secLayerBtn = Instantiate(secLayerBtnPrefab);
  706. secLayerBtn.SetLayerBtnData(tempDatas[j].name);
  707. secLayerBtn.GetComponent<RectTransform>().SetParent(layerBtn.secContent.GetComponent<RectTransform>());
  708. secLayerBtn.btn.onClick.AddListener(() =>
  709. {
  710. CameraManager.SwitchCamera(0);
  711. viewMode = ViewMode.normal;
  712. StaticLod.instance.OnFoucusStatic(tempDatas[tempJ].namePri);
  713. yZT.gameObject.SetActive(true);
  714. ChangeRightContent(tempJ);
  715. pointParent.gameObject.SetActive(false);
  716. clearBtn.gameObject.SetActive(false);
  717. middleContent.gameObject.SetActive(false);
  718. rightContent.gameObject.SetActive(false);
  719. LeftBtnClick(1, false);
  720. });
  721. num++;
  722. }
  723. }
  724. }
  725. layerBtn.btn.GetComponent<Button>().onClick.AddListener(() =>
  726. {
  727. for (int j = 0; j < layerBtns.Count; j++)
  728. {
  729. layerBtns[j].SetUseful(false);
  730. layerBtns[j].secContent.gameObject.SetActive(false);
  731. }
  732. layerBtns[index].SetUseful(true);
  733. layerBtns[index].secContent.gameObject.SetActive(true);
  734. //ChangeRuntimeLayer(index);
  735. });
  736. layerBtn.SetLayerBtnData(layerSprite[layerDatas[i].layerID], layerDatas[i].layerName, num.ToString());
  737. layerBtn.GetComponent<RectTransform>().SetParent(content.GetComponent<RectTransform>());
  738. layerBtn.transform.localScale = Vector3.one;
  739. layerBtns.Add(layerBtn);
  740. }
  741. content.GetComponent<VerticalLayoutGroup>().SetLayoutVertical();
  742. layerBtns[0].SetUseful(true);
  743. }
  744. void ChangeRightContent(int index)
  745. {
  746. for (int i = 0; i < infoRight.childCount; i++)
  747. {
  748. infoRight.GetChild(i).gameObject.SetActive(false);
  749. }
  750. infoRight.GetChild(index).gameObject.SetActive(true);
  751. GameObject title;
  752. GameObject text1;
  753. if (infoRight.GetChild(index).GetComponentInChildren<ScrollRect>() != null)
  754. {
  755. title = infoRight.GetChild(index).GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(1).gameObject;
  756. text1 = infoRight.GetChild(index).GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(2).gameObject;
  757. }
  758. else {
  759. title = infoRight.GetChild(index).GetChild(0).GetChild(1).gameObject;
  760. text1 = infoRight.GetChild(index).GetChild(0).GetChild(2).gameObject;
  761. }
  762. if (title != null)
  763. {
  764. title.GetComponent<Text>().text = GlobalData.layerUnitDatas[index].name;
  765. }
  766. if (text1 != null)
  767. {
  768. text1.GetComponent<Text>().text = GlobalData.layerUnitDatas[index].text1;
  769. }
  770. if (infoRight.GetChild(index).GetChild(0).childCount > 3)
  771. {
  772. GameObject text2 = infoRight.GetChild(index).GetChild(0).GetChild(3).gameObject;
  773. if (text2 != null)
  774. {
  775. text2.GetComponent<Text>().text = GlobalData.layerUnitDatas[index].text2;
  776. }
  777. }
  778. }
  779. void InitPoint()
  780. {
  781. GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
  782. List<Item0> item0s = new List<Item0>();
  783. for (int i = 0; i < GlobalData.hotPointDatas.Count; i++)
  784. {
  785. //if()
  786. HotPointData temp = GlobalData.hotPointDatas[i];
  787. Vector3 tempLocalPosition = CoordinateConverter.GeoToUGUISmall(temp.longitude, temp.latitude);
  788. RuntimePoint newPoint = Instantiate(pointPrefab, Vector3.zero, Quaternion.identity);
  789. int tempI = i;
  790. newPoint.GetComponent<RectTransform>().SetParent(pointParent);
  791. newPoint.InitPoint(hotPointSprite[(int)(temp.type)], temp.namePri, temp.name, temp.longitude, temp.latitude);
  792. newPoint.layerIDs.Add((int)(temp.type));
  793. newPoint.bingObj = Instantiate(runtimePointObj).gameObject;
  794. newPoint.bingObj.transform.SetParent(shaPan.transform.GetChild(8));
  795. newPoint.bingObj.transform.localEulerAngles = Vector3.zero;
  796. newPoint.bingObj.transform.localScale = Vector3.one;
  797. newPoint.bingObj.transform.localPosition = tempLocalPosition;
  798. newPoint.bingObj.name = temp.name;
  799. if ((int)temp.type == 6 || (int)temp.type == 7)
  800. {
  801. int index = FindIndexByLayerUnitName(temp.name);
  802. Item0 item0 = Instantiate(item0Prefab, Vector3.zero, Quaternion.identity);
  803. item0.InitPoint(hotPointSprite[(int)(temp.type)], temp.namePri, temp.name, GlobalData.layerUnitDatas[index].special);
  804. item0s.Add(item0);
  805. item0.onPointClick = () =>
  806. {
  807. OnNewPointClick(temp, item0);
  808. };
  809. }
  810. newPoint.onPointClick = () =>
  811. {
  812. OnNewPointClick(temp, newPoint);
  813. };
  814. runtimePointLib.Add(newPoint);
  815. }
  816. for (int i = 0; i < item0s.Count; i++)
  817. {
  818. if (item0s[i].mSpecial != "1")
  819. item0s[i].GetComponent<RectTransform>().SetParent(item0Parent.transform);
  820. }
  821. for (int i = 0; i < item0s.Count; i++)
  822. {
  823. if (item0s[i].mSpecial == "1")
  824. item0s[i].GetComponent<RectTransform>().SetParent(item0Parent.transform);
  825. }
  826. Item0 item1 = Instantiate(item0Prefab, Vector3.zero, Quaternion.identity);
  827. item1.GetComponent<RectTransform>().SetParent(item0Parent.transform);
  828. item1.InitPoint(hotPointSprite[7], "GeTi", "隔堤", "1");
  829. RunTimeLayerClick(0);
  830. RunTimeLayerClick(1);
  831. RunTimeLayerClick(2);
  832. RunTimeLayerClick(3);
  833. RunTimeLayerClick(4);
  834. RunTimeLayerClick(5);
  835. RunTimeLayerClick(6);
  836. RunTimeLayerClick(8);
  837. BaseLayer0BtnOnClick(true);
  838. }
  839. int FindIndexByLayerUnitName(string name)
  840. {
  841. for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++)
  842. {
  843. if (GlobalData.layerUnitDatas[i].name == name.Trim())
  844. {
  845. return i;
  846. }
  847. }
  848. return -1;
  849. }
  850. public static int FindIndexByHotPointName(string name)
  851. {
  852. string newName = name.Replace("(闸下)", "(闸下)").Replace("(闸上)", "(闸上)");
  853. newName = newName.TrimEnd();
  854. if (newName.Contains("补元"))
  855. {
  856. newName = "补元(闸上)";
  857. }
  858. else if (newName.Contains("套口"))
  859. {
  860. newName = "套口(闸上)";
  861. }
  862. //Debug.Log(newName);
  863. for (int i = 0; i < GlobalData.swDatas.Count; i++)
  864. {
  865. //Debug.Log(GlobalData.swDatas[i].stnm);
  866. if (GlobalData.swDatas[i].stnm.Trim() == newName.Trim())
  867. {
  868. return i;
  869. }
  870. }
  871. return -1;
  872. }
  873. public static int FindIndexBySWName(string name)
  874. {
  875. //string newName = name.Replace("(闸下)", "(下)").Replace("(闸上)", "(上)").Replace("(闸上)", "上").Replace("(闸下)", "下");
  876. //newName = newName.TrimEnd();
  877. //if (newName.Contains("补元"))
  878. //{
  879. // newName = "补元(上)";
  880. //}
  881. //else if (newName.Contains("套口"))
  882. //{
  883. // newName = "套口(上)";
  884. //}
  885. //Debug.Log(newName);
  886. for (int i = 0; i < GlobalData.sWZDatas.Count; i++)
  887. {
  888. //Debug.Log(GlobalData.swDatas[i].stnm);
  889. if (GlobalData.sWZDatas[i].STNM.Trim() == name.Trim())
  890. {
  891. return i;
  892. }
  893. }
  894. return -1;
  895. }
  896. void OnNewPointClick(HotPointData temp, RuntimePoint newPoint)
  897. {
  898. Debug.Log(temp.type);
  899. if ((int)temp.type == 4)
  900. {
  901. int index = FindIndexByHotPointName(temp.name);
  902. Debug.Log(GlobalData.swDatas[index].stcd);
  903. _waterTrendPanel.ShowTrend(GlobalData.swDatas[index].stcd, GlobalData.swDatas[index].stnm,0);
  904. }
  905. else if ((int)temp.type == 2) {
  906. int index = FindIndexBySWName(temp.name);
  907. Debug.Log(index);
  908. _waterTrendPanel.ShowTrend(GlobalData.sWZDatas[index].STCD, GlobalData.sWZDatas[index].STNM,1);
  909. }
  910. else if ((int)temp.type >= 6 || newPoint.layerIDs.Count > 4)
  911. {
  912. CameraManager.SwitchCamera(0);
  913. viewMode = ViewMode.normal;
  914. StaticLod.instance.OnFoucusStatic(newPoint.staticImp);
  915. yZT.gameObject.SetActive(true);
  916. int index = FindIndexByLayerUnitName(temp.name);
  917. ChangeRightContent(index);
  918. pointParent.gameObject.SetActive(false);
  919. clearBtn.gameObject.SetActive(false);
  920. middleContent.gameObject.SetActive(false);
  921. rightContent.gameObject.SetActive(false);
  922. LeftBtnClick(1, false);
  923. }
  924. }
  925. void OnNewPointClick(HotPointData temp, Item0 item0)
  926. {
  927. CameraManager.SwitchCamera(0);
  928. viewMode = ViewMode.normal;
  929. StaticLod.instance.OnFoucusStatic(item0.staticImp);
  930. yZT.gameObject.SetActive(true);
  931. int index = FindIndexByLayerUnitName(temp.name);
  932. ChangeRightContent(index);
  933. pointParent.gameObject.SetActive(false);
  934. clearBtn.gameObject.SetActive(false);
  935. middleContent.gameObject.SetActive(false);
  936. rightContent.gameObject.SetActive(false);
  937. LeftBtnClick(1, false);
  938. }
  939. async Task InitData()
  940. {
  941. await new WaitUntil(() =>
  942. {
  943. return GlobalData.layerUnitDatas.Count > 0;
  944. });
  945. }
  946. async Task InitPointData()
  947. {
  948. await new WaitUntil(() =>
  949. {
  950. return GlobalData.hotPointDatas.Count > 0;
  951. });
  952. }
  953. void Init()
  954. {
  955. yZT.gameObject.SetActive(false);
  956. clearBtn.gameObject.SetActive(true);
  957. pointParent.gameObject.SetActive(true);
  958. middleContent.gameObject.SetActive(true);
  959. rightContent.gameObject.SetActive(true);
  960. LeftBtnClick(currentActiveLeft);
  961. }
  962. void InitReturnBtn()
  963. {
  964. returnBtn.onClick.AddListener(() =>
  965. {
  966. CameraManager.SwitchCamera(1);
  967. viewMode = ViewMode.miniMap;
  968. Init();
  969. });
  970. }
  971. void ChangeRuntimeLayer(int layer, bool show)
  972. {
  973. if (show)
  974. {
  975. if (cancelLayer.Contains(layer))
  976. {
  977. cancelLayer.Remove(layer);
  978. }
  979. }
  980. else
  981. {
  982. if (!cancelLayer.Contains(layer))
  983. {
  984. cancelLayer.Add(layer);
  985. }
  986. }
  987. for (int i = 0; i < runtimePointLib.Count; i++)
  988. {
  989. if (runtimePointLib[i].layerIDs.Contains(layer))
  990. {
  991. if (runtimePointLib[i].layerIDs.Count < 2)
  992. {
  993. runtimePointLib[i].gameObject.SetActive(show);
  994. }
  995. else
  996. {
  997. List<int> tempLayers = new List<int>(runtimePointLib[i].layerIDs);
  998. for (int j = 0; j < cancelLayer.Count; j++)
  999. {
  1000. if (tempLayers.Contains(cancelLayer[j]))
  1001. {
  1002. tempLayers.Remove(cancelLayer[j]);
  1003. }
  1004. }
  1005. if (tempLayers.Count < 1)
  1006. {
  1007. runtimePointLib[i].gameObject.SetActive(false);
  1008. }
  1009. else
  1010. {
  1011. runtimePointLib[i].gameObject.SetActive(true);
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. void ShootRay()
  1018. {
  1019. Ray ray = CameraManager.instance.mainCamera.ScreenPointToRay(Input.mousePosition);
  1020. RaycastHit hit;
  1021. if (Physics.Raycast(ray, out hit, 20000, 1 << 8 | 1 << 9))
  1022. {
  1023. CameraBird bird = CameraManager.instance.mainCamera.GetComponent<CameraBird>();
  1024. if (hit.collider.gameObject.layer == LayerMask.NameToLayer("EarthTile"))
  1025. {
  1026. if (bird.transform.position.y > 1000)
  1027. {
  1028. bird.SetCameraToCenterFade(hit.point, 1100);
  1029. }
  1030. }
  1031. else if (hit.collider.gameObject.layer == LayerMask.NameToLayer("StaticImportant"))
  1032. {
  1033. StaticImportant si = hit.collider.gameObject.GetComponent<StaticImportant>();
  1034. int index = StaticLod.instance.OnFoucusStatic(si);
  1035. yZT.gameObject.SetActive(true);
  1036. ChangeRightContent(index);
  1037. pointParent.gameObject.SetActive(false);
  1038. clearBtn.gameObject.SetActive(false);
  1039. middleContent.gameObject.SetActive(false);
  1040. rightContent.gameObject.SetActive(false);
  1041. LeftBtnClick(1, false);
  1042. }
  1043. }
  1044. else
  1045. {
  1046. Debug.Log("No hit");
  1047. }
  1048. }
  1049. private void OnEnable()
  1050. {
  1051. if (regionObjParent != null)
  1052. regionObjParent.transform.gameObject.SetActive(true);
  1053. if (regionObjParent2 != null)
  1054. regionObjParent2.transform.gameObject.SetActive(true);
  1055. }
  1056. private void OnDisable()
  1057. {
  1058. if (regionObjParent != null)
  1059. regionParent.transform.gameObject.SetActive(false);
  1060. if (regionObjParent2 != null)
  1061. regionObjParent2.transform.gameObject.SetActive(false);
  1062. }
  1063. private void Update()
  1064. {
  1065. if (Input.GetMouseButtonDown(0)) // 检测鼠标左键点击
  1066. {
  1067. clickInterval = 0.0f;
  1068. startClickPosition = Input.mousePosition;
  1069. }
  1070. clickInterval += Time.deltaTime;
  1071. if (Input.GetMouseButtonUp(0))
  1072. {
  1073. if (clickInterval < 0.2f && Vector3.Distance(startClickPosition, Input.mousePosition) < 10f)
  1074. {
  1075. if (!CameraManager.instance.secondCamera.enabled)
  1076. {
  1077. ShootRay();
  1078. }
  1079. }
  1080. }
  1081. }
  1082. private void LateUpdate()
  1083. {
  1084. if (CameraManager.instance.secondCamera.enabled)
  1085. {
  1086. regionParent.transform.gameObject.SetActive(true);
  1087. for (int i = 0; i < riverLayerInfo.Length; i++)
  1088. {
  1089. if (riverLayerInfo[i].gameObject.activeSelf)
  1090. {
  1091. riverLayerInfo[i].anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(riverLayerObj[i].transform.position) / Screen.width * 1920.0f;
  1092. }
  1093. }
  1094. for (int i = 0; i < lakeLayerInfo.Length; i++)
  1095. {
  1096. if (lakeLayerInfo[i].gameObject.activeSelf)
  1097. {
  1098. lakeLayerInfo[i].anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(lakeLayerObj[i].transform.position) / Screen.width * 1920.0f;
  1099. }
  1100. }
  1101. }
  1102. else
  1103. {
  1104. regionParent.transform.gameObject.SetActive(false);
  1105. }
  1106. }
  1107. }