YZTLayer.cs 43 KB

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