"use strict"; cc._RF.push(module, 'aa0deRYanpHLZp5C4CyhrNu', 'act.limitupstar.mod'); // Scripts/mod/acts/upstar/act.limitupstar.mod.js "use strict"; /******************************************************************************* * * 活动: 限时招募五选一升星活动 * * ******************************************************************************/ var ActBase = require("act.base"); var LimitActUpStar = cc.Class({ "extends": ActBase, // 初始化配置数据 initConfig: function initConfig() { // 视图附着 nx.plugin.add(this, ["view"]); this.vattach("Acts"); }, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(29220, this.handle29220.bind(this)); //获取主界面信息 this.RegisterProtocal(29221, this.handle29221.bind(this)); //请求可以参加升星的英雄 this.RegisterProtocal(29222, this.handle29222.bind(this)); //选择英雄 this.RegisterProtocal(29223, this.handle29223.bind(this)); //锁定英雄 this.RegisterProtocal(29224, this.handle29224.bind(this)); //领取免费奖励 }, // 从服务器初始化数据 reqBaseFromServer: function reqBaseFromServer(_cb) { var _this = this; var cfgs = ["holiday_upstars_new_data"]; this.loadConfigs(cfgs, function (_ret, _data) { _this.reqBaseData(_cb); }); }, // 请求剧情信息 reqBaseData: function reqBaseData(_cb) { this.reqUpstarData(_cb); }, reqUpstarData: function reqUpstarData(_cb) { this.send29220(_cb); }, // ============================================================ // 升星操作 // ============================================================ //任務信息 send29220: function send29220(_cb) { this.SendProtocal(29220, {}, _cb); }, handle29220: function handle29220(_data) { if (!this.isGoodData(_data)) { this.vset("limitUpstarAwards", []); return; } this.setChooseHero(_data.choose_partner_bid, _data.choose_partner_star); this.setIsLock(_data.islock); this.setLimitTime(_data.end_time); this.vset("limitUpstarAwards", _data.award_list); //獎勵列表 // 提示刷新 this.freshTips(_data); }, send29221: function send29221(_cb) { this.SendProtocal(29221, {}, _cb); }, handle29221: function handle29221(_data) { if (!this.isGoodData(_data)) { return; } this.vset("limitHeros", _data); }, //選擇英雄 send29222: function send29222(_bid, _cb) { this.SendProtocal(29222, { partner_Bid: _bid }, _cb); }, handle29222: function handle29222(_data) { if (!this.isGoodData(_data)) { return; } }, //鎖定英雄 send29223: function send29223(_cb) { this.SendProtocal(29223, {}, _cb); }, handle29223: function handle29223(_data) { if (!this.isGoodData(_data)) { return; } }, //领取免费奖励 send29224: function send29224(_partner_star, _cb) { this.SendProtocal(29224, { partner_star: _partner_star }, _cb); }, handle29224: function handle29224(_data) { nx.bridge.acts.reqActsRewards(); if (!this.isGoodData(_data)) { return; } }, // ============================================================ // 活动红点提示 // ============================================================ // // 活动用到的提示KEY // tipKeys: function() { // return ["star5","star6","star7","star8","star9","star10"]; // }, // 红点提示更新 freshTips: function freshTips(_data) { var tasks = this.vget("limitUpstarAwards"); var count = 0; for (var i = 0; i < tasks.length; i++) { if (tasks[i].free_state == 1) { count++; } else {} } this.openTip("reward", count > 0 || _data.islock == 0); }, setChooseHero: function setChooseHero(bid, star) { this.tag_partner = {}; this.tag_partner.bid = bid; this.tag_partner.star = star; }, getChooseHero: function getChooseHero() { return this.tag_partner; }, setIsLock: function setIsLock(status) { this.is_lock = status; }, getIsLock: function getIsLock() { if (this.is_lock != null) { return this.is_lock; } return 0; }, setLimitTime: function setLimitTime(time) { this.end_time = time; }, getLimitTime: function getLimitTime() { if (this.end_time) { return this.end_time; } return 0; } }); // 模块导出 module.exports = LimitActUpStar; cc._RF.pop();