InputGiftCodeView.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. private async void OnClickBtnSure()
  33. {
  34. string code = _ui.m_inputCode.text;
  35. if (string.IsNullOrEmpty(code))
  36. {
  37. PromptController.Instance.ShowFloatTextPrompt("请输入兑换码");
  38. return;
  39. }
  40. bool result = await SettingSProxy.ReqGiftCodeCheck(code);
  41. if (result)
  42. {
  43. _ui.m_inputCode.text = "";
  44. }
  45. }
  46. }
  47. }