FunctionOpenView.cs 2.0 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. private GameObject _effectObj;
  12. private GoWrapper _wrapper;
  13. public override void Dispose()
  14. {
  15. base.Dispose();
  16. }
  17. protected override void OnInit()
  18. {
  19. base.OnInit();
  20. packageName = UI_FunctionOpenUI.PACKAGE_NAME;
  21. _ui = UI_FunctionOpenUI.Create();
  22. this.viewCom = _ui.target;
  23. isfullScreen = true;
  24. this.viewCom.Center();
  25. }
  26. protected override void OnShown()
  27. {
  28. base.OnShown();
  29. List<string> funList = (viewData as object) as List<string>;
  30. AddFunDatas(funList);
  31. UpdateFunIcon();
  32. }
  33. private void AddFunDatas(List<string> itemList)
  34. {
  35. for (int i = 0; i < itemList.Count; i++)
  36. {
  37. if (_funList.IndexOf(itemList[i]) < 0)
  38. {
  39. _funList.Add(itemList[i]);
  40. }
  41. }
  42. }
  43. private void UpdateFunIcon()
  44. {
  45. if (_funList.Count == 0)
  46. {
  47. this.Hide();
  48. return;
  49. }
  50. // string resPath = ResPathUtil.GetDressUpAnimationPath("ui_xjs");
  51. // SceneController.AddObjectToView(_effectObj, _wrapper, _ui.m_holder, resPath, out _effectObj, out _wrapper);
  52. FunctionOpenCfg cfg = FunctionOpenCfgArray.Instance.GetCfg(_funList[0]);
  53. _ui.m_ComFunctionOpen.m_txtName.text = cfg.name;
  54. _ui.m_ComFunctionOpen.m_logIcon.url = ResPathUtil.GetCommonGameResPath(cfg.res);
  55. _funList.RemoveAt(0);
  56. _ui.m_t0.Play(UpdateFunIcon);
  57. }
  58. protected override void OnHide()
  59. {
  60. base.OnHide();
  61. }
  62. }
  63. }