Files

130 lines
5.0 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '57d0elq/t9EPL7bBp1jodDo', 'act.collect.mod');
// Scripts/mod/acts/collect/act.collect.mod.js
"use strict";
/*******************************************************************************
*
* 活动: 每日活跃
*
*
******************************************************************************/
var ActBase = require("act.base");
var ActDailyTreasure = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
this.period = 0;
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(31150, this.getCardCollectData.bind(this)); // 炫卡集基本信息
this.RegisterProtocal(31151, this.getCardReward.bind(this)); // 抽獎/卡
this.RegisterProtocal(31152, this.getCollectReachTimesRewardBack.bind(this)); // 領取達成獎勵
this.RegisterProtocal(31153, this.getCollectLineReward.bind(this)); // 領取連綫達成獎勵
// this.RegisterProtocal( 31122, this.getTreasureTaskR.bind( this ) ); // 當前活躍活動任務相關
// this.RegisterProtocal( 31123, this.getStarPrayData.bind( this ) ); // 活躍度抽獎相關
// this.RegisterProtocal( 31124, this.getStarPrayBackData.bind( this ) ); // 請求轉盤獎勵
// this.RegisterProtocal( 31125, this.getStarPrayRewardData.bind( this ) ); // 領取轉盤獎勵
// this.RegisterProtocal( 31126, this.getDailyReachData.bind( this ) ); // 領取轉盤活躍達成獎勵
// // // // // 前端准备完毕
// this.RegisterProtocal( 31127, this.getStarPrayJump.bind( this ) ); // 跳過 返回
// // this.RegisterProtocal( 31106, this.getBuyDiaBack.bind( this ) ); // 今日充值次数
// this.RegisterProtocal( 31128, this.getStarPrayRecords.bind( this ) ); // 活躍度 獎勵記錄
// this.RegisterProtocal(14100, this.GetSignStatus.bind( this ) );
// this.RegisterProtocal(14101, this.GetSignBack.bind( this ) );
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
var _this = this;
var cfgs = [this.data.config //付費活動
];
this.loadConfigs(cfgs, function (_ret, _data) {
nx.dt.fnInvoke(_cb, true);
_this.reqBaseInfo();
});
},
reqBaseInfo: function reqBaseInfo() {
this.SendProtocal(31150, {});
},
/***
* [31150]:{"ids":[{"id":5},{"id":9},{"id":6},{"id":10},{"id":18},{"id":17},{"id":7},{"id":25},{"id":22},{"id":14},{"id":16},{"id":8},{"id":4},{"id":24},{"id":11},{"id":20},{"id":19},{"id":2},{"id":3},{"id":23}],
* "reach_reward":[{"id":6,"status":0},{"id":5,"status":0},{"id":4,"status":0},{"id":3,"status":1},{"id":2,"status":1},{"id":1,"status":1}],
* "rewards":[{"id":12,"status":0},{"id":11,"status":0},{"id":10,"status":1},{"id":9,"status":0},{"id":8,"status":0},{"id":7,"status":0},{"id":6,"status":0},{"id":5,"status":0},{"id":4,"status":1},{"id":3,"status":0},{"id":2,"status":1},{"id":1,"status":0}],"draw_times":121}
*/
// 獲取當前的 集卡活動 數據
getCardCollectData: function getCardCollectData(_data) {
//
this.vset("ActsCollectCard", _data);
this.period = _data.group;
var count = 0;
var reach_reward = _data.reach_reward;
var rewards = _data.rewards;
if (nx.dt.arrNEmpty(reach_reward)) {
for (var i = 0; i < reach_reward.length; i++) {
var reach = reach_reward[i];
if (reach.status == 1) {
count++;
break;
}
}
}
if (nx.dt.arrNEmpty(rewards)) {
for (var r = 0; r < rewards.length; r++) {
var _reach = rewards[r];
if (_reach.status == 1) {
count++;
break;
}
}
}
this.openTip("reward", count > 0);
},
// 獲取當前的 星空許願 數據
getStarPrayBackData: function getStarPrayBackData(_data) {
//
// this.vset( "starPrayData", _data );
},
reqCollectCard: function reqCollectCard(_times, _cb) {
var protocal = {};
protocal.times = _times;
this.SendProtocal(31151, protocal, _cb);
},
getCardReward: function getCardReward(_data) {
this.vset("ActsCardInfo", _data);
},
reqGetCollectReachTimesReward: function reqGetCollectReachTimesReward(_id) {
var protocal = {};
protocal.id = _id;
this.SendProtocal(31152, protocal);
},
getCollectReachTimesRewardBack: function getCollectReachTimesRewardBack(_id) {},
reqGetLineCollectReward: function reqGetLineCollectReward(_id) {
var protocal = {};
protocal.id = _id;
this.SendProtocal(31153, protocal);
},
getCollectLineReward: function getCollectLineReward(_data) {},
// 領取當前的 星空許願獎勵
reqGetStarPrayRewardData: function reqGetStarPrayRewardData(_data) {
var protocal = {};
protocal.group_id = _data.group_id;
protocal.type = _data.type;
protocal.id = _data.id;
this.SendProtocal(31125, protocal);
}
});
// 模块导出
module.exports = ActDailyTreasure;
cc._RF.pop();