This commit is contained in:
guoqing.zhu 2022-06-07 11:47:49 +08:00
parent 2610429236
commit aec0551f00
8 changed files with 350 additions and 175 deletions

View File

@ -47,8 +47,8 @@
},
"_scale": {
"__type__": "cc.Vec3",
"x": 0.677734375,
"y": 0.677734375,
"x": 0.736328125,
"y": 0.736328125,
"z": 1
},
"_quat": {

View File

@ -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": ""
},
{

View File

@ -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,

View File

@ -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);
});
});
},
});

View File

@ -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');
}

View File

@ -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) {

View File

@ -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!');

View File

@ -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);
}
}