PanelHelper.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. using YLBattle;
  8. /// <summary>
  9. /// 面板管理器
  10. /// </summary>
  11. public class PanelHelper : MonoSingleton<PanelHelper>
  12. {
  13. /// <summary>
  14. /// WindowsObjDict 列表
  15. /// </summary>
  16. private Dictionary<string, GameObject> WindowsObjDict = new Dictionary<string, GameObject>();
  17. /// <summary>
  18. /// 正在加载的界面
  19. /// </summary>
  20. private List<string> loadingUIs = new List<string>();
  21. /// <summary>
  22. /// 当前 最后打开的界面名称
  23. /// </summary>
  24. private string nowPanelName;
  25. /// <summary>
  26. /// 显示面板
  27. /// </summary>
  28. /// <param name="__name">面板名称</param>
  29. /// <param name="acCallBack">成功的回调</param>
  30. /// <param name="param">参数</param>
  31. /// <param name="sortingLayerOrder">显示序列</param>
  32. /// <param name="tran">父级</param>
  33. /// <param name="cameraPath">相机路径</param>
  34. public void ShowPanel(string __name, Action<GameObject> acCallBack = null, object param = null, int sortingLayerOrder = -1, Transform tran = null, string cameraPath = "")
  35. {
  36. //Debug.Log("ShowPanel :" + _name);
  37. // UI_DBControlWindow.Instance().ResetCurrentType(EDBControlWindowType.Others);
  38. nowPanelName = __name;
  39. if (WindowsObjDict.ContainsKey(__name))
  40. {
  41. if (WindowsObjDict[__name] == null)
  42. {
  43. WindowsObjDict.Remove(__name);
  44. }
  45. else
  46. {
  47. SetSortingLayerOrder(WindowsObjDict[__name], sortingLayerOrder);
  48. // 设置参数
  49. GameBehavior behavior = WindowsObjDict[__name].GetComponent<GameBehavior>();
  50. if (behavior != null)
  51. {
  52. behavior.SetParameter(param);
  53. behavior.enterAc = acCallBack;
  54. }
  55. if (WindowsObjDict[__name].active)
  56. {
  57. if (behavior != null)
  58. {
  59. behavior.BaseRefresh();
  60. }
  61. }
  62. else
  63. {
  64. WindowsObjDict[__name].SetActive(true);
  65. }
  66. if (acCallBack != null)
  67. {
  68. acCallBack(WindowsObjDict[__name]);
  69. }
  70. return;
  71. }
  72. }
  73. // 改界面正在加载中,中断
  74. if (loadingUIs.Contains(__name))
  75. {
  76. return;
  77. }
  78. else
  79. {
  80. loadingUIs.Add(__name);
  81. }
  82. ResourceHelper.Instance.LoadAssetBundle(__name, (AssetBundle ab) =>
  83. {
  84. loadingUIs.Remove(__name);
  85. if (ab == null)
  86. {
  87. Debug.LogError("loaderror:" + __name);
  88. return;
  89. }
  90. GameObject abGo = ab.LoadAsset<GameObject>(__name);
  91. GameObject obj = (GameObject)Instantiate(abGo);
  92. obj.name = nowPanelName;
  93. obj.AddComponent<FixUIShader>();
  94. obj.SetActive(false);
  95. SetFont(obj); // 设置字体
  96. SetCamera(obj, cameraPath); // 设置摄像机
  97. SetLabelContentByLanaguage(obj); //
  98. SetSortingLayerOrder(obj, sortingLayerOrder);
  99. if (obj != null)
  100. {
  101. if (tran != null)
  102. {
  103. obj.transform.SetParent(tran);
  104. obj.transform.localPosition = Vector3.zero;
  105. obj.transform.localScale = Vector3.one;
  106. }
  107. // 设置 localScale 为 1 ,不然在编辑器的全屏模式下,scroll view 的滚动条会自己移动一段距离
  108. obj.transform.localScale = Vector3.one;
  109. // 绑定脚本
  110. if (Application.platform == RuntimePlatform.Android)
  111. {
  112. AssemblyHelper.Instance.BindScript(__name, obj);
  113. }
  114. else
  115. {
  116. Type tp = Type.GetType(__name);
  117. obj.AddComponent(tp);
  118. }
  119. // 设置参数
  120. GameBehavior behavior = obj.GetComponent<GameBehavior>();
  121. if (behavior != null)
  122. {
  123. behavior.SetParameter(param);
  124. behavior.enterAc = acCallBack;
  125. }
  126. if (obj.active)
  127. {
  128. behavior.BaseRefresh();
  129. }
  130. else
  131. {
  132. obj.SetActive(true);
  133. // 返回所有使用此界面的回调
  134. if (acCallBack != null)
  135. {
  136. acCallBack(obj);
  137. }
  138. }
  139. WindowsObjDict.Add(__name, obj);
  140. }
  141. else
  142. {
  143. Debug.LogWarning("读取界面失败 " + __name);
  144. }
  145. });
  146. }
  147. internal void ShowPanel(string functionPanel, object p1, NpcInfoVo npcVo, object p2)
  148. {
  149. throw new NotImplementedException();
  150. }
  151. /// <summary>
  152. /// 显示面板
  153. /// </summary>
  154. /// <param name="__name">面板名称</param>
  155. /// <param name="acCallBack">成功的回调</param>
  156. /// <param name="param">参数</param>
  157. /// <param name="sortingLayerOrder">显示序列</param>
  158. /// <param name="tran">父级</param>
  159. /// <param name="cameraPath">相机路径</param>
  160. public void LoadPanel(string __name, Transform tran = null, string cameraPath = "")
  161. {
  162. if (WindowsObjDict.ContainsKey(__name))
  163. {
  164. if (WindowsObjDict[__name] == null)
  165. {
  166. WindowsObjDict.Remove(__name);
  167. }
  168. }
  169. ResourceHelper.Instance.LoadAssetBundle(__name, (AssetBundle ab) =>
  170. {
  171. if (ab == null)
  172. {
  173. Debug.LogError("loaderror:" + __name);
  174. return;
  175. }
  176. GameObject obj = (GameObject)Instantiate(ab.LoadAsset(__name));
  177. obj.AddComponent<FixUIShader>();
  178. obj.SetActive(false);
  179. SetFont(obj); // 设置字体
  180. SetCamera(obj, cameraPath); // 设置摄像机
  181. SetLabelContentByLanaguage(obj); //
  182. if (obj != null)
  183. {
  184. if (tran != null)
  185. {
  186. obj.transform.SetParent(tran);
  187. obj.transform.localPosition = Vector3.zero;
  188. obj.transform.localScale = Vector3.one;
  189. }
  190. // 设置 localScale 为 1 ,不然在编辑器的全屏模式下,scroll view 的滚动条会自己移动一段距离
  191. obj.transform.localScale = Vector3.one;
  192. // 绑定脚本
  193. if (Application.platform == RuntimePlatform.Android)
  194. {
  195. AssemblyHelper.Instance.BindScript(__name, obj);
  196. }
  197. else
  198. {
  199. Type tp = Type.GetType(__name);
  200. obj.AddComponent(tp);
  201. }
  202. WindowsObjDict.Add(__name, obj);
  203. }
  204. else
  205. {
  206. Debug.LogWarning("读取界面失败 " + __name);
  207. }
  208. });
  209. }
  210. public string GetNowPanelName()
  211. {
  212. return this.nowPanelName;
  213. }
  214. /// <summary>
  215. /// 关闭指定panel
  216. /// </summary>
  217. /// <param name="_name">panel名称</param>
  218. public void ClosePanel(string _name, bool unload = false)
  219. {
  220. if (unload)
  221. {
  222. UnloadPanel(_name);
  223. return;
  224. }
  225. if (WindowsObjDict.ContainsKey(_name))
  226. {
  227. if (WindowsObjDict[_name] != null)
  228. {
  229. WindowsObjDict[_name].SetActive(false);
  230. }
  231. }
  232. }
  233. /// <summary>
  234. /// 关闭所有panel
  235. /// </summary>
  236. public void CloseAllPanel(string excludeName = "")
  237. {
  238. List<string> KeyList = new List<string>(WindowsObjDict.Keys);
  239. for (int i = 0; i < KeyList.Count; i++)
  240. {
  241. if (excludeName != KeyList[i])
  242. {
  243. ClosePanel(KeyList[i]);
  244. }
  245. }
  246. }
  247. /// <summary>
  248. /// 卸载界面资源
  249. /// </summary>
  250. /// <param name="_name">界面名称</param>
  251. public void UnloadPanel(string _name)
  252. {
  253. ResourceHelper.Instance.UnloadAssetBundle(_name);
  254. if (WindowsObjDict.ContainsKey(_name))
  255. {
  256. Destroy(WindowsObjDict[_name]);
  257. WindowsObjDict.Remove(_name);
  258. }
  259. }
  260. /// <summary>
  261. /// 卸载所有加载的界面资源
  262. /// </summary>
  263. public void UnloadAllPanel()
  264. {
  265. List<string> KeyList = new List<string>(WindowsObjDict.Keys);
  266. for (int i = 0; i < KeyList.Count; i++)
  267. {
  268. UnloadPanel(KeyList[i]);
  269. }
  270. Resources.UnloadUnusedAssets();
  271. }
  272. /// <summary>
  273. /// 设置 UI 的字体
  274. /// </summary>
  275. /// <param name="uiObj"> UI对象 </param>
  276. public void SetFont(GameObject uiObj)
  277. {
  278. if (null == uiObj)
  279. {
  280. Debug.LogError("PanelHelper 设置字体,UI 为空,中断");
  281. return;
  282. }
  283. // 获取所有的 Text
  284. Text[] allText = uiObj.GetComponentsInChildren<Text>(true);
  285. // 设置字体
  286. for (int i = 0; i < allText.Length; i++)
  287. {
  288. if (allText[i].font == null)
  289. {
  290. allText[i].font = FontManager.Instance().CurFont;
  291. }
  292. else if (allText[i].font.fontNames.Contains("Arial"))
  293. {
  294. allText[i].font = FontManager.Instance().CurFont;
  295. }
  296. else
  297. {
  298. Debug.Log(uiObj + "界面中" + allText[i].name + "为特殊字体,无需更换!");
  299. }
  300. ////allText[i].fontStyle = FontStyle.Normal;
  301. }
  302. }
  303. /// <summary>
  304. /// 根据对应的语言,刷新UI上显示的文字
  305. /// </summary>
  306. /// <param name="uiObj"></param>
  307. public void SetLabelContentByLanaguage(GameObject uiObj)
  308. {
  309. Text[] allLabels = uiObj.transform.GetComponentsInChildren<Text>(true);
  310. string prefix = uiObj.name.Replace("(Clone)", "");
  311. foreach (Text text in allLabels)
  312. {
  313. string key = prefix + "_" + text.name;
  314. if (GameCfg.CheckIsExistKey(key))
  315. {
  316. text.text = GameCfg.GetStr(key);
  317. }
  318. }
  319. }
  320. /// <summary>
  321. ///
  322. /// </summary>
  323. public void SetSortingLayerOrder(GameObject uiObj, int sortingLayerOrder = -1)
  324. {
  325. if (null == uiObj)
  326. {
  327. Debug.LogError("PanelHelper 设置canvas的order in Layer,UI 为空,中断");
  328. return;
  329. }
  330. Canvas canvas = uiObj.GetComponent<Canvas>();
  331. if (null == canvas)
  332. {
  333. Debug.LogError("PanelHelper 设置摄像机,获取画布组件失败,中断");
  334. return;
  335. }
  336. if (sortingLayerOrder > 0)
  337. {
  338. canvas.sortingOrder = sortingLayerOrder;
  339. }
  340. }
  341. /// <summary>
  342. /// 设置 UI 的摄像机
  343. /// </summary>
  344. /// <param name="uiObj"> UI对象 </param>
  345. /// <param name="camPath">指定相机位置</param>
  346. public void SetCamera(GameObject uiObj, string camPath)
  347. {
  348. if (null == uiObj)
  349. {
  350. Debug.LogWarning("PanelHelper 设置摄像机,UI 为空,中断");
  351. return;
  352. }
  353. GameObject cameraObj = null;
  354. if (string.IsNullOrEmpty(camPath) == false)
  355. {
  356. cameraObj = GameObject.Find(camPath);
  357. }
  358. else
  359. {
  360. cameraObj = GameObject.Find("UICamera");
  361. }
  362. if (null == cameraObj)
  363. {
  364. Debug.LogWarning("PanelHelper 设置摄像机,找不到摄像机,中断");
  365. return;
  366. }
  367. Canvas canvas = uiObj.GetComponent<Canvas>();
  368. if (null == canvas)
  369. {
  370. Debug.LogWarning("PanelHelper 设置摄像机,获取画布组件失败,中断");
  371. return;
  372. }
  373. canvas.worldCamera = cameraObj.GetComponent<Camera>();
  374. }
  375. /// <summary>
  376. /// 获取某个界面的显示状态
  377. /// </summary>
  378. /// <param name="panel_name"></param>
  379. /// <returns></returns>
  380. public bool GetPanelShowState(string _name)
  381. {
  382. if (WindowsObjDict.ContainsKey(_name))
  383. {
  384. return WindowsObjDict[_name].activeSelf;
  385. }
  386. return false;
  387. }
  388. #region Guide
  389. /// <summary>
  390. /// 是否存在某个物体
  391. /// </summary>
  392. /// <param name="ui"></param>
  393. /// <param name="path"></param>
  394. /// <param name="obj_name"></param>
  395. /// <returns></returns>
  396. public GameObject CheckOjbIsExist(string ui, string path, string obj_name = "")
  397. {
  398. if (WindowsObjDict.ContainsKey(ui))
  399. {
  400. if (null != WindowsObjDict[ui])
  401. {
  402. Transform t = WindowsObjDict[ui].transform.Find(path);
  403. if (t != null)
  404. {
  405. if (obj_name.Length <= 0)
  406. {
  407. return t.gameObject;
  408. }
  409. Transform novArrow = t.Find(obj_name);
  410. if (novArrow != null)
  411. {
  412. return novArrow.gameObject;
  413. }
  414. }
  415. }
  416. }
  417. return null;
  418. }
  419. /// <summary>
  420. /// 卸载指定控件
  421. /// </summary>
  422. /// <param name="ui"></param>
  423. /// <param name="path"></param>
  424. /// <param name="obj_name"></param>
  425. public void UnInstallObjToUI(string ui, string path, string obj_name)
  426. {
  427. if (WindowsObjDict.ContainsKey(ui))
  428. {
  429. if (null != WindowsObjDict[ui])
  430. {
  431. Transform t = WindowsObjDict[ui].transform.Find(path);
  432. Transform novArrow = t.Find(obj_name);
  433. if (novArrow != null)
  434. {
  435. MonoBehaviour.DestroyObject(novArrow.gameObject);
  436. }
  437. }
  438. }
  439. }
  440. /// <summary>
  441. /// 给 UI 添加一个游戏物体
  442. /// </summary>
  443. /// <param name="go"> 游戏物体 </param>
  444. /// <param name="ui"> UI 的名称 </param>
  445. /// <param name="path"> 路径 </param>
  446. /// <param name="offset"> 偏移量 </param>
  447. /// <param name="ac_Find"> 回调,返回是否查找成功 </param>
  448. public void AttachObjToUI(GameObject go, string ui, string path, Vector3 offset, Action<GameObject> ac_Find, string cameraPath = "", bool isAbsolute = false)
  449. {
  450. Transform t = null;
  451. if (WindowsObjDict.ContainsKey(ui))
  452. {
  453. if (null != WindowsObjDict[ui])
  454. {
  455. WindowsObjDict[ui].SetActive(true);
  456. t = WindowsObjDict[ui].transform.Find(path);
  457. }
  458. }
  459. else
  460. {
  461. GameObject Trg = GameObject.Find(ui + "/" + path);
  462. if (Trg != null)
  463. {
  464. t = Trg.transform;
  465. }
  466. }
  467. if (null != t)
  468. {
  469. if (go != null)
  470. {
  471. go.transform.SetParent(t, false);
  472. go.transform.localPosition = offset;
  473. }
  474. // 新手引导 节点 该节点为 绝对事件 (只该指向UI 受事件响应)
  475. if (isAbsolute)
  476. {
  477. UI_GuideMarkWindow.Instance().OpenCover();
  478. }
  479. Canvas canvas = t.gameObject.GetComponent<Canvas>();
  480. if (canvas == null)
  481. {
  482. canvas = t.gameObject.AddComponent<Canvas>();
  483. }
  484. canvas.overrideSorting = true;
  485. canvas.sortingLayerID = 1;
  486. GraphicRaycaster GR = t.gameObject.GetComponent<GraphicRaycaster>();
  487. if (GR == null)
  488. {
  489. GR = t.gameObject.AddComponent<GraphicRaycaster>();
  490. }
  491. GR.enabled = true;
  492. t.gameObject.AddComponent<UI_GuideDelayCanvas>();
  493. canvas.sortingOrder = 100;
  494. // 查找成功
  495. if (null != ac_Find)
  496. {
  497. ac_Find(t.gameObject);
  498. }
  499. return;
  500. }
  501. //else
  502. //{
  503. // Debug.LogError("查找失败..." + path);
  504. // if (go != null)
  505. // {
  506. // go.transform.SetParent(WindowsObjDict[ui].transform, false);
  507. // }
  508. // // 查找失败
  509. // if (null != ac_Find)
  510. // {
  511. // ac_Find(null);
  512. // }
  513. //}
  514. // 查找失败
  515. if (null != ac_Find)
  516. {
  517. ac_Find(null);
  518. }
  519. #region old
  520. //else
  521. //{
  522. // PanelHelper.Instance.ShowPanel(ui, null, null, false, true, (GameObject uiObj) =>
  523. // {
  524. // Transform t = WindowsObjDict[ui].transform.Find(path);
  525. // if (null != t)
  526. // {
  527. // go.transform.SetParent(t, false);
  528. // go.transform.localPosition = Vector3.zero;
  529. // go.transform.localPosition += offset;
  530. // // 新手引导 节点 该节点为 绝对事件 (只该指向UI 受事件响应)
  531. // if (isAbsolute)
  532. // {
  533. // UI_GuideMarkWindow.Instance().OpenCover();
  534. // t.gameObject.AddComponent<Canvas>();
  535. // t.gameObject.AddComponent<GraphicRaycaster>();
  536. // t.gameObject.AddComponent<UI_GuideDelayCanvas>();
  537. // }
  538. // // 查找成功
  539. // if (null != ac_Find)
  540. // {
  541. // ac_Find(t.gameObject);
  542. // }
  543. // }
  544. // else
  545. // {
  546. // // 查找失败
  547. // if (null != ac_Find)
  548. // {
  549. // ac_Find(null);
  550. // }
  551. // }
  552. // }, cameraPath);
  553. //}
  554. #endregion
  555. }
  556. /// <summary>
  557. ///
  558. /// </summary>
  559. /// <param name="go"></param>
  560. /// <param name="arraw"></param>
  561. public void UnloadObjToUI(GameObject arraw)
  562. {
  563. //Debug.LogError("UnloadObjToUI xx");
  564. Transform prtTran = arraw.transform.parent;
  565. if (prtTran == null)
  566. {
  567. return;
  568. }
  569. //回到原来的层级
  570. Canvas canvas = prtTran.GetComponent<Canvas>();
  571. if (null != canvas)
  572. {
  573. canvas.sortingLayerName = "Default";
  574. canvas.overrideSorting = false;
  575. }
  576. Renderer[] renders = prtTran.GetComponentsInChildren<Renderer>(true);
  577. for (int i = 0; i < renders.Length; i++)
  578. {
  579. renders[i].sortingLayerName = "Default";
  580. }
  581. UI_GuideDelayCanvas delay = prtTran.GetComponent<UI_GuideDelayCanvas>();
  582. if (null != delay)
  583. {
  584. delay.enabled = false;
  585. }
  586. MonoBehaviour.DestroyObject(arraw);
  587. }
  588. /// <summary>
  589. /// 高亮指定控件
  590. /// </summary>
  591. /// <param name="ui"></param>
  592. /// <param name="path"></param>
  593. public void OnLightGetComponent(string ui, string path, Action<bool> ac, Vector3 offset, int angle, GameObject markOjb = null)
  594. {
  595. Transform t = null;
  596. if (WindowsObjDict.ContainsKey(ui))
  597. {
  598. if (null != WindowsObjDict[ui])
  599. {
  600. WindowsObjDict[ui].SetActive(true);
  601. t = WindowsObjDict[ui].transform.Find(path);
  602. }
  603. }
  604. else
  605. {
  606. GameObject Trg = GameObject.Find(ui + "/" + path);
  607. if (Trg != null)
  608. {
  609. t = Trg.transform;
  610. }
  611. }
  612. if (null != t)
  613. {
  614. if (markOjb != null)
  615. {
  616. markOjb.transform.SetParent(t, false);
  617. markOjb.transform.localPosition = offset;
  618. markOjb.transform.localRotation = new Quaternion(0, 0, angle, 0);
  619. }
  620. Canvas canvas = t.gameObject.GetComponent<Canvas>();
  621. if (canvas == null)
  622. {
  623. canvas = t.gameObject.AddComponent<Canvas>();
  624. }
  625. canvas.sortingOrder = 100;
  626. GraphicRaycaster GR = t.gameObject.GetComponent<GraphicRaycaster>();
  627. if (GR == null)
  628. {
  629. t.gameObject.AddComponent<GraphicRaycaster>();
  630. }
  631. t.gameObject.AddComponent<UI_GuideDelayCanvas>();
  632. if (ac != null)
  633. {
  634. ac(true);
  635. }
  636. return;
  637. }
  638. if (ac != null)
  639. {
  640. ac(false);
  641. }
  642. }
  643. /// <summary>
  644. /// 恢复(变暗)指定控件
  645. /// </summary>
  646. /// <param name="ui"></param>
  647. /// <param name="path"></param>
  648. public void OnDarkGetComponent(string ui, string path, Action<bool> ac, GameObject markOjb = null)
  649. {
  650. if (markOjb != null)
  651. {
  652. MonoBehaviour.DestroyObject(markOjb);
  653. }
  654. if (WindowsObjDict.ContainsKey(ui))
  655. {
  656. if (null != WindowsObjDict[ui])
  657. {
  658. Transform t = WindowsObjDict[ui].transform.Find(path);
  659. if (t != null)
  660. {
  661. //回到原来的层级
  662. Canvas canvas = (Canvas)BattleStaticFunc.GetParentScript(t, "Canvas", true);
  663. if (null != canvas)
  664. {
  665. canvas.sortingLayerName = "Default";
  666. canvas.overrideSorting = false;
  667. }
  668. Renderer[] renders = gameObject.GetComponentsInChildren<Renderer>(true);
  669. for (int i = 0; i < renders.Length; i++)
  670. {
  671. renders[i].sortingLayerName = "Default";
  672. }
  673. UI_GuideDelayCanvas delay = gameObject.GetComponent<UI_GuideDelayCanvas>();
  674. if (null != delay)
  675. {
  676. delay.enabled = false;
  677. }
  678. if (ac != null)
  679. {
  680. ac(true);
  681. return;
  682. }
  683. }
  684. }
  685. }
  686. if (ac != null)
  687. {
  688. ac(false);
  689. }
  690. }
  691. public GameObject GetPanelByName(string panelName)
  692. {
  693. if (WindowsObjDict.ContainsKey(panelName))
  694. if (WindowsObjDict.ContainsKey(panelName))
  695. {
  696. return WindowsObjDict[panelName];
  697. }
  698. return null;
  699. }
  700. #endregion
  701. }