LeagueSkillView.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using ET;
  2. using FairyGUI;
  3. using UI.CommonGame;
  4. using UI.League;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. //联盟技能
  9. public class LeagueSkillView : BaseWindow
  10. {
  11. private UI_LeagueSkillUI _ui;
  12. private ValueBarController _valueBarController;
  13. public override void Dispose()
  14. {
  15. if (_valueBarController != null)
  16. {
  17. _valueBarController.Dispose();
  18. _valueBarController = null;
  19. }
  20. if (_ui != null)
  21. {
  22. _ui.Dispose();
  23. _ui = null;
  24. }
  25. base.Dispose();
  26. }
  27. protected override void OnInit()
  28. {
  29. base.OnInit();
  30. packageName = UI_LeagueSkillUI.PACKAGE_NAME;
  31. _ui = UI_LeagueSkillUI.Create();
  32. this.viewCom = _ui.target;
  33. isfullScreen = true;
  34. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  35. _ui.m_listScore.itemRenderer = RenderListScoreItem;
  36. _ui.m_list.itemRenderer = RenderListItem;
  37. _valueBarController = new ValueBarController(_ui.m_comValue);
  38. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing");
  39. }
  40. protected override void AddEventListener()
  41. {
  42. base.AddEventListener();
  43. }
  44. protected override void OnShown()
  45. {
  46. base.OnShown();
  47. _valueBarController.OnShown();
  48. _valueBarController.Controller(11);
  49. _ui.m_listScore.numItems = 4;
  50. _ui.m_list.numItems = LeagueSkillCountCfgArray.Instance.dataArray.Length;
  51. }
  52. protected override void OnHide()
  53. {
  54. base.OnHide();
  55. if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
  56. _valueBarController.OnHide();
  57. }
  58. protected override void RemoveEventListener()
  59. {
  60. base.RemoveEventListener();
  61. }
  62. private void OnBtnBackClick()
  63. {
  64. ViewManager.GoBackFrom(typeof(LeagueSkillView).FullName);
  65. }
  66. private void RenderListScoreItem(int index, GObject obj)
  67. {
  68. UI_ListScoreItem item = UI_ListScoreItem.Proxy(obj);
  69. item.m_loaIcon.url = ResPathUtil.GetScorePath(index + 1);
  70. item.m_txtProperty.text = LeagueDataManager.Instance.GetAllSkillScore(index + 1).ToString();
  71. UI_ListScoreItem.ProxyEnd();
  72. }
  73. private void RenderListItem(int index, GObject obj)
  74. {
  75. LeagueSkillCountCfg skillCountCfg = LeagueSkillCountCfgArray.Instance.GetCfg(index);
  76. UI_ListSkillTypeItem item = UI_ListSkillTypeItem.Proxy(obj);
  77. item.m_txtProgress.text = LeagueDataManager.Instance.GetSkillProgressByType(skillCountCfg.type).ToString();
  78. if (item.target.data == null)
  79. {
  80. item.target.onClick.Add(OnUpSkillClick);
  81. }
  82. UI_ListSkillTypeItem.ProxyEnd();
  83. }
  84. private void OnUpSkillClick(EventContext context)
  85. {
  86. GObject obj = context.sender as GObject;
  87. int type = (int)obj.data;
  88. ViewManager.Show<LeagueSkillUpView>(type);
  89. }
  90. }
  91. }