// Learn cc.Class: // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html // Learn Attribute: // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html var SDKManage = require("SDKManage") cc.Class({ extends: cc.Component, properties: { sp_icon: { default: null, type: cc.Sprite, }, shakeAni:{ default: null, type: cc.Animation, }, lb_name:{ default: null, type: cc.Label, }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, setdata (dt) { this.appid = dt.k this.repotrname = dt.v.name + dt.tp + "-"+ dt.v.picidx this.sp_icon.node.getComponent("sprite9").setdata(dt.v.url) if(this.lb_name){ this.lb_name.string = dt.v.name } }, shake(){ //this.shakeAni.play("shake") }, onClick(){ if(!this.appid){ return } var cb = function(){ if (cc.moregame == false) { cc.Notifier.emit("callcpalist") } } SDKManage.navigateToMiniProgram(this.appid,this.repotrname, null, cb) //console.log("1111111111111111") }, setautomode(time){ var playerData = require("playerData") var temp = {} for(var i=0;i { var aa = a.weight var bb = b.weight if(temp[a.k]){ a.hasjump=true aa+=9999 } if(temp[b.k]){ b.hasjump=true bb+=9999 } return aa - bb; }) this.changetime = time this.time = 0 this.cpadata = data this.cindex = 0 this.changecpa() }, changecpa(){ if(this.cpadata.length==0){ this.node.opacity=0 return } this.shake() this.setdata(this.cpadata[this.cindex]) this.cindex++ this.cindex%=this.cpadata.length }, update (dt) { if(this.changetime){ this.time+=dt if(this.time>this.changetime){ this.time = 0 this.changecpa() } } }, });