/* * @Author: mojunshou 1637302775@qq.com * @Date: 2025-03-21 15:03:37 * @LastEditors: mojunshou 1637302775@qq.com * @LastEditTime: 2025-04-23 17:45:40 * @Description: 微信提现到零钱,需要有一个动画展示步骤 */ import { _decorator, Node, Animation } from 'cc'; import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil'; import { GameComponent } from "db://oops-framework/module/common/GameComponent"; import { ServerHandler } from '../common/manager/ServerHandler'; import { oops } from 'db://oops-framework/core/Oops'; import { UIID } from '../common/config/GameUIConfig'; import { Label } from 'cc'; import { ProgressBar } from 'cc'; import { tween } from 'cc'; import { smc } from '../common/SingletonModuleComp'; import { Format } from '../utils/Format'; import { DCHandler } from '../common/manager/DCHandler'; const { ccclass, property } = _decorator; /** 显示对象控制 */ @ccclass('CashWithdrawalView') export class CashWithdrawalView extends GameComponent { @property(Label) lab_cashNum: Label = null!; @property(Label) lab_tips: Label = null!; @property(Node) private loadNode: Node = null!; @property(Node) private mainNode: Node = null! @property(ProgressBar) private loadProgressBar: ProgressBar = null!; protected start() { this.setButton(); this.setData(); } setData() { this.mainNode.active = false; this.loadNode.active = false; const num = smc.game.GameModel.txNum; if (num > 0) { if (this.lab_cashNum) { this.lab_cashNum.string = `¥${Format.formatRedPacketCoin(num)}`; //正则替换$m为num this.lab_tips.string = this.lab_tips.string.replace(/\$m/g, `${Format.formatRedPacketCoin(num)}`); } } let eventType = smc.game.GameModel.eventType; //用来判断要不要显示加载进度条 if (eventType) { if (eventType == "WITHDRAW_POINT" && smc.game.GameModel.txType == 1) { this.showLoad(); } else { this.loadNode.active = false; this.mainNode.active = true; this.showAnimation(); } } else { this.loadNode.active = false; this.mainNode.active = true; this.showAnimation(); } } showLoad() { if (this.loadNode && this.loadProgressBar) { this.loadProgressBar.progress = 0; this.loadNode.active = true; const progressObj = { value: 0 }; tween(progressObj) .to(2, { value: 1 }, { onUpdate: (target) => { this.loadProgressBar.progress = target.value; }, easing: 'linear' // 匀速,也可以换成 'quadIn', 'cubicOut' 等 }) .call(() => { this.loadNode.active = false; if (this.mainNode) { this.mainNode.active = true; this.showAnimation(); } }) .start(); } } showAnimation() { if (this.mainNode) { const aniNode = this.mainNode.getChildByPath("Bg/Mask"); if (aniNode) { const animationComponent = aniNode.getComponent(Animation); if (animationComponent) { animationComponent.play(); } } } } async btn_continue() { //打开提现返利界面--判断从哪打开如果从红包币那打开就只是关闭 if (DeviceUtil.isNative && DeviceUtil.isAndroid) { const type = smc.game.GameModel.txType; if (type == 1) { ServerHandler.inst.getTxbfInfo(); } oops.gui.remove(UIID.WithSussce); DCHandler.inst.reportData(3000701); } else { await oops.gui.open(UIID.CashRebate); oops.gui.remove(UIID.WithSussce); } } protected onDestroy(): void { this.mainNode.active = false; this.loadNode.active = false; } }