XHDDLayer.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. using DG.Tweening;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. using UnityAsync;
  7. //using UnityEditor.VersionControl;
  8. using UnityEngine;
  9. using UnityEngine.UI;
  10. using WaitUntil = UnityAsync.WaitUntil;
  11. [Serializable]
  12. public class AllRegionData
  13. {
  14. public List<RegionData> regions;
  15. }
  16. [Serializable]
  17. public class RegionData
  18. {
  19. public string region;
  20. public string responsibility;
  21. public List<MemberData> members;
  22. }
  23. [Serializable]
  24. public class MemberData
  25. {
  26. public string village;
  27. public string position;
  28. public string name;
  29. public string phone;
  30. }
  31. [Serializable]
  32. public class EmergencyResponseData
  33. {
  34. public List<ResponseMember> LDS;
  35. }
  36. [Serializable]
  37. public class ResponseMember
  38. {
  39. public string unit;
  40. public string position;
  41. public string name;
  42. public string phone;
  43. public string responsibility;
  44. }
  45. [Serializable]
  46. public class XHDDAlertData
  47. {
  48. public AllAlert allAlert;
  49. }
  50. [Serializable]
  51. public class AllAlert
  52. {
  53. public AlertInfo blueAlert;
  54. public AlertInfo yellowAlert;
  55. public AlertInfo orangeAlert;
  56. public AlertInfo redAlert;
  57. }
  58. [Serializable]
  59. public class AlertInfo
  60. {
  61. public string publishCondition;
  62. public string coreGoal;
  63. public List<TaskItem> tasks;
  64. public List<OriginalSection> originalSections;
  65. }
  66. [Serializable]
  67. public class TaskItem
  68. {
  69. public string title;
  70. public string items;
  71. }
  72. [Serializable]
  73. public class OriginalSection
  74. {
  75. public string title;
  76. public string content;
  77. }
  78. [System.Serializable]
  79. public enum YJType
  80. {
  81. BLUE,
  82. YELLOW,
  83. ORANGE,
  84. RED
  85. }
  86. [Serializable]
  87. public class SchedulingPlan
  88. {
  89. public float max_water_level;
  90. public string max_water_level_unit;
  91. public string max_water_level_time;
  92. public float flood_peak_flow_rate;
  93. public string flood_peak_flow_rate_unit;
  94. public float intercepted_flood_volume;
  95. public string intercepted_flood_volume_unit;
  96. public int peak_reduction_rate;
  97. public float final_water_level;
  98. public string final_water_level_unit;
  99. }
  100. [Serializable]
  101. public class SchedulingResults
  102. {
  103. public float inflow_peak;
  104. public string inflow_peak_unit;
  105. public float outflow_total;
  106. public string outflow_total_unit;
  107. public float initial_water_level;
  108. public string initial_water_level_unit;
  109. public float target_water_level;
  110. public string target_water_level_unit;
  111. }
  112. [Serializable]
  113. public class RiskInformation
  114. {
  115. public string warning_level;
  116. public float submerged_area;
  117. public string submerged_area_unit;
  118. public float submerged_farmland_area;
  119. public string submerged_farmland_area_unit;
  120. public float affected_population;
  121. public string affected_population_unit;
  122. public float submerged_area_gdp;
  123. public string submerged_area_gdp_unit;
  124. public float flood_loss;
  125. public string flood_loss_unit;
  126. }
  127. [Serializable]
  128. public class PersonnelSupport
  129. {
  130. public int id;
  131. public string person;
  132. public string unit;
  133. public string position;
  134. public string phone;
  135. }
  136. [Serializable]
  137. public class MaterialSupport
  138. {
  139. public int id;
  140. public string type;
  141. public int quantity;
  142. public string unit;
  143. public string person_in_charge;
  144. public string region;
  145. }
  146. [Serializable]
  147. public class Data
  148. {
  149. public SchedulingPlan scheduling_plan;
  150. public SchedulingResults scheduling_results;
  151. public RiskInformation risk_information;
  152. public List<PersonnelSupport> personnel_support;
  153. public List<MaterialSupport> material_support;
  154. }
  155. [Serializable]
  156. public class SchedulingData
  157. {
  158. public int id;
  159. public string scheduling_name;
  160. public Data data;
  161. }
  162. public class XHDDLayer : YZTRootLayer
  163. {
  164. public RectTransform qxhddContent;
  165. public RectTransform xhddContent;
  166. private bool inAniamtion = false;
  167. public Button enterBtn;
  168. public Button exitBtn;
  169. public Dropdown yjDropdown;
  170. public Button[] yjButtons;
  171. public YJType yJType = YJType.BLUE;
  172. public bool playing = false;
  173. float currentTime = 0;
  174. [Header("DownLeft")]
  175. public RectTransform rkzyContent;
  176. public GameObject rkzyPrefab;
  177. [Header("UpRight")]
  178. public Text yanmomianjiText;
  179. public Text yanmogengdiText;
  180. public Text yingxiangrenkouText;
  181. public Text gDPText;
  182. public Text hongshuisunshiText;
  183. [Header("MiddleRight")]
  184. public RectTransform rybzContent;
  185. public GameObject rybzPrefab;
  186. [Header("DownRight")]
  187. public RectTransform wzbzContent;
  188. public GameObject wzbzPrefab;
  189. [Header("损失概况")]
  190. public GameObject SunShiGaiKuangPanel;
  191. public Text yanMoMianJiText;
  192. public Text yanMoGengDiText;
  193. public Text yanMoRenKouText;
  194. public Text sunShiCaiChanText;
  195. public GameObject sunShiLieBiaoPrefab;
  196. public Transform sunShiLieBiaoContent;
  197. public GameObject mask;
  198. public Text yjTitle;
  199. public Text fbsjText;
  200. public VerticalLayoutGroup zyrwContent;
  201. public Text hxmbText;
  202. public VerticalLayoutGroup zxmxContent;
  203. public VerticalLayoutGroup yrzzContent;
  204. public VerticalLayoutGroup xgxzContent;
  205. public Dropdown regionDropdown;
  206. public GameObject titleContentPrefab;
  207. public GameObject g0;
  208. public GameObject g1;
  209. // Start is called before the first frame update
  210. void Start()
  211. {
  212. InitButton();
  213. InitUpLeft();
  214. InitDownLeft();
  215. InitUpRight();
  216. InitDownRight();
  217. }
  218. private void OnEnable()
  219. {
  220. CameraManager.SwitchCamera(0);
  221. StaticLod.instance.OnFoucusStatic(1);
  222. TimeLineControl.instance.transform.GetChild(1).GetChild(0).gameObject.SetActive(true);
  223. TimeLineControl.instance.transform.GetChild(1).GetChild(1).gameObject.SetActive(true);
  224. GameObject.FindGameObjectWithTag("HeMianStatic").transform.GetChild(2).gameObject.SetActive(false);
  225. }
  226. private async Task InitDownLeft()
  227. {
  228. await new WaitUntil(() =>
  229. {
  230. return GlobalData.allServerMovePlans.Count > 0;
  231. });
  232. for (int i = 0; i < GlobalData.allServerMovePlans.Count; i++)
  233. {
  234. GameObject obj = Instantiate(rkzyPrefab);
  235. obj.transform.SetParent(rkzyContent);
  236. obj.transform.localScale = Vector3.one;
  237. obj.transform.GetChild(0).GetComponent<Text>().text = i.ToString();
  238. obj.transform.GetChild(1).GetComponent<Text>().text = GlobalData.allServerMovePlans[i].from;
  239. obj.transform.GetChild(2).GetComponent<Text>().text = GlobalData.allServerMovePlans[i].to;
  240. obj.transform.GetChild(3).GetComponent<Text>().text = CoordinateConverter.Haversine(GlobalData.allServerMovePlans[i].fromLttd, GlobalData.allServerMovePlans[i].fromLong, GlobalData.allServerMovePlans[i].toLttd, GlobalData.allServerMovePlans[i].toLong).ToString("0.00") + "km";
  241. obj.transform.GetChild(4).GetComponent<Text>().text = GlobalData.allServerMovePlans[i].manNum.ToString();
  242. }
  243. }
  244. private void InitUpLeft()
  245. {
  246. yanmomianjiText.text = $"{GlobalData.schedulingData.data.risk_information.submerged_area} <size=14><color=#A5BFE2>k㎡</color></size>";
  247. yanmogengdiText.text = $"{GlobalData.schedulingData.data.risk_information.submerged_farmland_area} <size=14><color=#A5BFE2>h㎡</color></size>";
  248. yingxiangrenkouText.text = $"{GlobalData.schedulingData.data.risk_information.affected_population} <size=14><color=#A5BFE2>万人</color></size>";
  249. gDPText.text = $"{GlobalData.schedulingData.data.risk_information.submerged_area_gdp} <size=14><color=#A5BFE2>亿元</color></size>";
  250. hongshuisunshiText.text = $"{GlobalData.schedulingData.data.risk_information.flood_loss} <size=14><color=#A5BFE2>亿元</color></size>";
  251. }
  252. private void InitUpRight()
  253. {
  254. for (int i = 0; i < GlobalData.schedulingData.data.personnel_support.Count; i++)
  255. {
  256. GameObject obj = Instantiate(rybzPrefab);
  257. obj.transform.SetParent(rybzContent);
  258. obj.transform.localScale = Vector3.one;
  259. obj.transform.GetChild(0).GetComponent<Text>().text = GlobalData.schedulingData.data.personnel_support[i].id.ToString();
  260. obj.transform.GetChild(1).GetComponent<Text>().text = GlobalData.schedulingData.data.personnel_support[i].person;
  261. obj.transform.GetChild(2).GetComponent<Text>().text = GlobalData.schedulingData.data.personnel_support[i].unit;
  262. obj.transform.GetChild(3).GetComponent<Text>().text = GlobalData.schedulingData.data.personnel_support[i].position.ToString();
  263. obj.transform.GetChild(4).GetComponent<Text>().text = GlobalData.schedulingData.data.personnel_support[i].phone.ToString();
  264. }
  265. }
  266. private void InitDownRight()
  267. {
  268. for (int i = 0; i < GlobalData.schedulingData.data.material_support.Count; i++)
  269. {
  270. GameObject obj = Instantiate(wzbzPrefab);
  271. obj.transform.SetParent(wzbzContent);
  272. obj.transform.localScale = Vector3.one;
  273. obj.transform.GetChild(0).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].id.ToString();
  274. obj.transform.GetChild(1).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].type;
  275. obj.transform.GetChild(2).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].quantity.ToString() + GlobalData.schedulingData.data.material_support[i].unit.ToString();
  276. obj.transform.GetChild(3).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].unit.ToString();
  277. obj.transform.GetChild(4).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].person_in_charge.ToString();
  278. obj.transform.GetChild(5).GetComponent<Text>().text = GlobalData.schedulingData.data.material_support[i].region.ToString();
  279. }
  280. }
  281. public override void OnUILeave()
  282. {
  283. base.OnUILeave();
  284. OnExitXHDDYS();
  285. }
  286. void OnExitXHDDYS()
  287. {
  288. qxhddContent.gameObject.SetActive(true);
  289. xhddContent.gameObject.SetActive(false);
  290. inAniamtion = false;
  291. GameObject tkobj = StaticLod.instance.staticImportants[1].gameObject;
  292. tkobj.transform.GetChild(1).GetComponent<Animator>().Play("ZhaMenEmpty");
  293. mask.gameObject.SetActive(false);
  294. playing = false;
  295. AllRestore();
  296. }
  297. void ChangeDDYAContent(AlertInfo alertInfo) {
  298. fbsjText.text = alertInfo.publishCondition;
  299. hxmbText.text = alertInfo.coreGoal;
  300. for (int i = 0; i < alertInfo.tasks.Count; i++)
  301. {
  302. GameObject obj = Instantiate(titleContentPrefab);
  303. obj.GetComponent<RectTransform>().SetParent(zyrwContent.transform);
  304. obj.GetComponent<RectTransform>().localScale = Vector3.one;
  305. obj.transform.GetChild(0).GetComponent<Text>().text = alertInfo.tasks[i].title;
  306. obj.transform.GetChild(1).GetComponent<Text>().text = alertInfo.tasks[i].items;
  307. }
  308. for (int i = 0; i < alertInfo.originalSections.Count; i++)
  309. {
  310. GameObject obj = Instantiate(titleContentPrefab);
  311. obj.GetComponent<RectTransform>().SetParent(zxmxContent.transform);
  312. obj.GetComponent<RectTransform>().localScale = Vector3.one;
  313. obj.transform.GetChild(0).GetComponent<Text>().text = alertInfo.originalSections[i].title;
  314. obj.transform.GetChild(1).GetComponent<Text>().text = alertInfo.originalSections[i].content;
  315. }
  316. LayoutRebuilder.ForceRebuildLayoutImmediate(fbsjText.transform.parent.GetComponent<RectTransform>()); // 强制重新计算布局
  317. LayoutRebuilder.ForceRebuildLayoutImmediate(hxmbText.transform.parent.GetComponent<RectTransform>()); // 强制重新计算布局
  318. LayoutRebuilder.ForceRebuildLayoutImmediate(zyrwContent.GetComponent<RectTransform>()); // 强制重新计算布局
  319. LayoutRebuilder.ForceRebuildLayoutImmediate(zxmxContent.GetComponent<RectTransform>()); // 强制重新计算布局
  320. }
  321. void ChangeXHDDYA1(YJType type) {
  322. for (int i = zyrwContent.transform.childCount - 1; i >= 0; i--)
  323. {
  324. Destroy(zyrwContent.transform.GetChild(i).gameObject);
  325. }
  326. for (int i = zxmxContent.transform.childCount - 1; i >= 0; i--)
  327. {
  328. Destroy(zxmxContent.transform.GetChild(i).gameObject);
  329. }
  330. switch (type) {
  331. case YJType.BLUE:
  332. yjTitle.text = "蓝色预警";
  333. ChangeDDYAContent(GlobalData.xHDDAlertData.allAlert.blueAlert);
  334. break;
  335. case YJType.YELLOW:
  336. yjTitle.text = "黄色预警";
  337. ChangeDDYAContent(GlobalData.xHDDAlertData.allAlert.yellowAlert);
  338. break;
  339. case YJType.ORANGE:
  340. yjTitle.text = "橙色预警";
  341. ChangeDDYAContent(GlobalData.xHDDAlertData.allAlert.orangeAlert);
  342. break;
  343. case YJType.RED:
  344. yjTitle.text = "红色预警";
  345. ChangeDDYAContent(GlobalData.xHDDAlertData.allAlert.redAlert);
  346. break;
  347. }
  348. }
  349. void ChangeXHDDYA2()
  350. {
  351. for (int i = yrzzContent.transform.childCount - 1; i >= 0; i--)
  352. {
  353. Destroy(yrzzContent.transform.GetChild(i).gameObject);
  354. }
  355. for (int i = 0; i < GlobalData.emergencyResponseData.LDS.Count; i++)
  356. {
  357. GameObject obj = Instantiate(g0);
  358. obj.GetComponent<RectTransform>().SetParent(yrzzContent.transform);
  359. obj.GetComponent<RectTransform>().localScale = Vector3.one;
  360. obj.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = GlobalData.emergencyResponseData.LDS[i].unit;
  361. obj.transform.GetChild(0).GetChild(1).GetComponent<Text>().text = GlobalData.emergencyResponseData.LDS[i].position;
  362. obj.transform.GetChild(0).GetChild(2).GetComponent<Text>().text = GlobalData.emergencyResponseData.LDS[i].name;
  363. obj.transform.GetChild(0).GetChild(3).GetComponent<Text>().text = GlobalData.emergencyResponseData.LDS[i].phone;
  364. obj.transform.GetChild(1).GetChild(1).GetComponent<Text>().text = GlobalData.emergencyResponseData.LDS[i].responsibility;
  365. }
  366. }
  367. void ChangeXHDDYA3(int index)
  368. {
  369. for (int i = xgxzContent.transform.childCount - 1; i >= 0; i--)
  370. {
  371. Destroy(xgxzContent.transform.GetChild(i).gameObject);
  372. }
  373. for (int i = 0; i < GlobalData.allRegionData.regions[0].members.Count; i++)
  374. {
  375. GameObject obj = Instantiate(g1);
  376. obj.GetComponent<RectTransform>().SetParent(xgxzContent.transform);
  377. obj.GetComponent<RectTransform>().localScale = Vector3.one;
  378. obj.transform.GetChild(0).GetComponent<Text>().text = GlobalData.allRegionData.regions[0].members[i].village;
  379. obj.transform.GetChild(1).GetComponent<Text>().text = GlobalData.allRegionData.regions[0].members[i].position;
  380. obj.transform.GetChild(2).GetComponent<Text>().text = GlobalData.allRegionData.regions[0].members[i].name;
  381. obj.transform.GetChild(3).GetComponent<Text>().text = GlobalData.allRegionData.regions[0].members[i].phone;
  382. }
  383. regionDropdown.ClearOptions();
  384. List<Dropdown.OptionData> dropoptions = new List<Dropdown.OptionData>();
  385. for (int i = 0; i < GlobalData.allRegionData.regions.Count; i++)
  386. {
  387. dropoptions.Add(new Dropdown.OptionData(GlobalData.allRegionData.regions[i].region));
  388. }
  389. regionDropdown.AddOptions(dropoptions);
  390. regionDropdown.onValueChanged.RemoveAllListeners();
  391. regionDropdown.onValueChanged.AddListener((int index) =>
  392. {
  393. for (int i = xgxzContent.transform.childCount - 1; i >= 0; i--)
  394. {
  395. Destroy(xgxzContent.transform.GetChild(i).gameObject);
  396. }
  397. for (int i = 0; i < GlobalData.allRegionData.regions[index].members.Count;i++ ) {
  398. GameObject obj = Instantiate(g1);
  399. obj.GetComponent<RectTransform>().SetParent(xgxzContent.transform);
  400. obj.GetComponent<RectTransform>().localScale = Vector3.one;
  401. obj.transform.GetChild(0).GetComponent<Text>().text = GlobalData.allRegionData.regions[index].members[i].village;
  402. obj.transform.GetChild(1).GetComponent<Text>().text = GlobalData.allRegionData.regions[index].members[i].position;
  403. obj.transform.GetChild(2).GetComponent<Text>().text = GlobalData.allRegionData.regions[index].members[i].name;
  404. obj.transform.GetChild(3).GetComponent<Text>().text = GlobalData.allRegionData.regions[index].members[i].phone;
  405. }
  406. });
  407. }
  408. void InitButton()
  409. {
  410. enterBtn.onClick.AddListener(() =>
  411. {
  412. qxhddContent.gameObject.SetActive(false);
  413. xhddContent.gameObject.SetActive(true);
  414. inAniamtion = true;
  415. for (int j = 0; j < yjButtons.Length; j++)
  416. {
  417. yjButtons[j].GetComponent<CanvasGroup>().alpha = 0.2f;
  418. }
  419. yjButtons[0].GetComponent<CanvasGroup>().alpha = 1f;
  420. yJType = (YJType)(0);
  421. ChangeXHDDYA1(yJType);
  422. ChangeXHDDYA2();
  423. ChangeXHDDYA3(0);
  424. });
  425. exitBtn.onClick.AddListener(OnExitXHDDYS);
  426. for (int i = 0; i < yjButtons.Length; i++)
  427. {
  428. int temp = i;
  429. yjButtons[i].onClick.AddListener(() =>
  430. {
  431. if (!playing)
  432. {
  433. }
  434. for (int j = 0; j < yjButtons.Length; j++)
  435. {
  436. yjButtons[j].GetComponent<CanvasGroup>().alpha = 0.2f;
  437. }
  438. yjButtons[temp].GetComponent<CanvasGroup>().alpha = 1f;
  439. yJType = (YJType)(temp);
  440. ChangeXHDDYA1(yJType);
  441. });
  442. }
  443. }
  444. void AllRestore()
  445. {
  446. TimeLineControl.instance.transform.GetChild(1).GetChild(1).localPosition = Vector3.zero;
  447. TimeLineControl.instance.transform.GetChild(0).gameObject.SetActive(false);
  448. GameObject.FindGameObjectWithTag("HeMianStatic").transform.GetChild(2).gameObject.SetActive(true);
  449. Material material = TimeLineControl.instance.transform.GetChild(1).GetChild(0).GetComponent<MeshRenderer>().material;
  450. material.SetFloat("_ClipLength", 1);
  451. currentTime = 0;
  452. }
  453. async void ControlYJ()
  454. {
  455. switch (yJType)
  456. {
  457. case YJType.YELLOW:
  458. TimeLineControl.instance.transform.GetChild(1).GetChild(1).localPosition = Vector3.zero;
  459. await new WaitUntil(() =>
  460. {
  461. return currentTime > 1;
  462. });
  463. if (!playing)
  464. {
  465. mask.gameObject.SetActive(false);
  466. return;
  467. }
  468. StaticLod.instance.OnFoucusStatic("Bird1");
  469. await new WaitUntil(() =>
  470. {
  471. return currentTime > 3;
  472. });
  473. if (!playing)
  474. {
  475. mask.gameObject.SetActive(false);
  476. return;
  477. }
  478. TimeLineControl.instance.transform.GetChild(1).GetChild(1).DOLocalMove(new Vector3(0, 0, 31.2f), 12.0f);
  479. await new WaitUntil(() =>
  480. {
  481. return currentTime > 14;
  482. });
  483. if (!playing)
  484. {
  485. mask.gameObject.SetActive(false);
  486. return;
  487. }
  488. StaticLod.instance.OnFoucusStatic("Bird2");
  489. await new WaitUntil(() =>
  490. {
  491. return currentTime > 17;
  492. });
  493. if (!playing)
  494. {
  495. mask.gameObject.SetActive(false);
  496. return;
  497. }
  498. mask.gameObject.SetActive(false);
  499. break;
  500. case YJType.ORANGE:
  501. TimeLineControl.instance.transform.GetChild(1).GetChild(1).localPosition = new Vector3(0, 0, 31.2f);
  502. TimeLineControl.instance.transform.GetChild(0).gameObject.SetActive(false);
  503. await new WaitUntil(() =>
  504. {
  505. return currentTime > 1;
  506. });
  507. if (!playing)
  508. {
  509. mask.gameObject.SetActive(false);
  510. return;
  511. }
  512. StaticLod.instance.OnFoucusStatic("Bird3");
  513. await new WaitUntil(() =>
  514. {
  515. return currentTime > 3;
  516. });
  517. if (!playing)
  518. {
  519. mask.gameObject.SetActive(false);
  520. return;
  521. }
  522. TimeLineControl.instance.transform.GetChild(0).gameObject.SetActive(true);
  523. await new WaitUntil(() =>
  524. {
  525. return currentTime > 11;
  526. });
  527. if (!playing)
  528. {
  529. mask.gameObject.SetActive(false);
  530. return;
  531. }
  532. //StaticLod.instance.OnFoucusStatic("Bird3");
  533. await new WaitUntil(() =>
  534. {
  535. return currentTime > 14;
  536. });
  537. if (!playing)
  538. {
  539. mask.gameObject.SetActive(false);
  540. return;
  541. }
  542. mask.gameObject.SetActive(false);
  543. break;
  544. case YJType.RED:
  545. Material material = TimeLineControl.instance.transform.GetChild(1).GetChild(0).GetComponent<MeshRenderer>().material;
  546. TimeLineControl.instance.transform.GetChild(0).gameObject.SetActive(false);
  547. material.SetFloat("_ClipLength", 1);
  548. TimeLineControl.instance.transform.GetChild(1).GetChild(1).localPosition = new Vector3(0, 0, 31.2f);
  549. await new WaitUntil(() =>
  550. {
  551. return currentTime > 1;
  552. });
  553. if (!playing)
  554. {
  555. mask.gameObject.SetActive(false);
  556. return;
  557. }
  558. StaticLod.instance.OnFoucusStatic("Bird2");
  559. await new WaitUntil(() =>
  560. {
  561. return currentTime > 4;
  562. });
  563. if (!playing)
  564. {
  565. mask.gameObject.SetActive(false);
  566. return;
  567. }
  568. StaticLod.instance.OnFoucusStatic("Bird4");
  569. GameObject tkobj = StaticLod.instance.staticImportants[1].gameObject;
  570. tkobj.transform.GetChild(1).GetComponent<Animator>().Play("ZhaMen");
  571. await new WaitUntil(() =>
  572. {
  573. return currentTime > 5.2;
  574. });
  575. if (!playing)
  576. {
  577. mask.gameObject.SetActive(false);
  578. return;
  579. }
  580. await new WaitUntil(() =>
  581. {
  582. return currentTime > 6.7;
  583. });
  584. StaticLod.instance.OnFoucusStatic("Bird5");
  585. CameraManager.instance.mainCamera.GetComponent<CameraBird>().target.DOLocalMoveX(2650, 7.0f);
  586. await new WaitUntil(() =>
  587. {
  588. return currentTime > 14.7;
  589. });
  590. material.SetFloat("_ClipLength", 1f);
  591. DOTween.To(() => material.GetFloat("_ClipLength"), x => material.SetFloat("_ClipLength", x), 0.981f, 2f);
  592. if (!playing)
  593. {
  594. mask.gameObject.SetActive(false);
  595. return;
  596. }
  597. await new WaitUntil(() =>
  598. {
  599. return currentTime > 15.7;
  600. });
  601. if (!playing)
  602. {
  603. mask.gameObject.SetActive(false);
  604. return;
  605. }
  606. //StaticLod.instance.OnFoucusStatic("Bird5");
  607. DOTween.To(() => material.GetFloat("_ClipLength"), x => material.SetFloat("_ClipLength", x), 0.881f, 4f);
  608. await new WaitUntil(() =>
  609. {
  610. return currentTime > 20.7;
  611. });
  612. if (!playing)
  613. {
  614. mask.gameObject.SetActive(false);
  615. return;
  616. }
  617. StaticLod.instance.OnFoucusStatic("Bird3");
  618. DOTween.To(() => material.GetFloat("_ClipLength"), x => material.SetFloat("_ClipLength", x), 0.1f, 6f);
  619. await new WaitUntil(() =>
  620. {
  621. return currentTime > 26.7;
  622. });
  623. if (!playing)
  624. {
  625. mask.gameObject.SetActive(false);
  626. return;
  627. }
  628. mask.gameObject.SetActive(false);
  629. break;
  630. }
  631. }
  632. // Update is called once per frame
  633. void Update()
  634. {
  635. currentTime += Time.deltaTime;
  636. GameObject tkobj = StaticLod.instance.staticImportants[1].gameObject;
  637. tkobj.transform.GetChild(1).gameObject.SetActive(inAniamtion);
  638. tkobj.transform.GetChild(tkobj.transform.childCount - 1).gameObject.SetActive(!inAniamtion);
  639. }
  640. }