InputGiftCodeView.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections;
  2. using UnityEngine;
  3. using UI.RoleInfo;
  4. namespace GFGGame
  5. {
  6. /// <summary>
  7. /// 兑换码输入界面
  8. /// </summary>
  9. public class InputGiftCodeView : BaseWindow
  10. {
  11. private UI_InputGiftCodeUI _ui;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. _ui = null;
  18. }
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_InputGiftCodeUI.PACKAGE_NAME;
  25. _ui = UI_InputGiftCodeUI.Create();
  26. this.viewCom = _ui.target;
  27. this.viewCom.Center();
  28. this.modal = true;
  29. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  30. _ui.m_btnSure.onClick.Add(OnClickBtnSure);
  31. }
  32. protected override void OnShown()
  33. {
  34. base.OnShown();
  35. _ui.m_inputCode.text = "";
  36. }
  37. private async void OnClickBtnSure()
  38. {
  39. string code = _ui.m_inputCode.text;
  40. if (string.IsNullOrEmpty(code))
  41. {
  42. PromptController.Instance.ShowFloatTextPrompt("请输入兑换码");
  43. return;
  44. }
  45. bool result = await SettingSProxy.ReqGiftCodeCheck(code);
  46. if (result)
  47. {
  48. _ui.m_inputCode.text = "";
  49. }
  50. }
  51. }
  52. }