import { Data } from "../../../mk/data/Data"; import JsbSystem from "../../../mk/system/JsbSystem"; const { ccclass, property } = cc._decorator; @ccclass export default class NewCashUI extends cc.Component { @property({ displayName: '兑换码', type: cc.Label }) private lbl_redeem_code: cc.Label = null; @property(cc.Prefab) private videoPre: cc.Prefab = null; private coolTime = false; private videoNode = null onLoad(){ } start(){ this.coolTime = false; this.lbl_redeem_code.string = ""; } private clickVideoBtn(){ mk.audio.playEffect('button'); if(this.coolTime) return; this.coolTime = true; this.videoNode = cc.instantiate(this.videoPre) this.videoNode.getChildByName('video').on("completed", this.onCompleted, this) this.node.addChild(this.videoNode) } private onCompleted(){ this.videoNode.getChildByName('video').off("completed", this.onCompleted, this) this.videoNode.destroy() mk.audio.setResumeMusic(); this.coolTime = false } private clickCopyBtn() { mk.audio.playEffect('button'); JsbSystem.setClipboard(this.lbl_redeem_code.string) mk.tip.pop("复制成功"); } private clickCloseBtn(){ mk.audio.playEffect('button'); mk.audio.setResumeMusic(); // gData.gameData.init_redBagTask = true; // gData.gameData.init_productTask = true; } onDestroy(){ } }