CashWithdrawalView.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-21 15:03:37
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-15 10:40:20
  6. * @Description: 微信提现到零钱,需要有一个动画展示步骤
  7. */
  8. import { _decorator, Node, Animation } from 'cc';
  9. import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
  10. import { GameComponent } from "db://oops-framework/module/common/GameComponent";
  11. import { ServerHandler } from '../common/manager/ServerHandler';
  12. import { oops } from 'db://oops-framework/core/Oops';
  13. import { UIID } from '../common/config/GameUIConfig';
  14. import { Label } from 'cc';
  15. import { ProgressBar } from 'cc';
  16. import { tween } from 'cc';
  17. import { smc } from '../common/SingletonModuleComp';
  18. const { ccclass, property } = _decorator;
  19. /** 显示对象控制 */
  20. @ccclass('CashWithdrawalView')
  21. export class CashWithdrawalView extends GameComponent {
  22. @property(Label)
  23. lab_cashNum: Label = null!;
  24. @property(Label)
  25. lab_tips: Label = null!;
  26. @property(Node)
  27. private loadNode: Node = null!;
  28. @property(Node)
  29. private mainNode: Node = null!
  30. @property(ProgressBar)
  31. private loadProgressBar: ProgressBar = null!;
  32. protected start() {
  33. this.setButton();
  34. this.setData();
  35. }
  36. setData() {
  37. const num = smc.game.GameModel.txNum;
  38. if (num > 0) {
  39. if (this.lab_cashNum) {
  40. this.lab_cashNum.string = `¥${num}`;
  41. //正则替换$m为num
  42. this.lab_tips.string = this.lab_tips.string.replace(/\$m/g, `${num}`);
  43. }
  44. }
  45. let eventType = smc.game.GameModel.eventType;
  46. if (eventType) {
  47. if (eventType == "WITHDRAW_POINT" && smc.game.GameModel.txType == 1) {
  48. this.showLoad();
  49. } else {
  50. this.loadNode.active = false;
  51. this.mainNode.active = true;
  52. this.showAnimation();
  53. }
  54. }
  55. }
  56. showLoad() {
  57. if (this.loadNode && this.loadProgressBar) {
  58. this.loadProgressBar.progress = 0;
  59. this.loadNode.active = true;
  60. tween(this.loadProgressBar)
  61. .to(0.5, { progress: 1 })
  62. .call(() => {
  63. this.loadNode.active = false;
  64. if (this.mainNode) {
  65. this.mainNode.active = true;
  66. this.showAnimation();
  67. }
  68. })
  69. }
  70. }
  71. showAnimation() {
  72. if (this.mainNode) {
  73. const animationComponent = this.mainNode.addComponent(Animation);
  74. animationComponent.play();
  75. }
  76. }
  77. btn_continue() {
  78. //打开提现返利界面--判断从哪打开如果从红包币那打开就只是关闭
  79. if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
  80. const type = smc.game.GameModel.txType;
  81. if (type == 1) {
  82. ServerHandler.inst.getTxbfInfo();
  83. }
  84. oops.gui.remove(UIID.WithSussce);
  85. } else {
  86. //
  87. oops.gui.open(UIID.CashRebate);
  88. }
  89. }
  90. protected onDestroy(): void {
  91. this.mainNode.active = false;
  92. this.loadNode.active = true;
  93. }
  94. }