"use strict"; cc._RF.push(module, 'ce050Fx1S1Il4+i90SEpfQ4', 'act.first.mod'); // Scripts/mod/acts/firstcharge/act.first.mod.js "use strict"; /******************************************************************************* * * 活动: 月卡 * * ******************************************************************************/ var ActBase = require("act.base"); var FID = require("bridge.function.ids"); var ActFirst = cc.Class({ "extends": ActBase, // 初始化配置数据 initConfig: function initConfig() { // 视图附着 nx.plugin.add(this, ["view"]); this.vattach("Acts"); }, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(21003, this.handle21003.bind(this)); this.RegisterProtocal(21032, this.handle21032.bind(this)); // 首充信息 this.RegisterProtocal(21033, this.handle21033.bind(this)); // 領取對應天數的首充禮包 }, // 从服务器初始化数据 reqBaseFromServer: function reqBaseFromServer(_cb) { nx.dt.fnInvoke(_cb, true); this.reqBaseData(); }, // 请求剧情信息 reqBaseData: function reqBaseData(_cb) { this.reqFirstData(); }, // ============================================================ // 首充操作 // ============================================================ // 请求首充信息 reqFirstData: function reqFirstData(_cb) { this.SendProtocal(21032, {}, _cb); }, // 请求首充信息返回 handle21032: function handle21032(_data) { if (!this.isGoodData(_data)) { this.vset("firstCharge", []); return; } this.vset("firstCharge", _data.first_gift); // 提示刷新 this.freshTips(); }, // 领取首充禮包奖励 reqChargeReward: function reqChargeReward(_id, _cb) { this.SendProtocal(21033, { id: _id }, _cb); }, // 领取月卡奖励返回 handle21033: function handle21033(_data) { if (!this.isGoodData(_data)) { return; } // 提示刷新 // this.freshTips(); }, handle21003: function handle21003(_data) { if (!this.isGoodData(_data)) { return; } if (_data.is_open == 1) { var data = nx.bridge.acts.searchAct(this.data.camp_id); if (data) { // let args = nx.dt.objClone( data ); // args.focus = 51001;//首充禮包 nx.bridge.vset("DailyLimit", _data.is_open); if (nx.bridge.plot && !nx.bridge.plot.isDoing()) { nx.bridge.vset("DailyPop", 1); } // nx.bridge.createPanel( "WndFirstCharge", args ); // nx.bridge.popups.push( "WndFirstCharge", args, { // push : true, // } ); } // nx.bridge.jumper.jump2Window( FID.ActFirst ); } }, // ============================================================ // 活动红点提示 // ============================================================ // 活动用到的提示KEY tipKeys: function tipKeys() { return ["reward1", "reward2"]; }, // 红点提示更新 freshTips: function freshTips() { var gifts = this.vget("firstCharge"); var is_reward = false; var is_reward2 = false; for (var i in gifts) { if (gifts[i].id <= 3 && gifts[i].status == 1) { is_reward = true; } else if (gifts[i].id > 3 && gifts[i].status == 1) { is_reward2 = true; } } // this.openTip( "reward", is_reward ); this.openTip("reward1", is_reward); this.openTip("reward2", is_reward2); } }); // 模块导出 module.exports = ActFirst; cc._RF.pop();