InputGiftCodeView.cs 1.2 KB

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