/** * @description 互推弹出红包界面 * @author kaka */ import JsbSystem from "../../../mk/system/JsbSystem"; import { DataEventId } from "../../data/GameData"; const { ccclass, property } = cc._decorator; @ccclass export default class MoreGamePopNode extends cc.Component { @property(cc.Sprite) icon: cc.Sprite = null; @property(cc.Label) labName: cc.Label = null; data = null start() { gData.moreGame.init_moreGameList = true; } update() { if (gData.moreGame.init_moreGameList) { this.init(); } } lateUpdate() { gData.moreGame.init_moreGameList = false; } init() { if (!CC_JSB) { return; } this.data = gData.moreGame.getRandomNormal(); if (this.data) { cc.loader.load(this.data.icon, (err, res) => { if (err) { console.log('err:', err); return; } let tex: cc.Texture2D = res as cc.Texture2D; this.icon.spriteFrame = new cc.SpriteFrame(tex); }) this.labName.string = this.data.title } } cool = false creatorDownLoadTask() { mk.audio.playEffect('button'); if (!CC_JSB) { return; } if (this.cool) { return } this.cool = true mk.data.sendDataEvent(DataEventId.hutuiFunction, "互推插屏下载"); if (this.data.appType == 1) { if (!JsbSystem.ifCanStartGame(this.data.packageName, true)) { gData.moreGame.createNewTask(this.data, 1) } } else if (this.data.appType == 2) { cc.sys.openURL(this.data.recommendLink); } gData.moreGame.popNodeGetRedBag(); } }