| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /**
- * @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();
- }
- }
|