SuitFosterFinishView.cs 3.5 KB

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