const { ccclass, property } = cc._decorator; /** * 红包码列表 * @author 薛鸿潇 */ @ccclass export default class RedBagCode extends cc.Component { @property({ type: cc.ScrollView, displayName: '滚动视图' }) private scroll_view: cc.ScrollView = null!; @property({ displayName: 'lbl暂无提现', type: cc.Label }) private lbl_none: cc.Label = null; @property(cc.Prefab) videoPre: cc.Prefab = null; start() { gData.cashNormal.getRecord(); // this.initList(); mk.ad.showNative(4); } /** * 初始化滚动列表 */ private initList() { let list_data = gData.cashNormal.getListDataHavCode(); this.scroll_view.node.emit('srollview-init', list_data) this.initNoneItem(list_data); } /** * 初始化无条目时的提示 */ private initNoneItem(list_data) { const count = list_data.length; if (count) { this.lbl_none.node.active = false; } else { this.lbl_none.node.active = true; } } coolTime = false videoNode = null /** 点击教程 */ 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 } onClickClose() { mk.ad.destroyNativeAd(); } update() { if (gData.cashNormal.update_list) { this.initList(); } } lateUpdate() { gData.cashNormal.update_list = false; } }