Files
fc/dev/project/library/imports/48/481bcb5d-ed81-4238-9dba-2c0bc319172c.js
2026-05-24 10:21:26 +08:00

117 lines
3.1 KiB
JavaScript

"use strict";
cc._RF.push(module, '481bctd7YFCOJ26LAvDGRcs', 'act.poweraim.mod');
// Scripts/mod/acts/poweraim/act.poweraim.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 月签到
*
*
******************************************************************************/
var ActBase = require("act.base");
var DailyChargeMod = require("act.dailyfirstcharge.mod");
var ActPowerAim = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(23400, this.handle23400.bind(this)); //今日充值次数
this.RegisterProtocal(23403, this.handle23403.bind(this)); //今日充值次数
// // // 前端准备完毕
// this.RegisterProtocal(14100, this.GetSignStatus.bind( this ) );
// this.RegisterProtocal(14101, this.GetSignBack.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.reqBaseData();
});
},
// 请求剧情信息
reqBaseData: function reqBaseData(_cb) {
this.SendProtocal(23400, {}, _cb);
},
handle23400: function handle23400(_data) {
var len = gdata(this.data.config, "data_get_info_length");
var datas = [];
var count = 0;
if (_data) {
if (nx.dt.arrNEmpty(_data.power_gift_list)) {
var list = _data.power_gift_list;
for (var i = 0; i < len; i++) {
var gift = list[i];
if (gift) {
if (gift.id == i + 1) {
gift.sortid = 2;
switch (gift.status) {
case 1:
{
gift.sortid = 1;
count++;
}
;
break;
case 2:
{
gift.sortid = 3;
}
;
break;
}
datas.push(gift);
}
} else {
var giftc = {
id: i + 1,
status: 0,
sortid: 2
};
datas.push(giftc);
}
}
// _data.power_gift_list.sort( ( a, b )=>{
// return a.status - b.status;
// } )
} else {
for (var _i = 0; _i < len; _i++) {
var _giftc = {
id: _i + 1,
status: 0,
sortid: 2
};
datas.push(_giftc);
}
}
}
_data.power_gift_list = datas;
this.vset("ActsPowerAimProve", _data);
this.openTip("reward", count > 0);
},
// 请求剧情信息
reqGet: function reqGet(_id) {
var data = {
id: _id
};
this.SendProtocal(23403, data);
},
handle23403: function handle23403(_data) {}
});
// 模块导出
module.exports = ActPowerAim;
cc._RF.pop();