/* * @Author: mojunshou 1637302775@qq.com * @Date: 2025-03-21 15:03:37 * @LastEditors: mojunshou 1637302775@qq.com * @LastEditTime: 2025-04-15 10:40:20 * @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'; 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() { const num = smc.game.GameModel.txNum; if (num > 0) { if (this.lab_cashNum) { this.lab_cashNum.string = `¥${num}`; //正则替换$m为num this.lab_tips.string = this.lab_tips.string.replace(/\$m/g, `${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(); } } } showLoad() { if (this.loadNode && this.loadProgressBar) { this.loadProgressBar.progress = 0; this.loadNode.active = true; tween(this.loadProgressBar) .to(0.5, { progress: 1 }) .call(() => { this.loadNode.active = false; if (this.mainNode) { this.mainNode.active = true; this.showAnimation(); } }) } } showAnimation() { if (this.mainNode) { const animationComponent = this.mainNode.addComponent(Animation); animationComponent.play(); } } btn_continue() { //打开提现返利界面--判断从哪打开如果从红包币那打开就只是关闭 if (DeviceUtil.isNative && DeviceUtil.isAndroid) { const type = smc.game.GameModel.txType; if (type == 1) { ServerHandler.inst.getTxbfInfo(); } oops.gui.remove(UIID.WithSussce); } else { // oops.gui.open(UIID.CashRebate); } } protected onDestroy(): void { this.mainNode.active = false; this.loadNode.active = true; } }