RKZYLayer.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. using Best.HTTP.Shared.Compression.Zlib;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Text.RegularExpressions;
  8. using System.Threading.Tasks;
  9. using Unity.VisualScripting;
  10. using UnityAsync;
  11. using UnityEngine;
  12. using UnityEngine.Networking;
  13. using UnityEngine.UI;
  14. [System.Serializable]
  15. public class MovePlan
  16. {
  17. public string startPos;
  18. public string endPos;
  19. public int humanNum;
  20. public string time;
  21. }
  22. [System.Serializable]
  23. public class MoveAtten
  24. {
  25. public string title;
  26. public string pos;
  27. public string time;
  28. }
  29. [System.Serializable]
  30. public class ServerMovePlan {
  31. public bool isAfter;
  32. public bool isOut;
  33. public string desc;
  34. public string from;
  35. public float fromLong;
  36. public float fromLttd;
  37. public string to;
  38. public float toLong;
  39. public float toLttd;
  40. public int manNum;
  41. public int homeNum;
  42. public int completeNum;
  43. public string dateTime;
  44. public int villageCount;
  45. public int materialPrize;
  46. }
  47. [System.Serializable]
  48. public class ZYYAData
  49. {
  50. public int totalRoadCount;
  51. public float totalmanNum;
  52. public int totalVillageCount;
  53. public float totalMaterialPrize;
  54. }
  55. public class RKZYLayer : YZTRootLayer
  56. {
  57. public Text timeText;
  58. public LineInfo lineInfo;
  59. //public List<MovePlan> movePlans;
  60. public List<Thing1> movePlans;
  61. public List<MoveAtten> moveAttens;
  62. public static LineInfo lineInfoStatic;
  63. public Button beforeBtn;
  64. public Button afterBtn;
  65. public Button[] allInOut;
  66. public Transform beforeC;
  67. public Transform afterC;
  68. public List<LinePath> linePaths = new List<LinePath>();
  69. public Sprite[] sprites;
  70. public int inOutIndex;
  71. public int beforeAfterIndex;
  72. public RectTransform title1;
  73. public RectTransform plan1;
  74. public RectTransform movePlanBeforeContent;
  75. public RectTransform movePlanAfterContent;
  76. public RectTransform title2;
  77. public RectTransform plan2;
  78. public RectTransform attenContent;
  79. public List<ServerMovePlan> allServerMovePlans = new List<ServerMovePlan>();
  80. public Text[] zYGKText;
  81. public ZYYAData[] zYYADatas;
  82. public int zYYAIndex = 0;
  83. public Text[] zYYAText;
  84. public Material afterMat;
  85. public LinePath linePathPrefab;
  86. // Start is called before the first frame update
  87. async void Start()
  88. {
  89. GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
  90. beforeC = shaPan.transform.GetChild(10);
  91. afterC = shaPan.transform.GetChild(11);
  92. lineInfoStatic = lineInfo;
  93. await InitMovePlan();
  94. //TODO 这一块的path应该从movePlan里面生成而不是默认
  95. InitAllPath();
  96. InitButton();
  97. InitAtten();
  98. await InitBaseData();
  99. }
  100. private void OnEnable()
  101. {
  102. CameraManager.SwitchCamera(1);
  103. }
  104. void InitAtten() {
  105. RectTransform title = Instantiate(title2);
  106. title.SetParent(attenContent);
  107. title.localScale = Vector3.one;
  108. for (int i = 0; i < moveAttens.Count; i++)
  109. {
  110. RectTransform plan = Instantiate(plan2);
  111. plan.SetParent(attenContent);
  112. plan.localScale = Vector3.one;
  113. plan.GetChild(0).GetComponent<Text>().text = i.ToString();
  114. plan.GetChild(1).GetComponent<Text>().text = moveAttens[i].title;
  115. plan.GetChild(2).GetComponent<Text>().text = moveAttens[i].pos;
  116. plan.GetChild(3).GetComponent<Text>().text = moveAttens[i].time;
  117. }
  118. }
  119. async Task InitBaseData() {
  120. bool successInternet = true;
  121. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGeBaseData);
  122. await requestData.SendWebRequest();
  123. try
  124. {
  125. if (requestData.result != UnityWebRequest.Result.Success)
  126. {
  127. Debug.LogWarning("RKZYLayer基础数据联网不成功,原因:返request不成功");
  128. successInternet = false;
  129. }
  130. else
  131. {
  132. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  133. JToken codeToken = jsonObject["code"];
  134. if (codeToken.ToString() == "200")
  135. {
  136. JToken areaToken = jsonObject["data"]["area"];
  137. JToken capacityToken = jsonObject["data"]["capacity"];
  138. JToken populationToken = jsonObject["data"]["population"];
  139. zYGKText[0].text = populationToken.ToString() + "人";
  140. zYGKText[1].text = allServerMovePlans.Count.ToString() + "条";
  141. zYGKText[2].text = areaToken.ToString() + "km²";
  142. zYGKText[3].text = (float.Parse((capacityToken.ToString())) * 100).ToString() + "%";
  143. }
  144. else
  145. {
  146. successInternet = false;
  147. Debug.LogWarning("RKZYLayer基础数据联网不成功,原因:返序列化失败");
  148. }
  149. }
  150. }
  151. catch (Exception e)
  152. {
  153. successInternet = false;
  154. Debug.LogWarning("RKZYLayer基础数据联网不成功,原因:" + e.ToString());
  155. }
  156. }
  157. async Task InitMovePlan() {
  158. bool successInternet = true;
  159. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGetMovePlans);
  160. await requestData.SendWebRequest();
  161. zYYADatas = new ZYYAData[6] { new ZYYAData(), new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() };
  162. try
  163. {
  164. if (true)
  165. {
  166. Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:返request不成功");
  167. successInternet = false;
  168. }
  169. else
  170. {
  171. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  172. // 提取data字段的值
  173. JToken dataToken = jsonObject["data"];
  174. JToken codeToken = jsonObject["code"];
  175. if (codeToken.ToString() == "200")
  176. {
  177. allServerMovePlans = JsonConvert.DeserializeObject<List<ServerMovePlan>>(dataToken.ToString());
  178. }
  179. else
  180. {
  181. successInternet = false;
  182. Debug.LogWarning("XHGKLayer联网不成功,读本地缓存数据,原因:返序列化失败");
  183. }
  184. }
  185. }
  186. catch (Exception e)
  187. {
  188. successInternet = false;
  189. Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:" + e.ToString());
  190. }
  191. if (!successInternet)
  192. {
  193. WWW www = new WWW(Application.streamingAssetsPath + "/moveplan.json");
  194. await new UnityAsync.WaitUntil(() =>
  195. {
  196. return www.isDone;
  197. });
  198. allServerMovePlans = JsonConvert.DeserializeObject<List<ServerMovePlan>>(www.text);
  199. www.Dispose();
  200. }
  201. int beforeIndex = 0;
  202. int afterIndex = 0;
  203. List<LinePath> beforeLinePaths = new List<LinePath>();
  204. List<LinePath> afterLinePaths = new List<LinePath>();
  205. GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
  206. Transform runtimPointParent = shaPan.transform.GetChild(10);
  207. for (int i = 0; i < allServerMovePlans.Count; i++) {
  208. bool after = allServerMovePlans[i].isAfter;
  209. bool isOut = allServerMovePlans[i].isOut;
  210. if (!after)
  211. {
  212. LinePath linePath = Instantiate(linePathPrefab);
  213. linePath.transform.SetParent(beforeC);
  214. linePath.startPos = allServerMovePlans[i].from;
  215. Vector3 localPos = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].fromLong, allServerMovePlans[i].fromLttd);
  216. Vector3 worldPos = runtimPointParent.TransformPoint(localPos);
  217. worldPos.z = -583;
  218. linePath.endPos = allServerMovePlans[i].to;
  219. Vector3 localPos1 = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].toLong, allServerMovePlans[i].toLttd);
  220. Vector3 worldPos1 = runtimPointParent.TransformPoint(localPos1);
  221. worldPos1.z = -583;
  222. linePath.SetPath(worldPos, worldPos1);
  223. linePath.lineDir = isOut ? LineDir.Out : LineDir.In;
  224. linePath.linePathContent = allServerMovePlans[i].desc;
  225. linePath.manNum = allServerMovePlans[i].manNum;
  226. linePath.homeNum = allServerMovePlans[i].homeNum;
  227. linePath.completeNum = allServerMovePlans[i].completeNum;
  228. linePath.dateTime = allServerMovePlans[i].dateTime;
  229. if (linePath.lineDir == LineDir.Out)
  230. {
  231. zYYADatas[1].totalmanNum += allServerMovePlans[i].manNum;
  232. zYYADatas[1].totalVillageCount += allServerMovePlans[i].villageCount;
  233. zYYADatas[1].totalMaterialPrize += allServerMovePlans[i].materialPrize;
  234. zYYADatas[1].totalRoadCount += 1;
  235. }
  236. else
  237. {
  238. zYYADatas[2].totalmanNum += allServerMovePlans[i].manNum;
  239. zYYADatas[2].totalVillageCount += allServerMovePlans[i].villageCount;
  240. zYYADatas[2].totalMaterialPrize += allServerMovePlans[i].materialPrize;
  241. zYYADatas[2].totalRoadCount += 1;
  242. }
  243. beforeLinePaths.Add(linePath);
  244. }
  245. else
  246. {
  247. LinePath linePath = Instantiate(linePathPrefab);
  248. linePath.transform.SetParent(afterC);
  249. linePath.startPos = allServerMovePlans[i].from;
  250. Vector3 localPos = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].fromLong, allServerMovePlans[i].fromLttd);
  251. Vector3 worldPos = runtimPointParent.TransformPoint(localPos);
  252. worldPos.z = -583;
  253. linePath.endPos = allServerMovePlans[i].to;
  254. Vector3 localPos1 = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].toLong, allServerMovePlans[i].toLttd);
  255. Vector3 worldPos1 = runtimPointParent.TransformPoint(localPos1);
  256. worldPos1.z = -583;
  257. linePath.SetPath(worldPos, worldPos1);
  258. linePath.lineDir = isOut ? LineDir.Out : LineDir.In;
  259. linePath.linePathContent = allServerMovePlans[i].desc;
  260. linePath.manNum = allServerMovePlans[i].manNum;
  261. linePath.homeNum = allServerMovePlans[i].homeNum;
  262. linePath.completeNum = allServerMovePlans[i].completeNum;
  263. linePath.dateTime = allServerMovePlans[i].dateTime;
  264. if (linePath.lineDir == LineDir.Out)
  265. {
  266. zYYADatas[4].totalmanNum += allServerMovePlans[i].manNum;
  267. zYYADatas[4].totalVillageCount += allServerMovePlans[i].villageCount;
  268. zYYADatas[4].totalMaterialPrize += allServerMovePlans[i].materialPrize;
  269. zYYADatas[4].totalRoadCount += 1;
  270. }
  271. else
  272. {
  273. zYYADatas[5].totalmanNum += allServerMovePlans[i].manNum;
  274. zYYADatas[5].totalVillageCount += allServerMovePlans[i].villageCount;
  275. zYYADatas[5].totalMaterialPrize += allServerMovePlans[i].materialPrize;
  276. zYYADatas[5].totalRoadCount += 1;
  277. }
  278. afterLinePaths.Add(linePath);
  279. }
  280. zYYADatas[0].totalmanNum = zYYADatas[1].totalmanNum + zYYADatas[2].totalmanNum;
  281. zYYADatas[0].totalVillageCount = zYYADatas[1].totalVillageCount + zYYADatas[2].totalVillageCount;
  282. zYYADatas[0].totalMaterialPrize = zYYADatas[1].totalMaterialPrize + zYYADatas[2].totalMaterialPrize;
  283. zYYADatas[0].totalRoadCount = zYYADatas[1].totalRoadCount + zYYADatas[2].totalRoadCount;
  284. zYYADatas[3].totalmanNum = zYYADatas[4].totalmanNum + zYYADatas[5].totalmanNum;
  285. zYYADatas[3].totalVillageCount = zYYADatas[4].totalVillageCount + zYYADatas[5].totalVillageCount;
  286. zYYADatas[3].totalMaterialPrize = zYYADatas[4].totalMaterialPrize + zYYADatas[5].totalMaterialPrize;
  287. zYYADatas[3].totalRoadCount = zYYADatas[4].totalRoadCount + zYYADatas[5].totalRoadCount;
  288. RefreshZYYAData();
  289. }
  290. movePlans = new List<Thing1>();
  291. RectTransform title = Instantiate(title1);
  292. title.localScale = Vector3.one;
  293. title.SetParent(movePlanBeforeContent);
  294. RectTransform title2 = Instantiate(title1);
  295. title2.localScale = Vector3.one;
  296. title2.SetParent(movePlanAfterContent);
  297. List<ServerMovePlan> serverMovePlans = new List<ServerMovePlan>();
  298. for (int i = 0; i < beforeLinePaths.Count; i++)
  299. {
  300. int tempI = i;
  301. RectTransform plan = Instantiate(plan1);
  302. plan.SetParent(movePlanBeforeContent);
  303. Thing1 thing1 = plan.GetComponent<Thing1>();
  304. thing1.zyTime = ZYTime.Before;
  305. thing1.lineDir = beforeLinePaths[i].lineDir;
  306. thing1.bindLinePath = beforeLinePaths[i];
  307. thing1.GetComponent<Button>().onClick.AddListener(() =>
  308. {
  309. for (int i = 0; i < linePaths.Count; i++)
  310. {
  311. linePaths[i].gameObject.SetActive(false);
  312. }
  313. thing1.bindLinePath.gameObject.SetActive(true);
  314. });
  315. plan.localScale = Vector3.one;
  316. plan.GetChild(0).GetComponent<Text>().text = i.ToString();
  317. plan.GetChild(1).GetComponent<Text>().text = beforeLinePaths[i].startPos;
  318. plan.GetChild(2).GetComponent<Text>().text = beforeLinePaths[i].endPos;
  319. plan.GetChild(3).GetComponent<Text>().text = beforeLinePaths[i].manNum.ToString();
  320. plan.GetChild(4).GetComponent<Text>().text = beforeLinePaths[i].dateTime.ToString();
  321. movePlans.Add(thing1);
  322. }
  323. for (int i = 0; i < afterLinePaths.Count; i++)
  324. {
  325. RectTransform plan = Instantiate(plan1);
  326. plan.SetParent(movePlanAfterContent);
  327. Thing1 thing1 = plan.GetComponent<Thing1>();
  328. thing1.zyTime = ZYTime.After;
  329. thing1.lineDir = afterLinePaths[i].lineDir;
  330. thing1.bindLinePath = afterLinePaths[i];
  331. thing1.GetComponent<Button>().onClick.AddListener(() =>
  332. {
  333. for (int i = 0; i < linePaths.Count; i++)
  334. {
  335. linePaths[i].gameObject.SetActive(false);
  336. }
  337. thing1.bindLinePath.gameObject.SetActive(true);
  338. });
  339. plan.localScale = Vector3.one;
  340. plan.GetChild(0).GetComponent<Text>().text = i.ToString();
  341. plan.GetChild(1).GetComponent<Text>().text = afterLinePaths[i].startPos;
  342. plan.GetChild(2).GetComponent<Text>().text = afterLinePaths[i].endPos;
  343. plan.GetChild(3).GetComponent<Text>().text = afterLinePaths[i].manNum.ToString();
  344. plan.GetChild(4).GetComponent<Text>().text = afterLinePaths[i].dateTime.ToString();
  345. movePlans.Add(thing1);
  346. }
  347. movePlanAfterContent.gameObject.SetActive(false);
  348. }
  349. void ChangeLinePathChannel(int index) {
  350. switch (index)
  351. {
  352. case 0:
  353. for (int i = 0; i < linePaths.Count; i++)
  354. {
  355. linePaths[i].gameObject.SetActive(true);
  356. }
  357. break;
  358. case 1:
  359. for (int i = 0; i < linePaths.Count; i++)
  360. {
  361. if (linePaths[i].lineDir == LineDir.Out)
  362. linePaths[i].gameObject.SetActive(true);
  363. else
  364. linePaths[i].gameObject.SetActive(false);
  365. }
  366. break;
  367. case 2:
  368. for (int i = 0; i < linePaths.Count; i++)
  369. {
  370. if (linePaths[i].lineDir == LineDir.In)
  371. linePaths[i].gameObject.SetActive(true);
  372. else
  373. linePaths[i].gameObject.SetActive(false);
  374. }
  375. break;
  376. }
  377. }
  378. void RefreshZYYAData() {
  379. zYYAIndex = beforeAfterIndex * 3 + inOutIndex;
  380. zYYAText[0].text = zYYADatas[zYYAIndex].totalVillageCount.ToString();
  381. zYYAText[1].text = (zYYADatas[zYYAIndex].totalmanNum / 10000.0f).ToString("0.00");
  382. zYYAText[2].text = (zYYADatas[zYYAIndex].totalMaterialPrize / 100000000.0f).ToString("0.00");
  383. zYYAText[3].text = zYYADatas[zYYAIndex].totalRoadCount.ToString();
  384. }
  385. void InitButton() {
  386. beforeBtn.onClick.AddListener(() => {
  387. beforeAfterIndex = 0;
  388. beforeBtn.GetComponent<Image>().sprite = sprites[0];
  389. afterBtn.GetComponent<Image>().sprite = sprites[1];
  390. beforeC.gameObject.SetActive(true);
  391. afterC.gameObject.SetActive(false);
  392. movePlanBeforeContent.gameObject.SetActive(true);
  393. movePlanAfterContent.gameObject.SetActive(false);
  394. ChangeLinePathChannel(inOutIndex);
  395. RefreshZYYAData();
  396. });
  397. afterBtn.onClick.AddListener(() => {
  398. beforeAfterIndex = 1;
  399. beforeBtn.GetComponent<Image>().sprite = sprites[1];
  400. afterBtn.GetComponent<Image>().sprite = sprites[0];
  401. beforeC.gameObject.SetActive(false);
  402. afterC.gameObject.SetActive(true);
  403. movePlanBeforeContent.gameObject.SetActive(false);
  404. movePlanAfterContent.gameObject.SetActive(true);
  405. ChangeLinePathChannel(inOutIndex);
  406. RefreshZYYAData();
  407. });
  408. allInOut[0].onClick.AddListener(() =>
  409. {
  410. inOutIndex = 0;
  411. ChangeLinePathChannel(0);
  412. for (int i = 0; i < movePlans.Count; i++)
  413. {
  414. movePlans[i].gameObject.SetActive(true);
  415. }
  416. allInOut[0].gameObject.GetComponent<Image>().sprite = sprites[0];
  417. allInOut[1].gameObject.GetComponent<Image>().sprite = sprites[1];
  418. allInOut[2].gameObject.GetComponent<Image>().sprite = sprites[1];
  419. RefreshZYYAData();
  420. });
  421. allInOut[1].onClick.AddListener(() =>
  422. {
  423. inOutIndex = 1;
  424. ChangeLinePathChannel(1);
  425. for (int i = 0; i < movePlans.Count; i++)
  426. {
  427. if (movePlans[i].lineDir == LineDir.Out)
  428. movePlans[i].gameObject.SetActive(true);
  429. else
  430. movePlans[i].gameObject.SetActive(false);
  431. }
  432. allInOut[0].gameObject.GetComponent<Image>().sprite = sprites[1];
  433. allInOut[1].gameObject.GetComponent<Image>().sprite = sprites[0];
  434. allInOut[2].gameObject.GetComponent<Image>().sprite = sprites[1];
  435. RefreshZYYAData();
  436. });
  437. allInOut[2].onClick.AddListener(() =>
  438. {
  439. inOutIndex = 2;
  440. ChangeLinePathChannel(2);
  441. for (int i = 0; i < movePlans.Count; i++)
  442. {
  443. if (movePlans[i].lineDir == LineDir.In)
  444. movePlans[i].gameObject.SetActive(true);
  445. else
  446. movePlans[i].gameObject.SetActive(false);
  447. }
  448. allInOut[0].gameObject.GetComponent<Image>().sprite = sprites[1];
  449. allInOut[1].gameObject.GetComponent<Image>().sprite = sprites[1];
  450. allInOut[2].gameObject.GetComponent<Image>().sprite = sprites[0];
  451. RefreshZYYAData();
  452. });
  453. }
  454. void InitAllPath() {
  455. for (int i = 0; i < beforeC.childCount; i++)
  456. {
  457. if (beforeC.GetChild(i).GetComponent<LinePath>())
  458. {
  459. linePaths.Add(beforeC.GetChild(i).GetComponent<LinePath>());
  460. }
  461. }
  462. for (int i = 0; i < afterC.childCount; i++)
  463. {
  464. if (afterC.GetChild(i).GetComponent<LinePath>())
  465. {
  466. linePaths.Add(afterC.GetChild(i).GetComponent<LinePath>());
  467. }
  468. }
  469. }
  470. // Update is called once per frame
  471. void Update()
  472. {
  473. // 获取当前时间
  474. DateTime now = DateTime.Now;
  475. // 格式化时间字符串
  476. string timeString = now.ToString("yyyy/MM/dd HH:mm");
  477. // 将格式化的时间字符串设置到UI Text组件上
  478. timeText.text = timeString;
  479. }
  480. LinePath lastPath;
  481. private void FixedUpdate()
  482. {
  483. if (lineInfo.linePaths.Count > 0)
  484. {
  485. lineInfo.gameObject.SetActive(true);
  486. }
  487. else
  488. {
  489. lineInfo.gameObject.SetActive(false);
  490. }
  491. Ray ray = CameraManager.instance.secondCamera.ScreenPointToRay(Input.mousePosition);
  492. RaycastHit hit;
  493. if (Physics.Raycast(ray, out hit, 10000))
  494. {
  495. Debug.Log(hit.collider.gameObject.name);
  496. // 检查射线是否击中 LineRenderer 所在的物体
  497. if (hit.collider.transform.parent.GetComponent<LinePath>() != null)
  498. {
  499. if (lastPath != null && hit.collider.transform.parent.GetComponent<LinePath>() != lastPath) {
  500. lastPath.UnShow();
  501. }
  502. hit.collider.transform.parent.GetComponent<LinePath>().OnShow();
  503. lastPath = hit.collider.transform.parent.GetComponent<LinePath>();
  504. }
  505. else
  506. {
  507. if (lastPath)
  508. {
  509. lastPath.UnShow();
  510. lastPath = null;
  511. }
  512. }
  513. }
  514. else {
  515. if (lastPath)
  516. {
  517. lastPath.UnShow();
  518. lastPath = null;
  519. }
  520. }
  521. }
  522. }