const { dropConfig, all_ItemConfig } = require('../../game/gameConfig'); const NetManage = require('../../manages/NetManage'); var Utils = require("Utils") cc.Class({ extends: cc.Component, properties: { title: { default: null, type: cc.Label, }, allRewardNode:{ default: null, type: cc.Node, }, missionPrefab: { default: null, type: cc.Prefab, }, lb_time: { default: null, type: cc.Label, }, getNode:{ default: null, type: cc.Node, }, receiveNode:{ default: null, type: cc.Node, }, boostNode:{ default: null, type: cc.Node, }, stars:{ default:null, type:cc.Node }, fullStarSpriteframe:{ default:null, type:cc.SpriteFrame } }, onClickBtn() { if (this.missionState == 0) { NetManage.commitMission(this.missionId, () => { cc.uiHelper.showTips('Get Reward Success!'); }); this.node.destroy(); } if (this.missionState == 1) { const node = cc.instantiate(this.missionPrefab); node.getComponent('mission_choose').initData(this.wantedData); cc.find('Canvas').addChild(node); } if (this.missionState == 2) { NetManage.boostOfferRewardMission(this.missionId, () => { this.node.destroy(); cc.uiHelper.showTips('Boost Success!'); }); } }, onCancelBtn(){ cc.uiHelper.showTips('Boost cancel!'); NetManage.cancelOfferRewardMission(this.missionId,()=>{ this.boostNode.active = false this.receiveNode.active = false this.getNode.active = true this.lb_time.node.parent.active = false }) }, formatSeconds(value) { let result = parseInt(value); let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600); let m = Math.floor((result / 60) % 60) < 10 ? '0' + Math.floor((result / 60) % 60) : Math.floor((result / 60) % 60); let s = Math.floor(result % 60) < 10 ? '0' + Math.floor(result % 60) : Math.floor(result % 60); let res = ''; res += `${h}:`; res += `${m}:`; res += `${s}`; return res; }, init(data, originData) { if(data.param2){ for(let i=0;i