From aec0551f00c7a34fb4659f0f0adfc1d2ddf46362 Mon Sep 17 00:00:00 2001 From: "guoqing.zhu" <1521292690@qq.com> Date: Tue, 7 Jun 2022 11:47:49 +0800 Subject: [PATCH] updaet --- assets/LoginScene.fire | 4 +- assets/res/prefabs/NUI/UINewTask.prefab | 150 +++++++++ assets/resources/prefabs/tips/pb_Boost.prefab | 6 +- assets/scripts/UI/task/UITask.js | 309 +++++++++--------- assets/scripts/UI/task/mission_choose.js | 3 +- assets/scripts/UI/task/singleWanted.js | 45 ++- assets/scripts/tips/BoostTips.ts | 2 +- assets/scripts/tips/CancelBoost.ts | 6 +- 8 files changed, 350 insertions(+), 175 deletions(-) diff --git a/assets/LoginScene.fire b/assets/LoginScene.fire index c69a86c0..72821500 100644 --- a/assets/LoginScene.fire +++ b/assets/LoginScene.fire @@ -47,8 +47,8 @@ }, "_scale": { "__type__": "cc.Vec3", - "x": 0.677734375, - "y": 0.677734375, + "x": 0.736328125, + "y": 0.736328125, "z": 1 }, "_quat": { diff --git a/assets/res/prefabs/NUI/UINewTask.prefab b/assets/res/prefabs/NUI/UINewTask.prefab index 36ae1317..a7c02689 100644 --- a/assets/res/prefabs/NUI/UINewTask.prefab +++ b/assets/res/prefabs/NUI/UINewTask.prefab @@ -189,6 +189,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -327,6 +330,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -558,6 +564,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1008,6 +1017,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1047,6 +1059,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1378,6 +1393,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1417,6 +1435,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1536,6 +1557,23 @@ "a": 255 }, "_width": 1, + "_color2": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_width2": 0, + "_isUnderline": false, + "_UnderlineColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_UnderlineWidth": 0, "_id": "" }, { @@ -1637,6 +1675,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1804,6 +1845,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -1843,6 +1887,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -2206,6 +2253,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -2245,6 +2295,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -2364,6 +2417,23 @@ "a": 255 }, "_width": 1, + "_color2": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_width2": 0, + "_isUnderline": false, + "_UnderlineColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_UnderlineWidth": 0, "_id": "" }, { @@ -2465,6 +2535,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -2632,6 +2705,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -2671,6 +2747,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -3034,6 +3113,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -3073,6 +3155,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -3192,6 +3277,23 @@ "a": 255 }, "_width": 1, + "_color2": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_width2": 0, + "_isUnderline": false, + "_UnderlineColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_UnderlineWidth": 0, "_id": "" }, { @@ -3293,6 +3395,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -3460,6 +3565,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -3499,6 +3607,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -4099,6 +4210,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -4341,6 +4455,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -4654,6 +4771,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -4921,6 +5041,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5122,6 +5245,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5223,6 +5349,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5324,6 +5453,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5439,6 +5571,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5620,6 +5755,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -5969,6 +6107,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -6070,6 +6211,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -6442,6 +6586,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { @@ -6543,6 +6690,9 @@ "_isTrimmedMode": true, "_state": 0, "_atlas": null, + "_tilecount": 1, + "_tileoffx": 0, + "_tileoffy": 0, "_id": "" }, { diff --git a/assets/resources/prefabs/tips/pb_Boost.prefab b/assets/resources/prefabs/tips/pb_Boost.prefab index 7dcaf415..681ac766 100644 --- a/assets/resources/prefabs/tips/pb_Boost.prefab +++ b/assets/resources/prefabs/tips/pb_Boost.prefab @@ -896,7 +896,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 56.7, + "width": 31.68, "height": 60 }, "_anchorPoint": { @@ -939,8 +939,8 @@ }, "_enabled": true, "_useOriginalSize": true, - "_string": "x 10", - "_N$string": "x 10", + "_string": "x0", + "_N$string": "x0", "_fontSize": 30, "_lineHeight": 60, "_enableWrapText": true, diff --git a/assets/scripts/UI/task/UITask.js b/assets/scripts/UI/task/UITask.js index 079358df..321bae06 100644 --- a/assets/scripts/UI/task/UITask.js +++ b/assets/scripts/UI/task/UITask.js @@ -1,164 +1,175 @@ -var NetManage = require("NetManage"); -const { task } = require("../../game/gameConfig"); +var NetManage = require('NetManage'); +const { task } = require('../../game/gameConfig'); cc.Class({ - extends: cc.Component, + extends: cc.Component, - properties: { - nd_uprewards: { - default: [], - type: cc.Node, - }, - tableView: { - default: null, - type: cc.Node, - }, - pr_progress: { - default: null, - type: cc.ProgressBar, - }, - lb_huoyue: { - default: null, - type: cc.Label, - }, - tg_btns: { - default: null, - type: cc.ToggleContainer, - }, - nd_dailyTask: { - default: null, - type: cc.Node, - }, - nd_wantedTask: { - default: null, - type: cc.Node, - }, - - pb_singleWanted: { - default: null, - type: cc.Prefab, - }, - nd_wantedNode: { - default: null, - type: cc.Node, - }, + properties: { + nd_uprewards: { + default: [], + type: cc.Node, + }, + tableView: { + default: null, + type: cc.Node, + }, + pr_progress: { + default: null, + type: cc.ProgressBar, + }, + lb_huoyue: { + default: null, + type: cc.Label, + }, + tg_btns: { + default: null, + type: cc.ToggleContainer, + }, + nd_dailyTask: { + default: null, + type: cc.Node, + }, + nd_wantedTask: { + default: null, + type: cc.Node, + }, - nd_content: { - default: null, - type: cc.Node, - }, - }, + pb_singleWanted: { + default: null, + type: cc.Prefab, + }, + nd_wantedNode: { + default: null, + type: cc.Node, + }, - // LIFE-CYCLE CALLBACKS: + nd_content: { + default: null, + type: cc.Node, + }, + }, - onLoad() { - cc.Notifier.on('missionList', this, this.initdata.bind(this)); - // wanted mission + // LIFE-CYCLE CALLBACKS: - cc.Notifier.on("ReFreshMission", this, () => { - this.initWantedMission(); - }); + onLoad() { + var self = this; - cc.Notifier.on("FinishOne", this, () => { - this.initWantedMission(); - }); - }, - onDestroy() { - cc.Notifier.off("missionList", this); - }, - - initdata(v) { + cc.Notifier.on('missionList', this, this.initdata.bind(this)); + cc.Notifier.on( + 'hasSendMission', + this, + this.initWantedMission.bind(this) + ); + // wanted mission - // daily mission - this.lb_huoyue.string = v.current_active_value; - this.pr_progress.progress = v.current_active_value / v.max_active_value; - // for (var i = 0; i < v.mission_list1.length; i++) { - // var nd_hasget = this.nd_uprewards[i].getChildByName("getReward"); - // var nd_canget = this.nd_uprewards[i].getChildByName("Available"); - // nd_hasget.active = false; - // nd_canget.active = false; - // this.nd_uprewards[i].getChildByName("num").getComponent(cc.Label).string = - // v.mission_list1[i].target; - // var state = v.mission_list1[i].state; - // if (state == 0) { - // nd_canget.active = true; - // } else if (state == 1) { - // nd_hasget.active = true; - // } - // this.nd_uprewards[i].mission_id = v.mission_list1[i].mission_id; - // this.nd_uprewards[i].state = state; - // } + cc.Notifier.on( + 'ReFreshMission', + self, + self.initWantedMission.bind(self) + ); - v.mission_list2.sort((a, b) => { - var aa = 0; - if (a.state == 1) { - aa = 2; - } - if (a.state == 2) { - aa = 1; - } - var bb = 0; - if (b.state == 1) { - bb = 2; - } - if (b.state == 2) { - bb = 1; - } - return aa - bb; - }); + cc.Notifier.on('FinishOne', self, self.initWantedMission.bind(self)); + }, + onDestroy() { + cc.Notifier.off('missionList', this); + // cc.Notifier.off( + // 'ReFreshMission', + // this, + // this.initWantedMission.bind(this) + // ); - this.tableView - .getComponent("tableView") - .initTableView(v.mission_list2.length, { - array: v.mission_list2, - target: this, - }); + // cc.Notifier.off('FinishOne', this, this.initWantedMission.bind(this)); + }, - }, + initdata(v) { + // daily mission + this.lb_huoyue.string = v.current_active_value; + this.pr_progress.progress = v.current_active_value / v.max_active_value; + // for (var i = 0; i < v.mission_list1.length; i++) { + // var nd_hasget = this.nd_uprewards[i].getChildByName("getReward"); + // var nd_canget = this.nd_uprewards[i].getChildByName("Available"); + // nd_hasget.active = false; + // nd_canget.active = false; + // this.nd_uprewards[i].getChildByName("num").getComponent(cc.Label).string = + // v.mission_list1[i].target; + // var state = v.mission_list1[i].state; + // if (state == 0) { + // nd_canget.active = true; + // } else if (state == 1) { + // nd_hasget.active = true; + // } + // this.nd_uprewards[i].mission_id = v.mission_list1[i].mission_id; + // this.nd_uprewards[i].state = state; + // } - onclose() { - this.node.destroy(); - }, - onclickhuoyue(v1, v2) { - var cfg = this.nd_uprewards[Number(v2)]; - var state = cfg.state; - if (state == 0) { - NetManage.commitMission(cfg.mission_id, () => { - NetManage.missionList(1); - }); - } else if (state == 2) { - cc.uiHelper.showTips("Not full of activity"); - } - }, + v.mission_list2.sort((a, b) => { + var aa = 0; + if (a.state == 1) { + aa = 2; + } + if (a.state == 2) { + aa = 1; + } + var bb = 0; + if (b.state == 1) { + bb = 2; + } + if (b.state == 2) { + bb = 1; + } + return aa - bb; + }); - onChangeTog(event, customEventData) { - if (customEventData == 0) { - this.nd_dailyTask.active = true; - this.nd_wantedTask.active = false; - NetManage.missionList(1, (data) => { - this.nd_wantedNode.destroyAllChildren(); - this.initdata(data); - }); - } else if (customEventData == 1) { - this.nd_dailyTask.active = false; - this.nd_wantedTask.active = true; - this.initWantedMission(); - } - }, + this.tableView + .getComponent('tableView') + .initTableView(v.mission_list2.length, { + array: v.mission_list2, + target: this, + }); + }, - initWantedMission() { - NetManage.missionList(3, (data) => { - console.log("mission----"+JSON.stringify(data)) - this.wantedMission = data; - this.nd_wantedNode.destroyAllChildren(); - var list = this.wantedMission.mission_list1; - list.forEach((mission) => { - var data = task[mission.mission_id]; - const missionNode = cc.instantiate(this.pb_singleWanted); - const singleMiSc = missionNode.getComponent("singleWanted"); - this.nd_wantedNode.addChild(missionNode); - singleMiSc.title.string = data.name; - singleMiSc.init(data, mission); - }); - }); - }, + onclose() { + this.node.destroy(); + }, + onclickhuoyue(v1, v2) { + var cfg = this.nd_uprewards[Number(v2)]; + var state = cfg.state; + if (state == 0) { + NetManage.commitMission(cfg.mission_id, () => { + NetManage.missionList(1); + }); + } else if (state == 2) { + cc.uiHelper.showTips('Not full of activity'); + } + }, + + onChangeTog(event, customEventData) { + if (customEventData == 0) { + this.nd_dailyTask.active = true; + this.nd_wantedTask.active = false; + NetManage.missionList(1, (data) => { + this.nd_wantedNode.destroyAllChildren(); + this.initdata(data); + }); + } else if (customEventData == 1) { + this.nd_dailyTask.active = false; + this.nd_wantedTask.active = true; + this.initWantedMission(); + } + }, + + initWantedMission() { + NetManage.missionList(3, (data) => { + this.wantedMission = data; + this.nd_wantedNode.destroyAllChildren(); + var list = this.wantedMission.mission_list1; + list.forEach((mission) => { + var data = task[mission.mission_id]; + const missionNode = cc.instantiate(this.pb_singleWanted); + const singleMiSc = missionNode.getComponent('singleWanted'); + this.nd_wantedNode.addChild(missionNode); + singleMiSc.title.string = data.name; + singleMiSc.init(data, mission); + }); + }); + }, }); diff --git a/assets/scripts/UI/task/mission_choose.js b/assets/scripts/UI/task/mission_choose.js index 298d88fa..78dfa804 100644 --- a/assets/scripts/UI/task/mission_choose.js +++ b/assets/scripts/UI/task/mission_choose.js @@ -191,7 +191,6 @@ cc.Class({ onClickAdd(event, param) { this.currentBtn = param; - console.log(this.currentBtn); this.mission_detail.active = true; // set currentdata @@ -272,8 +271,8 @@ cc.Class({ this.sendData, (res) => { if (res.errcode == 0) { + cc.Notifier.emit('hasSendMission'); this.node.destroy(); - cc.Notifier.emit('ReFreshMission'); } else { cc.uiHelper.showTips('Failed'); } diff --git a/assets/scripts/UI/task/singleWanted.js b/assets/scripts/UI/task/singleWanted.js index f53c2774..d17637c5 100644 --- a/assets/scripts/UI/task/singleWanted.js +++ b/assets/scripts/UI/task/singleWanted.js @@ -69,12 +69,14 @@ cc.Class({ onClickBtn() { if (this.missionState == 0) { + // recive NetManage.commitMission(this.missionId, () => { cc.uiHelper.showTips('Get Reward Success!'); }); this.node.destroy(); } if (this.missionState == 1) { + // no send const node = cc.instantiate(this.missionPrefab); node.getComponent('mission_choose').initData( this.wantedData, @@ -83,33 +85,42 @@ cc.Class({ cc.find('Canvas').addChild(node); } if (this.missionState == 2) { + // has send var data = { - cegNum: 10, - missionId: this.missionId, + cegNum: this.boostCost, + mid: this.missionId, }; uimanger.showUI(BoostTips.prefabPath, data); } }, onCancelBtn() { - uimanger.showUI(CancelBoost.prefabPath); + var data = { + mid: this.missionId, + }; + uimanger.showUI(CancelBoost.prefabPath, data); }, - hasCancelBoost() { - NetManage.cancelOfferRewardMission(this.missionId, () => { - this.boostNode.active = false; - this.receiveNode.active = false; - this.getNode.active = true; - this.lb_time.node.parent.active = false; - cc.uiHelper.showTips('Boost cancel!'); - }); + hasCancelBoost(missionID) { + if (this.missionId == missionID) { + NetManage.cancelOfferRewardMission(missionID, () => { + this.boostNode.active = false; + this.receiveNode.active = false; + this.getNode.active = true; + this.lb_time.node.parent.active = false; + cc.uiHelper.showTips('Boost cancel!'); + cc.Notifier.emit('ReFreshMission'); + }); + } }, - boostsuccess() { - NetManage.boostOfferRewardMission(this.missionId, () => { - // this.node.destroy(); - cc.uiHelper.showTips('Boost Success!'); - }); + boostsuccess(missionID) { + if (this.missionId == missionID) { + NetManage.boostOfferRewardMission(missionID, () => { + cc.uiHelper.showTips('Boost Success!'); + cc.Notifier.emit('ReFreshMission'); + }); + } }, formatSeconds(value) { @@ -142,6 +153,8 @@ cc.Class({ } } + this.boostCost = data.boost; + this.wantedData = data; this.missionId = originData.mission_id; if (originData.state == 0) { diff --git a/assets/scripts/tips/BoostTips.ts b/assets/scripts/tips/BoostTips.ts index 0dbabf39..827ccf85 100644 --- a/assets/scripts/tips/BoostTips.ts +++ b/assets/scripts/tips/BoostTips.ts @@ -26,7 +26,7 @@ export class BoostTips extends UIBase { onOK() { this.node.destroy(); - cc.Notifier.emit('boostsuccess'); + cc.Notifier.emit('boostsuccess', this.indata.mid); // NetManage.boostOfferRewardMission(this.indata.missionId, () => { // this.node.destroy(); // cc.uiHelper.showTips('Boost Success!'); diff --git a/assets/scripts/tips/CancelBoost.ts b/assets/scripts/tips/CancelBoost.ts index 9daad8b2..4f1aff1a 100644 --- a/assets/scripts/tips/CancelBoost.ts +++ b/assets/scripts/tips/CancelBoost.ts @@ -9,7 +9,9 @@ export class CancelBoost extends UIBase { private indata: any; - init(data: any) {} + init(data: any) { + this.indata = data; + } onClose() { this.node.destroy(); @@ -17,6 +19,6 @@ export class CancelBoost extends UIBase { onOK() { this.node.destroy(); - cc.Notifier.emit('boostcancel'); + cc.Notifier.emit('boostcancel', this.indata.mid); } }