TaskView.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using ET;
  2. using FairyGUI;
  3. using UI.Task;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class TaskView : BaseWindow
  8. {
  9. private UI_TaskUI _ui;
  10. private ValueBarController _valueBarController;
  11. public override void Dispose()
  12. {
  13. if (_valueBarController != null)
  14. {
  15. _valueBarController.Dispose();
  16. _valueBarController = null;
  17. }
  18. if (_ui != null)
  19. {
  20. _ui.Dispose();
  21. _ui = null;
  22. }
  23. base.Dispose();
  24. }
  25. protected override void OnInit()
  26. {
  27. base.OnInit();
  28. packageName = UI_TaskUI.PACKAGE_NAME;
  29. _ui = UI_TaskUI.Create();
  30. this.viewCom = _ui.target;
  31. isfullScreen = true;
  32. _valueBarController = new ValueBarController(_ui.m_comValueBar);
  33. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
  34. _ui.m_c1.onChanged.Add(OnCtrlChange);
  35. }
  36. protected override void AddEventListener()
  37. {
  38. base.AddEventListener();
  39. }
  40. protected override void OnShown()
  41. {
  42. base.OnShown();
  43. _valueBarController.OnShown();
  44. _ui.m_c1.selectedIndex = this.viewData == null ? 1 : (int)(this.viewData as object[])[0];
  45. }
  46. protected override void OnHide()
  47. {
  48. base.OnHide();
  49. _valueBarController.OnHide();
  50. _ui.m_c1.selectedIndex = 0;
  51. }
  52. protected override void RemoveEventListener()
  53. {
  54. base.RemoveEventListener();
  55. }
  56. private void OnCtrlChange()
  57. {
  58. if (_ui.m_c1.selectedIndex == 1)
  59. {
  60. // ViewManager.Show<DailyTaskView>()
  61. }
  62. else if (_ui.m_c1.selectedIndex == 2)
  63. {
  64. }
  65. }
  66. }
  67. }