110 lines
3.1 KiB
JavaScript
110 lines
3.1 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '90515vB5ChDP6X2CXRyuoWo', 'act.partnertrial.mod');
|
|
// Scripts/mod/acts/partnertrial/act.partnertrial.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动:星界初体验
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var PartnerTrial = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(31004, this.handle31004.bind(this)); //获取活动信息
|
|
this.RegisterProtocal(31003, this.handle31003.bind(this)); //领取限时英雄
|
|
this.RegisterProtocal(31005, this.handle31005.bind(this));
|
|
this.RegisterProtocal(31006, this.handle31006.bind(this));
|
|
},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = ["partner_try_data"];
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqBaseData(_cb);
|
|
});
|
|
},
|
|
// 请求剧情信息
|
|
reqBaseData: function reqBaseData(_cb) {
|
|
this.send31004(_cb);
|
|
},
|
|
// ============================================================
|
|
// 星界初体验(角色试用)
|
|
// ============================================================
|
|
//任務信息
|
|
send31004: function send31004(_cb) {
|
|
this.SendProtocal(31004, {}, _cb);
|
|
},
|
|
handle31004: function handle31004(_data) {
|
|
if (!this.isGoodData(_data)) {
|
|
this.vset("heroTrialData", {});
|
|
return;
|
|
}
|
|
this.vset("heroTrialData", _data);
|
|
|
|
// 提示刷新
|
|
this.freshTips(_data.finish);
|
|
},
|
|
//领取
|
|
send31003: function send31003(id, _cb) {
|
|
this.SendProtocal(31003, {
|
|
id: id
|
|
}, _cb);
|
|
},
|
|
handle31003: function handle31003(_data) {
|
|
nx.bridge.acts.reqActsRewards();
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
},
|
|
//是否彈窗。作爲是否強彈pv的依據
|
|
send31005: function send31005(_cb) {
|
|
this.SendProtocal(31005, {}, _cb);
|
|
},
|
|
handle31005: function handle31005(_data) {
|
|
if (!this.isGoodData(_data)) {
|
|
this.vset("PVPlayFlag", 0);
|
|
return;
|
|
}
|
|
this.vset("PVPlayFlag", _data.flag);
|
|
},
|
|
//首次瀏覽,保存狀態
|
|
send31006: function send31006(_cb) {
|
|
this.SendProtocal(31006, {}, _cb);
|
|
},
|
|
handle31006: function handle31006(_data) {
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
this.vset("PVPlayFlag", 0);
|
|
},
|
|
// ============================================================
|
|
// 活动红点提示
|
|
// ============================================================
|
|
|
|
// // 活动用到的提示KEY
|
|
// tipKeys: function() {
|
|
// return ["star5","star6","star7","star8","star9","star10"];
|
|
// },
|
|
|
|
// 红点提示更新
|
|
freshTips: function freshTips(_finish) {
|
|
this.openTip("reward", _finish == 0);
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = PartnerTrial;
|
|
|
|
cc._RF.pop(); |