87 lines
2.3 KiB
JavaScript
87 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c84e881ou1OsI3JepJhVRlv', 'act.assembly.mod');
|
|
// Scripts/mod/acts/assembly/act.assembly.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 開服活動 集結令
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var AssemblyMod = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
// // 前端准备完毕
|
|
this.RegisterProtocal(16653, this.GetAssemblyInfo.bind(this));
|
|
this.RegisterProtocal(16654, this.GetAssemblyRewardBack.bind(this));
|
|
},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = ["charge_data" //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
nx.dt.fnInvoke(_cb, true);
|
|
_this.reqAssemblyData();
|
|
});
|
|
},
|
|
// 请求每日首次充值數據
|
|
reqAssemblyData: function reqAssemblyData(_cb) {
|
|
this.SendProtocal(16653, {}, _cb);
|
|
},
|
|
GetAssemblyInfo: function GetAssemblyInfo(_data) {
|
|
var count = 0;
|
|
var show = 0;
|
|
_data.award_list.forEach(function (_award) {
|
|
if (_award.finish == 1) {
|
|
count++;
|
|
}
|
|
if (_award.id == 0 && (_award.finish == 1 || _award.finish == 0)) {
|
|
show++;
|
|
}
|
|
});
|
|
if (count == 0) {
|
|
// this.openTip( "reward", false );
|
|
this.openTip("reward", show > 0);
|
|
}
|
|
_data.award_list.sort(function (a, b) {
|
|
return a.id - b.id;
|
|
});
|
|
this.vset("assembly", _data);
|
|
},
|
|
reqGetAssemblyAward: function reqGetAssemblyAward(_id) {
|
|
this.SendProtocal(16654, {
|
|
id: _id
|
|
});
|
|
},
|
|
GetAssemblyRewardBack: function GetAssemblyRewardBack(_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();
|
|
},
|
|
|
|
GetAssemblyFreeBack: function GetAssemblyFreeBack(_data) {}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = AssemblyMod;
|
|
|
|
cc._RF.pop(); |