DailyWelfareView.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.DailyWelfare;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class DailyWelfareView : BaseWindow
  10. {
  11. private UI_DailyWelfareUI _ui;
  12. private ValueBarController _valueBarController;
  13. private int _month;
  14. private int _day;
  15. public override void Dispose()
  16. {
  17. base.Dispose();
  18. if (_valueBarController != null)
  19. {
  20. _valueBarController.Dispose();
  21. _valueBarController = null;
  22. }
  23. if (_ui != null)
  24. {
  25. _ui.Dispose();
  26. _ui = null;
  27. }
  28. }
  29. protected override void OnInit()
  30. {
  31. base.OnInit();
  32. packageName = UI_DailyWelfareUI.PACKAGE_NAME;
  33. _ui = UI_DailyWelfareUI.Create();
  34. this.viewCom = _ui.target;
  35. isfullScreen = true;
  36. _valueBarController = new ValueBarController(_ui.m_comValueBar);
  37. _ui.m_btnback.onClick.Add(OnBtnBackClick);
  38. _ui.m_list.itemRenderer = ListItemRender;
  39. }
  40. protected override void OnShown()
  41. {
  42. base.OnShown();
  43. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("mrqd_bjbj");
  44. _valueBarController.OnShown();
  45. _month = DateTime.Now.Month;
  46. _day = DateTime.Now.Day;
  47. UpdateList();
  48. UpdateReward();
  49. _ui.m_list.ScrollToView(0);
  50. }
  51. protected override void OnHide()
  52. {
  53. _valueBarController.OnHide();
  54. base.OnHide();
  55. }
  56. private void OnBtnBackClick()
  57. {
  58. ViewManager.GoBackFrom(typeof(DailyWelfareView).FullName);
  59. }
  60. private void UpdateSgignView()
  61. {
  62. _ui.m_txtSignCount.text = DailyWelfareManager.Instance.DailySignDatas.Count.ToString();
  63. _ui.m_proSign.target.max = DailySignCfgArray.Instance.GetCfgsBymonth(_month).Count;
  64. _ui.m_proSign.target.value = DailyWelfareManager.Instance.DailySignDatas.Count;
  65. List<DailySignCfg> signCfgs = DailySignCfgArray.Instance.GetCfgsBymonth(_month);
  66. for (int i = 0; i < signCfgs.Count; i++)
  67. {
  68. GComponent comProBonus = _ui.m_proSign.target.GetChild("comProBonus" + i).asCom;
  69. comProBonus.x = (signCfgs[i].day / (float)_ui.m_proSign.target.max) * _ui.m_proSign.target.width;
  70. UI_ComProBonus item = UI_ComProBonus.Proxy(comProBonus);
  71. item.m_loaIcon.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(signCfgs[i].bonusArr[0][0]));
  72. // item
  73. UI_ComProBonus.ProxyEnd();
  74. }
  75. }
  76. private void UpdateSupplyView()
  77. {
  78. }
  79. private void UpdateList()
  80. {
  81. }
  82. private void UpdateReward()
  83. {
  84. }
  85. private void ListItemRender(int index, GObject obj)
  86. {
  87. }
  88. private void ListBonusItemRender(int index, GObject obj)
  89. {
  90. }
  91. }
  92. }