FunctionOpenView.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using UnityEngine;
  2. using FairyGUI;
  3. using UI.CommonGame;
  4. using System.Collections.Generic;
  5. namespace GFGGame
  6. {
  7. public class FunctionOpenView : BaseWindow
  8. {
  9. private UI_FunctionOpenUI _ui;
  10. List<string> _funList = new List<string>();
  11. public override void Dispose()
  12. {
  13. base.Dispose();
  14. }
  15. protected override void OnInit()
  16. {
  17. base.OnInit();
  18. packageName = UI_FunctionOpenUI.PACKAGE_NAME;
  19. _ui = UI_FunctionOpenUI.Create();
  20. this.viewCom = _ui.target;
  21. isfullScreen = true;
  22. this.viewCom.Center();
  23. }
  24. protected override void OnShown()
  25. {
  26. base.OnShown();
  27. List<string> funList = (viewData as object) as List<string>;
  28. AddFunDatas(funList);
  29. UpdateFunIcon();
  30. // _ui.m_t0.Play(UpdateFunIcon);
  31. // Timers.inst.Remove(UpdateFunIcon);
  32. // Timers.inst.Add(1.5f, _funList.Count, UpdateFunIcon);
  33. }
  34. private void AddFunDatas(List<string> itemList)
  35. {
  36. for (int i = 0; i < itemList.Count; i++)
  37. {
  38. if (_funList.IndexOf(itemList[i]) < 0)
  39. {
  40. _funList.Add(itemList[i]);
  41. }
  42. }
  43. }
  44. private void UpdateFunIcon()
  45. {
  46. if (_funList.Count == 0)
  47. {
  48. this.Hide();
  49. return;
  50. }
  51. FunctionOpenCfg cfg = FunctionOpenCfgArray.Instance.GetCfg(_funList[0]);
  52. _ui.m_ComFunctionOpen.m_txtName.text = cfg.name;
  53. _ui.m_ComFunctionOpen.m_logIcon.url = ResPathUtil.GetCommonGameResPath(cfg.res);
  54. _funList.RemoveAt(0);
  55. _ui.m_t0.Play(UpdateFunIcon);
  56. }
  57. protected override void OnHide()
  58. {
  59. base.OnHide();
  60. }
  61. }
  62. }