NewRoleGetSuitView.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using FairyGUI;
  2. using UI.CreateRole;
  3. using System;
  4. using System.Text.RegularExpressions;
  5. using ET;
  6. using System.Collections.Generic;
  7. using UnityEngine;
  8. namespace GFGGame
  9. {
  10. public class NewRoleGetSuitView : BaseWindow
  11. {
  12. private UI_NewRoleGetSuitUI _ui;
  13. private int suitID;
  14. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. _ui = null;
  20. }
  21. base.Dispose();
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. packageName = UI_NewRoleGetSuitUI.PACKAGE_NAME;
  27. _ui = UI_NewRoleGetSuitUI.Create();
  28. this.viewCom = _ui.target;
  29. this.viewCom.Center();
  30. this.isfullScreen = true;
  31. isReturnView = true;
  32. _ui.m_suit1.onClick.Add(OnClickSuitOne);
  33. _ui.m_suit2.onClick.Add(OnClickSuitTwo);
  34. _ui.m_suit3.onClick.Add(OnClickSuitThree);
  35. _ui.m_btnDress.onClick.Add(OnClickTryDress);
  36. }
  37. protected override void AddEventListener()
  38. {
  39. base.AddEventListener();
  40. EventAgent.AddEventListener(ConstMessage.NEWROLEGETSUIT, OnHide);
  41. }
  42. protected override void RemoveEventListener()
  43. {
  44. base.RemoveEventListener();
  45. EventAgent.RemoveEventListener(ConstMessage.NEWROLEGETSUIT, OnHide);
  46. }
  47. protected override void OnShown()
  48. {
  49. base.OnShown();
  50. _ui.m_bg.url = ResPathUtil.GetBgImgPath("sxy_bj");
  51. }
  52. private void OnClickTryDress()
  53. {
  54. ViewManager.Show<TryDressUpView>();
  55. }
  56. private void OnClickSuitOne()
  57. {
  58. suitID = 201020;
  59. OnClickTip();
  60. }
  61. private void OnClickSuitTwo()
  62. {
  63. suitID = 201010;
  64. OnClickTip();
  65. }
  66. private void OnClickSuitThree()
  67. {
  68. suitID = 201030;
  69. OnClickTip();
  70. }
  71. private void OnClickTip()
  72. {
  73. string exitTip = "是否确定选择该套装,确认选择后不可更改";
  74. AlertUI.Show(exitTip)
  75. .SetLeftButton(true, "取消", (object data) =>
  76. {
  77. })
  78. .SetRightButton(true, "确定", async (object data) =>
  79. {
  80. var result = await RoleInfoSProxy.ReqNewRoleGetSuit(suitID);
  81. this.Hide();
  82. });
  83. }
  84. protected override void OnHide()
  85. {
  86. base.OnHide();
  87. }
  88. }
  89. }