"use strict"; cc._RF.push(module, 'c20eezSQBdFcZ8t6lrZkIto', 'act.totalcharge.mod'); // Scripts/mod/acts/totalcharge/act.totalcharge.mod.js "use strict"; /******************************************************************************* * * 活动: 今日纍充 * * ******************************************************************************/ var ActBase = require("act.base"); var ActTotalCharge = cc.Class({ "extends": ActBase, // 初始化配置数据 initConfig: function initConfig() { // 视图附着 nx.plugin.add(this, ["view"]); this.vattach("Acts"); }, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(16603, this.handle16603.bind(this)); // 請求子活動相關,來取相關的顯示數據 this.RegisterProtocal(16604, this.handle16604.bind(this)); // 請求領取子活動獎勵相關,來取相關的顯示數據 }, // 从服务器初始化数据 reqBaseFromServer: function reqBaseFromServer(_cb) { // let cfgs = [ // this.data.config,//付費活動 // ] // this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData(_cb); // } ) }, // 请求活动信息 reqBaseData: function reqBaseData(_cb) { this.reqTotalChargeData(_cb); }, // ============================================================ // 今日纍充 // ============================================================ // 请求今日纍充信息 reqTotalChargeData: function reqTotalChargeData(_cb) { this.SendProtocal(16603, { bid: this.data.camp_id }, _cb); }, // 请求領取今日纍充獎勵 reqGetTotalAward: function reqGetTotalAward(_aim, _cb) { this.SendProtocal(16604, { bid: this.data.camp_id, aim: _aim, arg: 0 }, _cb); }, // 请求相關配置信息 handle16603: function handle16603(_data) { if (_data.bid == this.data.camp_id) { this.setChargePro(_data.finish); this.vset("totalChargeData", _data); this.freshTips(); return; } }, // 请求相關配置信息 handle16604: function handle16604(_data) {}, // ============================================================ // 活动红点提示 // ============================================================ // 活动用到的提示KEY tipKeys: function tipKeys() { return ["totalChargeClaim"]; }, // 红点提示更新 freshTips: function freshTips() { var data = this.vget("totalChargeData"); var is_reward = false; for (var i in data.aim_list) { if (data.aim_list[i].status == 1) { is_reward = true; break; } } this.openTip("totalChargeClaim", is_reward); }, setChargePro: function setChargePro(charge) { this.charge_val = charge; }, getChargePro: function getChargePro() { if (this.charge_val) { return this.charge_val; } return 0; } }); // 模块导出 module.exports = ActTotalCharge; cc._RF.pop();