StudioFilingView.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System.Collections.Generic;
  2. using ET;
  3. using FairyGUI;
  4. using UI.Studio;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. public class StudioFilingView : BaseWindow
  9. {
  10. private UI_StudioFilingUI _ui;
  11. private FilingCfg _filingCfg;
  12. private List<StoryLevelCfg> _storyLevelCfgs;
  13. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. _ui = null;
  19. }
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_StudioFilingUI.PACKAGE_NAME;
  26. _ui = UI_StudioFilingUI.Create();
  27. this.viewCom = _ui.target;
  28. isfullScreen = true;
  29. _ui.m_list.itemRenderer = RenderListItem;
  30. _ui.m_list.onClickItem.Add(OnListItemClick);
  31. _ui.m_btnBack.onClick.Add(Hide);
  32. _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
  33. _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
  34. _ui.m_btnAdd.onClick.Add(OnBtnAddClick);
  35. _ui.m_btnSuit.onClick.Add(OnBtnSuitClick);
  36. }
  37. protected override void AddEventListener()
  38. {
  39. base.AddEventListener();
  40. }
  41. protected override void OnShown()
  42. {
  43. base.OnShown();
  44. UpdateView();
  45. }
  46. protected override void OnHide()
  47. {
  48. base.OnHide();
  49. ViewManager.GoBackFrom(typeof(StudioFilingView).FullName);
  50. }
  51. protected override void RemoveEventListener()
  52. {
  53. base.RemoveEventListener();
  54. }
  55. private void UpdateView()
  56. {
  57. _filingCfg = FilingCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId);
  58. _ui.m_txtTitle.SetVar("name", _filingCfg.name).FlushVars();
  59. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_filingCfg.suitId);
  60. _ui.m_txtSuitName.text = suitCfg.name;
  61. DressUpMenuSuitDataManager.GetTotalProgress(out int haveCount, out int totalCount);
  62. _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", haveCount, totalCount);
  63. _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_filingCfg.type, 0, StudioDataManager.Instance.filingChapterId);
  64. _ui.m_list.numItems = _storyLevelCfgs.Count;
  65. }
  66. private void RenderListItem(int index, GObject obj)
  67. {
  68. UI_ListLevel item = UI_ListLevel.Proxy(obj);
  69. item.m_c1.selectedIndex = index % 2;
  70. item.m_txtName.text = _storyLevelCfgs[index].name;
  71. item.m_imgLock.visible = InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index].id);
  72. item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[index].id);
  73. item.target.data = _storyLevelCfgs[index];
  74. UI_ListLevel.ProxyEnd();
  75. }
  76. private void OnListItemClick(EventContext context)
  77. {
  78. GObject obj = context.data as GObject;
  79. StoryLevelCfg storyLevelCfg = obj.data as StoryLevelCfg;
  80. if (!string.IsNullOrEmpty(storyLevelCfg.storyStartID))
  81. {
  82. StoryController.ShowFilingStoryDialog(storyLevelCfg.storyStartID);
  83. }
  84. else
  85. {
  86. InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStoryLevel);
  87. }
  88. }
  89. private void OnBtnChangeClick()
  90. {
  91. }
  92. private void OnBtnRewardClick()
  93. {
  94. }
  95. private void OnBtnAddClick()
  96. {
  97. }
  98. private void OnBtnSuitClick()
  99. {
  100. }
  101. }
  102. }