StudioFilingView.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tc_bjbj");
  37. }
  38. protected override void AddEventListener()
  39. {
  40. base.AddEventListener();
  41. }
  42. protected override void OnShown()
  43. {
  44. base.OnShown();
  45. UpdateView();
  46. }
  47. protected override void OnHide()
  48. {
  49. base.OnHide();
  50. ViewManager.GoBackFrom(typeof(StudioFilingView).FullName);
  51. }
  52. protected override void RemoveEventListener()
  53. {
  54. base.RemoveEventListener();
  55. }
  56. private void UpdateView()
  57. {
  58. _filingCfg = FilingCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId);
  59. _ui.m_txtTitle.SetVar("name", _filingCfg.name).FlushVars();
  60. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_filingCfg.suitId);
  61. _ui.m_txtSuitName.text = suitCfg.name;
  62. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(_filingCfg.suitId, out int count, out int totalCount);
  63. _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", count, totalCount);
  64. _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_filingCfg.type, 0, StudioDataManager.Instance.filingChapterId);
  65. _ui.m_list.numItems = _storyLevelCfgs.Count;
  66. }
  67. private void RenderListItem(int index, GObject obj)
  68. {
  69. int _index = _storyLevelCfgs.Count - index - 1;
  70. UI_ListLevel item = UI_ListLevel.Proxy(obj);
  71. item.m_c1.selectedIndex = _index % 2;
  72. item.m_txtName.text = _storyLevelCfgs[_index].name;
  73. item.m_imgLock.visible = InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[_index].id);
  74. item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[_index].id);
  75. item.target.data = _storyLevelCfgs[_index];
  76. UI_ListLevel.ProxyEnd();
  77. }
  78. private void OnListItemClick(EventContext context)
  79. {
  80. GObject obj = context.data as GObject;
  81. StoryLevelCfg storyLevelCfg = obj.data as StoryLevelCfg;
  82. if (!string.IsNullOrEmpty(storyLevelCfg.storyStartID))
  83. {
  84. StoryController.ShowFilingStoryDialog(storyLevelCfg.storyStartID);
  85. }
  86. else
  87. {
  88. InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStoryLevel);
  89. }
  90. }
  91. private void OnBtnChangeClick()
  92. {
  93. }
  94. private void OnBtnRewardClick()
  95. {
  96. }
  97. private void OnBtnAddClick()
  98. {
  99. }
  100. private void OnBtnSuitClick()
  101. {
  102. }
  103. }
  104. }