Files
fc/dev/project/library/imports/03/03ed470e-5c79-4077-aa34-868186172ca8.js
T

112 lines
3.1 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '03ed4cOXHlAd6o0hoGGFyyo', 'act.wreckagecol.mod');
// Scripts/mod/acts/wreckagecol/act.wreckagecol.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 殘骸收集
*
*
******************************************************************************/
var ActBase = require("act.base");
var ActTreasure = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
this.task = 0;
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
// // 前端准备完毕
this.RegisterProtocal(29700, this.getWreckageColBase.bind(this));
this.RegisterProtocal(29701, this.wreckageColTaskInfo.bind(this));
this.RegisterProtocal(29702, this.exChangeInfoBack.bind(this));
this.RegisterProtocal(29703, this.taskBack.bind(this));
this.RegisterProtocal(29704, this.exchangeStatus.bind(this));
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
var _this = this;
var cfgs = [this.data.config //殘骸收集
];
this.loadConfigs(cfgs, function (_ret, _data) {
nx.dt.fnInvoke(_cb, true);
_this.reqWreckageColData();
});
},
// 请求探宝活动数据
reqWreckageColData: function reqWreckageColData(_cb) {
this.SendProtocal(29700, {}, _cb);
},
// 请求探宝活动数据
reqWreckageColTaskData: function reqWreckageColTaskData() {
this.SendProtocal(29701, {});
},
getWreckageColBase: function getWreckageColBase(_data) {
var canshow = 0;
var lst = _data.list;
this.taskInfo = lst;
if (lst) {
lst.forEach(function (task) {
if (task) {
if (task.finish == 1) {
canshow++;
task.sortid = 2;
}
if (task.finish == 2) {
task.sortid = 0;
}
if (task.finish == 0) {
task.sortid = 1;
}
}
});
}
this.openTip("reward", canshow != 0);
this.vset("wreckagecol", _data);
},
wreckageColTaskInfo: function wreckageColTaskInfo(_data) {
this.vset("wreckagecolTask", _data);
this.reqWreckageColData();
},
reqFinishTask: function reqFinishTask(_id, _cb) {
var protocal = {};
protocal.id = _id;
this.task = _id;
this.SendProtocal(29703, protocal, _cb);
},
reqExchange: function reqExchange(_id) {
var protocal = {};
protocal.id = _id;
this.SendProtocal(29704, protocal);
},
// 探宝轮次变化
exChangeInfoBack: function exChangeInfoBack(_data) {
this.vset("wreckagecolExchange", _data);
},
// 探宝轮次变化
taskBack: function taskBack(_data) {
if (_data.code == 1) {
var tip = nx.text.getKey("lab_get") + nx.text.getKey("ActCol");
var show = {
tip: tip,
cfg: gdata(this.data.config, "data_quest_list")[this.task]
};
// nx.tbox( tip );
this.vset("wreckagecolInfo", show);
}
},
exchangeStatus: function exchangeStatus(_data) {}
});
// 模块导出
module.exports = ActTreasure;
cc._RF.pop();