Files
fc/dev/project/library/imports/ea/eaa07497-007a-40b0-81ec-500ab6fa511d.js
T
2026-05-24 10:21:26 +08:00

111 lines
2.9 KiB
JavaScript

"use strict";
cc._RF.push(module, 'eaa07SXAHpAsIHsUAq2+lEd', 'act.luxury.mod');
// Scripts/mod/acts/luxury/act.luxury.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 積天好禮
*
*
******************************************************************************/
var ActBase = require("act.base");
var ActLuxury = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(16603, this.handle16603.bind(this)); // 請求子活動相關,來取相關的顯示數據
this.RegisterProtocal(16604, this.handle16604.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
var _this = this;
var cfgs = [this.data.config //付費活動
];
this.loadConfigs(cfgs, function (_ret, _data) {
_this.reqBaseData(_cb);
});
},
// 请求活动信息
reqBaseData: function reqBaseData(_cb) {
this.reqLuxuryData(_cb);
},
// ============================================================
// 積天好禮
// ============================================================
// 请求積天好禮信息
reqLuxuryData: function reqLuxuryData(_cb) {
this.SendProtocal(16603, {
bid: this.data.camp_id
}, _cb);
},
// 请求領取積天好禮獎勵
reqGetLuxAward: function reqGetLuxAward(_aim, _cb) {
this.SendProtocal(16604, {
bid: this.data.camp_id,
aim: _aim,
arg: 0
}, _cb);
},
// 请求相關配置信息
handle16603: function handle16603(_data) {
if (_data.bid == this.data.camp_id) {
this.setActDay(_data.args);
this.vset("luxuryBaseData", _data);
this.freshTips();
return;
}
},
// 请求相關配置信息
handle16604: function handle16604(_data) {},
// ============================================================
// 活动红点提示
// ============================================================
// 活动用到的提示KEY
tipKeys: function tipKeys() {
return ["luxuryClaim"];
},
// 红点提示更新
freshTips: function freshTips() {
var data = this.vget("luxuryBaseData");
var is_reward = false;
for (var i in data.aim_list) {
if (data.aim_list[i].status == 1) {
is_reward = true;
break;
}
}
this.openTip("luxuryClaim", is_reward);
},
setActDay: function setActDay(args) {
for (var i in args) {
if (args[i].args_key == 43) {
this.actDay = args[i].args_val;
break;
}
}
},
getActDay: function getActDay() {
if (this.actDay) {
return this.actDay;
}
return 0;
}
});
// 模块导出
module.exports = ActLuxury;
cc._RF.pop();