This commit is contained in:
guoqing.zhu 2022-06-05 11:36:42 +08:00
parent 20d0a96752
commit 325b7d7272
4 changed files with 10307 additions and 1823 deletions

File diff suppressed because it is too large Load Diff

View File

@ -71,23 +71,22 @@ cc.Class({
// daily mission // daily mission
this.lb_huoyue.string = v.current_active_value; this.lb_huoyue.string = v.current_active_value;
this.pr_progress.progress = v.current_active_value / v.max_active_value; this.pr_progress.progress = v.current_active_value / v.max_active_value;
for (var i = 0; i < v.mission_list1.length; i++) { // for (var i = 0; i < v.mission_list1.length; i++) {
var nd_hasget = this.nd_uprewards[i].getChildByName("getReward"); // var nd_hasget = this.nd_uprewards[i].getChildByName("getReward");
var nd_canget = this.nd_uprewards[i].getChildByName("Available"); // var nd_canget = this.nd_uprewards[i].getChildByName("Available");
var icon = this.nd_uprewards[i].getChildByName("icon") // nd_hasget.active = false;
nd_hasget.active = false; // nd_canget.active = false;
nd_canget.active = false; // this.nd_uprewards[i].getChildByName("num").getComponent(cc.Label).string =
this.nd_uprewards[i].getChildByName("num").getComponent(cc.Label).string = // v.mission_list1[i].target;
v.mission_list1[i].target; // var state = v.mission_list1[i].state;
var state = v.mission_list1[i].state; // if (state == 0) {
if (state == 0) { // nd_canget.active = true;
nd_canget.active = true; // } else if (state == 1) {
} else if (state == 1) { // nd_hasget.active = true;
nd_hasget.active = true; // }
} // this.nd_uprewards[i].mission_id = v.mission_list1[i].mission_id;
this.nd_uprewards[i].mission_id = v.mission_list1[i].mission_id; // this.nd_uprewards[i].state = state;
this.nd_uprewards[i].state = state; // }
}
v.mission_list2.sort((a, b) => { v.mission_list2.sort((a, b) => {
var aa = 0; var aa = 0;
@ -148,6 +147,7 @@ cc.Class({
initWantedMission() { initWantedMission() {
NetManage.missionList(3, (data) => { NetManage.missionList(3, (data) => {
console.log("mission----"+JSON.stringify(data))
this.wantedMission = data; this.wantedMission = data;
this.nd_wantedNode.destroyAllChildren(); this.nd_wantedNode.destroyAllChildren();
var list = this.wantedMission.mission_list1; var list = this.wantedMission.mission_list1;

View File

@ -55,12 +55,12 @@ cc.Class({
this.allChooseGun = new Array(); this.allChooseGun = new Array();
this.allChooseHero.length = 10; this.allChooseHero.length = 10;
this.missionData = data;
// this.currentBtn = 0; // this.currentBtn = 0;
// this.allChoose.length = 5; // this.allChoose.length = 5;
// this.allShowNode = new Array(); // this.allShowNode = new Array();
// this.missionData = data;
// this.allNeed = new Array(); // this.allNeed = new Array();
// if (data.param1) { // if (data.param1) {
// this.initNeedIcon(data.param1, 0); // this.initNeedIcon(data.param1, 0);
@ -124,13 +124,21 @@ cc.Class({
// }, // },
onLoad() { onLoad() {
cc.Notifier.on('hasChoose', this, (data) => { cc.Notifier.on('hasChooseHero', this, (data) => {
this.herolistNode.children[this.currentBtn] this.herolistNode.children[this.currentBtn]
.getComponent('mission_oneBox') .getComponent('mission_oneBox')
.init(data); .init(data);
this.allChooseHero[this.currentBtn] = data; this.allChooseHero[this.currentBtn] = data;
}); });
cc.Notifier.on('hasChooseGun', this, (data) => {
console.log(JSON.stringify(data))
this.gunlistNode.children[this.currentBtn]
.getComponent('mission_oneBox')
.init(data);
this.allChooseGun[this.currentBtn] = data;
});
// cc.Notifier.on('ClearOneBox', this, (data) => { // cc.Notifier.on('ClearOneBox', this, (data) => {
// this.allChoose[data] = null; // this.allChoose[data] = null;
// this.setIcon(); // this.setIcon();
@ -148,9 +156,18 @@ cc.Class({
this.mission_detail.active = true; this.mission_detail.active = true;
// set currentdata // set currentdata
console.log()
var type = 0;
if(event.currentTarget.parent.name=="Hero"){
type = 0
}else{
type = 1
}
this.mission_detail this.mission_detail
.getComponent('mission_chooseDetail') .getComponent('mission_chooseDetail')
.init(this.allChooseHero); .init(this.allChooseHero,this.allChooseGun,type);
}, },
check() { check() {
@ -189,14 +206,22 @@ cc.Class({
this.sendData = ''; this.sendData = '';
this.allChooseHero.forEach((element) => { this.allChooseHero.forEach((element) => {
if (element) { if (element) {
if (element.hero_id) { if (element.hero_uniid) {
this.sendData += `${1}:${element.hero_uniid}|`; this.sendData += `${1}:${element.hero_uniid}|`;
} }
if (element.gun_id) { }
});
this.allChooseGun.forEach((element) => {
if (element) {
if (element.gun_uniid) {
this.sendData += `${0}:${element.gun_uniid}|`; this.sendData += `${0}:${element.gun_uniid}|`;
} }
} }
}); });
console.log(`mission send data===${this.sendData}`)
NetManage.sendWantedMission( NetManage.sendWantedMission(
this.missionData.id, this.missionData.id,
this.sendData, this.sendData,

View File

@ -44,17 +44,35 @@ cc.Class({
type: cc.Prefab, type: cc.Prefab,
}, },
// toggle_gun:{
// default: null,
// type: cc.Node,
// },
// toggle_hero:{
// default: null,
// type: cc.Node,
// },
}, },
init(data) { init(datahero,datagun,type) {
// hero
console.log(JSON.stringify(data))
if(type==0){
this.allHasGot = new Array() this.onClickHero();
for(let i=0;i<data.length;i+=1){ }else{
if(data[i]) this.allHasGot.push(data[i].hero_uniid) this.onClickGun();
} }
this.allHasGotHero = new Array()
this.allHasGotGun = new Array()
for(let i=0;i<datahero.length;i+=1){
if(datahero[i]) this.allHasGotHero.push(datahero[i].hero_uniid)
}
for(let i=0;i<datagun.length;i+=1){
if(datagun[i]) this.allHasGotGun.push(datagun[i].gun_uniid)
}
this.set() this.set()
}, },
@ -95,10 +113,13 @@ cc.Class({
}); });
//set cover //set cover
if ( if (
this.allHasGot.includes(element.hero_uniid.toString()) this.allHasGotHero.includes(element.hero_uniid.toString())
) { ) {
node.getComponent('wantedHero').showCover(); node.getComponent('wantedHero').showCover();
} }
this.nd_heroContent.addChild(node); this.nd_heroContent.addChild(node);
}); });
}); });
@ -119,6 +140,12 @@ cc.Class({
this.currentData = element; this.currentData = element;
}); });
if (
this.allHasGotGun.includes(element.gun_uniid.toString())
) {
node.getComponent('wantedHero').showCover();
}
this.nd_gunContent.addChild(node); this.nd_gunContent.addChild(node);
}); });
}); });
@ -126,8 +153,14 @@ cc.Class({
onClickComfirm() { onClickComfirm() {
if (this.currentData != null) { if (this.currentData != null) {
if(this.currentData.hero_uniid){
cc.Notifier.emit('hasChooseHero', this.currentData);
}else{
cc.Notifier.emit('hasChooseGun', this.currentData);
}
// console.log("current send data:"+JSON.stringify(this.currentData)) // console.log("current send data:"+JSON.stringify(this.currentData))
cc.Notifier.emit('hasChoose', this.currentData);
this.close(); this.close();
} }
}, },