let viewCell = require("viewCell") var gameConfig = require("gameConfig") var NetManage = require("NetManage") var Utils = require("Utils") cc.Class({ extends: viewCell, properties: { sp_icon: { default: null, type: cc.Sprite, }, sp_pz: { default: null, type: cc.Sprite, }, lb_des: { default: null, type: cc.Label, }, lb_huoyue: { default: null, type: cc.Label, }, lb_count: { default: null, type: cc.Label, }, lb_jd: { default: null, type: cc.Label, }, nd_doing: { default: null, type: cc.Node, }, nd_finish: { default: null, type: cc.Node, }, nd_lingqu: { default: null, type: cc.Node, }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, init: function(index, data, reload, group) { if (index >= data.array.length) { //越界 this.node.active = false return; } this.target = data.target var sdata = data.array[index] this.initdata(sdata) }, //任务状态 0:可领取 1:已领取 2:未完成(不可领取) initdata(v) { var state = v.state this.mid = v.mission_id this.lb_jd.string = v.current + "/" + v.target var cfg = gameConfig.task[this.mid] this.lb_des.string = cfg.des this.nd_lingqu.active = this.nd_finish.active = this.nd_doing.active = false if (state == 0) { this.nd_lingqu.active = true this.lb_jd.string = " " } else if (state == 1) { this.nd_finish.active = true this.lb_jd.string = " " } else if (state == 2) { this.nd_doing.active = true } var items = cc.playerData.getDrop(cfg.reward) this.lb_huoyue.string = items[0].num this.lb_count.string = items[1].num Utils.setitem(this, items[1].id, this.sp_icon, this.sp_pz) this.jump = cfg.jump_value }, onclickgo() { if (this.jump == 2) { cc.uiMain.callbattlechosehero({ teamuuid: null, }) } else if (this.jump == 3) { cc.uiMain.callteammatch() } }, onclickget() { NetManage.commitMission(this.mid, () => { NetManage.missionList(1) }) }, // update (dt) {}, });