"use strict"; cc._RF.push(module, '52578IaUSVP+YgU0Nz+zBu8', 'cmp.item.act.openserver.wnd'); // Scripts/mod/open_server/cmp.item.act.openserver.wnd.js "use strict"; var SvcItem = require("nx.fx.sv.expand.item"); var BaseLayout = require("cmp.common.itemlayout"); var themeMod = require("acts.mod"); var RoleController = require("role_controller"); cc.Class({ "extends": SvcItem, properties: { lay: { "default": null, type: BaseLayout }, name_lb: { "default": null, type: cc.Label }, name_desc: { "default": null, type: cc.RichText }, name_level: { "default": null, type: cc.Label }, goto_btn: { "default": null, type: cc.Node }, notOpenText: { "default": null, type: cc.Node }, notOpenText2: { "default": null, type: cc.Node }, nodTip: { "default": null, type: cc.Node } }, // LIFE-CYCLE CALLBACKS: // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(_data, _key); }, onLoad: function onLoad() {}, start: function start() {}, onDisable: function onDisable() { this.lay.rebuild([]); }, setData: function setData(data, _key) { if (nx.dt.objEmpty(data)) { return false; } this.name_lb.string = data.name; this.name_desc.string = data.desc; var str = cc.js.formatStr(nx.text.getKey("action_str36"), data.lv); this.name_level.string = str; // 展示掉落物品 this.updateDramaDropInfo(data.items); //判断活动有没有开启 this.goto_btn.active = false; this.nodTip.active = data.tip ? true : false; this.notOpenText.active = false; this.notOpenText2.active = false; this.source_id = data.source_id; switch (this.source_id) { case 334: //七日特訓 { var theme = themeMod.getInstance().queryThemeBySource(this.source_id); if (theme) this.goto_btn.active = true;else this.notOpenText.active = true; } break; case 367: //自選派對 case 454: //百抽盛宴 case 354: //成長衝刺 { var theme = themeMod.getInstance().queryTheme(101); if (theme) { var bFind = false; for (var k in theme.theme_holiday_list) { var act = theme.theme_holiday_list[k]; if (act && act.source == this.source_id) { bFind = true; this.goto_btn.active = true; this.camp_id = act.camp_id; break; } } if (bFind == false) this.notOpenText.active = true; } else this.notOpenText.active = true; } break; } if (this.notOpenText.active) { var binder = RoleController.getInstance().getRoleVo(); if (binder.lev < data.lv) { this.notOpenText.active = false; this.notOpenText2.active = true; } } }, // 更新副本掉落物品展示信息 updateDramaDropInfo: function updateDramaDropInfo(item_datas) { if (nx.dt.arrEmpty(item_datas)) { return false; } // 创建物品显示对象,只展示1个 var list = []; for (var index = 0; index < item_datas.length; index++) { var element = item_datas[index]; list.push({ bid: element[0], num: element[1] }); } this.lay.rebuild(list); }, touchGoto: function touchGoto() { nx.bridge.closePanel("WndOpenServer"); cc.sys.localStorage.setItem("needBackOpenServerAct", 1); switch (this.source_id) { case 334: //七日特訓 nx.bridge.createPanel("WndActTraining7"); break; case 367: //自選派對 case 454: //百抽盛宴 case 354: //成長衝刺 nx.bridge.jumper.jump2ActTheme(101, this.camp_id); break; } } // update (dt) {}, }); cc._RF.pop();