import JsbSystem from "../../../mk/system/JsbSystem"; /** * @description 公众号提现 * @author kaka */ const { ccclass, property } = cc._decorator; @ccclass export default class RedCode extends cc.Component { @property(cc.Label) labOfficial: cc.Label = null; @property(cc.Label) labRed: cc.Label = null; @property(cc.Label) labMoney: cc.Label = null; @property(cc.Label) labRedCode: cc.Label = null; @property(cc.Node) parNode: cc.Node = null; @property(cc.Prefab) videoPre: cc.Prefab = null; videoNode = null officialStr = "白羊游戏社" redCodeStr = "领红包" code = "" coolTime = false start() { mk.ad.showNative(4); this.coolTime = false this.labOfficial.string = `“${this.officialStr}”` this.labRed.string = `“${this.redCodeStr}”` } update() { if (gData.redCodeData.init_data) { this.init(gData.redCodeData.money, gData.redCodeData.code); } } lateUpdate() { gData.redCodeData.init_data = false; } init(money, code) { this.labMoney.string = `${money.toFixed(2)}元` this.code = code this.labRedCode.string = `提现红包码:${this.code}` } /** 点击复制公众号 */ clickCopyOfficial() { mk.audio.playEffect('button'); JsbSystem.setClipboard(this.officialStr) } /** 点击教程 */ clickTeach() { mk.audio.playEffect('button'); if (this.coolTime) { return } this.coolTime = true gData.redCodeData.teachVideoType = 1; console.log('clickTeach') this.videoNode = cc.instantiate(this.videoPre) this.videoNode.getChildByName('video').on("completed", this.onCompleted, this) this.node.addChild(this.videoNode) } onCompleted() { this.videoNode.getChildByName('video').off("completed", this.onCompleted, this) this.videoNode.destroy() mk.audio.setResumeMusic(); this.coolTime = false } /** 点击复制红包码 */ clickCopyRedCode() { mk.audio.playEffect("button"); JsbSystem.setClipboard(this.code) } /** 点击关闭 */ closeCallBack() { mk.audio.playEffect("button"); mk.audio.setResumeMusic(); } onClickClose() { } onDisable(){ mk.ad.destroyNativeAd(); } }