/** * @description 互推弹出红包界面 * @author kaka */ import JsbSystem from "../../../mk/system/JsbSystem"; import { RewardType } 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() { this.data = gData.moreGame.getRandomNormal(); if (this.data) { //pc不加载,加载会报错 if (cc.sys.os != cc.sys.OS_WINDOWS) { 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 (this.cool) { return } this.cool = true if (cc.sys.isNative && !JsbSystem.ifCanStartGame(this.data.packageName, true)) { gData.moreGame.createNewTask(this.data) } gData.moreGame.popNodeGetRedBag(); } }