ClothingFosterFinishView.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections;
  3. using FairyGUI;
  4. using UI.ClothingFoster;
  5. using UI.CommonGame;
  6. namespace GFGGame
  7. {
  8. public class ClothingFosterFinishView : BaseWindow
  9. {
  10. private UI_ClothingFosterFinishUI _ui;
  11. private int _suitId;
  12. private int _index;
  13. private SortedList _lastPropertyList;
  14. private SortedList _curPropertyList;
  15. public override void Dispose()
  16. {
  17. if (_ui != null)
  18. {
  19. _ui.Dispose();
  20. _ui = null;
  21. }
  22. base.Dispose();
  23. }
  24. protected override void OnInit()
  25. {
  26. base.OnInit();
  27. packageName = UI_ClothingFosterFinishUI.PACKAGE_NAME;
  28. _ui = UI_ClothingFosterFinishUI.Create();
  29. this.viewCom = _ui.target;
  30. this.viewCom.Center();
  31. this.modal = true;
  32. // viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  33. _ui.m_loaBg.onClick.Add(this.Hide);
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _suitId = (int)(this.viewData as object[])[0];
  39. _index = (int)(this.viewData as object[])[1];
  40. _ui.m_grpRenew.visible = false;
  41. _ui.m_loaBg.touchable = false;
  42. _ui.m_img.fillAmount = 0;
  43. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gxhd_bjbj");
  44. _lastPropertyList = (this.viewData as object[])[2] as SortedList;
  45. _curPropertyList = SuitFosterDataManager.Instance.GetPropertyData(_suitId, _index);
  46. SuitFosterData data = SuitFosterDataManager.Instance.GetSuitFosterData(_suitId);
  47. SuitFosterListCfg cfg = SuitFosterListCfgArray.Instance.GetCfg(_suitId);
  48. int count = ConstDressUpScoreType.scoreTypeList().Count;
  49. for (int i = 0; i < count; i++)
  50. {
  51. int score = i + 1;
  52. UI_ListScoreItem comPrpperty = UI_ListScoreItem.Proxy(_ui.target.GetChild("comProperty" + i));
  53. int property = (int)_lastPropertyList[score];
  54. comPrpperty.m_txtProperty.text = StringUtil.GetColorText(property.ToString(), "#5B4A3B");
  55. comPrpperty.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (score));
  56. UI_ListScoreItem.ProxyEnd();
  57. UI_ListScoreItem comAddPrpperty = UI_ListScoreItem.Proxy(_ui.target.GetChild("comAddProperty" + i));
  58. int addProperty = (int)_curPropertyList[score];
  59. comAddPrpperty.m_txtProperty.text = StringUtil.GetColorText(addProperty.ToString(), addProperty == property ? "#5B4A3B" : "#FFDE9E");
  60. comAddPrpperty.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (score));
  61. UI_ListScoreItem.ProxyEnd();
  62. }
  63. _ui.m_grpProperty.visible = true;
  64. _ui.m_t0.Play(() =>
  65. {
  66. int num = 0;
  67. Timers.inst.Add(0.01f, 100, (param) =>
  68. {
  69. num++;
  70. _ui.m_img.fillAmount += 0.1f;
  71. if (num == 10)
  72. {
  73. _ui.m_grpAddProperty.visible = true;
  74. _ui.m_t1.Play(() =>
  75. {
  76. _ui.m_grpRenew.visible = data.maintainStep >= cfg.renewOpenLv;
  77. _ui.m_loaBg.touchable = true;
  78. });
  79. }
  80. });
  81. });
  82. }
  83. protected override void OnHide()
  84. {
  85. base.OnHide();
  86. _ui.m_img.fillAmount = 0;
  87. _ui.m_grpRenew.visible = false;
  88. _ui.m_grpProperty.visible = false;
  89. _ui.m_grpAddProperty.visible = false;
  90. }
  91. }
  92. }