105 lines
3.0 KiB
JavaScript
105 lines
3.0 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c60c9+Bz0JDhKZ86GfqUlvM', 'act.appoint8.mod');
|
|
// Scripts/mod/acts/appoint8/act.appoint8.mod.js
|
|
|
|
"use strict";
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* 活动: 八日签到
|
|
*
|
|
*
|
|
******************************************************************************/
|
|
|
|
var ActBase = require("act.base");
|
|
var ActDay8 = cc.Class({
|
|
"extends": ActBase,
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
// 视图附着
|
|
nx.plugin.add(this, ["view"]);
|
|
this.vattach("Acts");
|
|
|
|
//这边活动不开也要加载配置,因为开服预告要显示奖励
|
|
var cfgs = ["login_days_new_data"];
|
|
this.loadConfigs(cfgs);
|
|
},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
// 前端准备完毕
|
|
this.RegisterProtocal(21100, this.onAppoint.bind(this));
|
|
this.RegisterProtocal(21101, this.onGetSuccess.bind(this));
|
|
},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = [this.data.config //付費活動
|
|
];
|
|
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqBaseData(_cb);
|
|
// nx.dt.fnInvoke( _cb, true );
|
|
});
|
|
},
|
|
|
|
// 请求剧情信息
|
|
reqBaseData: function reqBaseData(_cb) {
|
|
this.SendProtocal(21100, {}, _cb);
|
|
},
|
|
GetAppoint8Config: function GetAppoint8Config() {
|
|
return this.data;
|
|
},
|
|
// 八日约定 状态相关
|
|
onAppoint: function onAppoint(_data) {
|
|
// {"holiday_theme_list":[
|
|
// {"theme_id":500,"type":3,"icon":10003,"name":"日常福利","sort":0,"source":331,"start_time":0,"end_time":0,"theme_holiday_list":[]},
|
|
// {"theme_id":101,"type":1,"icon":10004,"name":"梦想启航","sort":1,"source":330,"start_time":1688659200,"end_time":1691251199,
|
|
// "theme_holiday_list":[
|
|
// {"camp_id":1001,"source":333,"config":"login_days_new_data","sort":1,"name":"八日约定"}
|
|
// ]}]}
|
|
if (nx.dt.objEmpty(_data)) {
|
|
return;
|
|
}
|
|
var show = false;
|
|
var state = _data.status_list;
|
|
state.forEach(function (_state) {
|
|
if (_state.status == 2) {
|
|
show = true;
|
|
}
|
|
});
|
|
// let key = this.tipKeys();
|
|
this.openTip("reward", show);
|
|
state.sort(function (a, b) {
|
|
return a.day - b.day;
|
|
});
|
|
this.vset("appoint8", state);
|
|
},
|
|
reqGetDayAward: function reqGetDayAward(_day) {
|
|
var protocal = {};
|
|
protocal.day = _day;
|
|
this.SendProtocal(21101, protocal);
|
|
},
|
|
querAppoint8State: function querAppoint8State() {
|
|
var state = this.vget("appoint8");
|
|
return state;
|
|
},
|
|
// [21101]:{"code":1,"msg":"","day":2}
|
|
onGetSuccess: function onGetSuccess(_data) {
|
|
if (_data.code == 1) {
|
|
this.reqBaseData();
|
|
}
|
|
},
|
|
// ============================================================
|
|
// 活动红点提示
|
|
// ============================================================
|
|
|
|
// 活动用到的提示KEY
|
|
tipKeys: function tipKeys() {
|
|
return ["appoint8"];
|
|
}
|
|
});
|
|
|
|
// 模块导出
|
|
module.exports = ActDay8;
|
|
|
|
cc._RF.pop(); |