82 lines
2.3 KiB
JavaScript
82 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '74f49p/TT5AuLoJRUijvj+D', 'act.treasure.mod');
|
|
// Scripts/mod/acts/treasure/act.treasure.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");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
// // 前端准备完毕
|
|
this.RegisterProtocal(29600, this.getTreasureStatus.bind(this));
|
|
this.RegisterProtocal(29601, this.reqTreasureBack.bind(this));
|
|
this.RegisterProtocal(29602, this.periodChange.bind(this));
|
|
},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqTreasureData(_cb);
|
|
});
|
|
},
|
|
// 请求探宝活动数据
|
|
reqTreasureData: function reqTreasureData(_cb) {
|
|
this.SendProtocal(29600, {}, _cb);
|
|
},
|
|
getTreasureStatus: function getTreasureStatus(_data) {
|
|
nx.bridge.acts.vset("treasureInfo", _data);
|
|
if (_data.num > 0) {
|
|
this.openTip("rewarddd", true);
|
|
} else {
|
|
this.openTip("rewarddd", false);
|
|
}
|
|
},
|
|
reqTreasureBack: function reqTreasureBack(_data) {
|
|
// {"code":1,"msg":"","day":1,"status":1}
|
|
if (_data.code == 1) {
|
|
|
|
// let data = nx.bridge.acts.vget( "sign30" );
|
|
// data.day = _data.day;
|
|
// data.status = _data.status;
|
|
// nx.bridge.acts.vset( "sign30", data );
|
|
}
|
|
// this.reqBaseData();
|
|
},
|
|
|
|
// 活动用到的提示KEY
|
|
tipKeys: function tipKeys() {
|
|
return ["rewarddd"];
|
|
},
|
|
reqGetTreasure: function reqGetTreasure(_act, _cb) {
|
|
var protocal = {};
|
|
protocal.action = _act;
|
|
this.SendProtocal(29601, protocal, _cb);
|
|
},
|
|
// 探宝轮次变化
|
|
periodChange: function periodChange(_data) {
|
|
nx.bridge.acts.vset("treasurePeriodChange", _data);
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = ActTreasure;
|
|
|
|
cc._RF.pop(); |