"use strict"; cc._RF.push(module, 'd7c34AouldEy5jsSnv4fMI1', 'cmp.endless.wnd.buff'); // Scripts/mod/pve/endless_trail/cmp/cmp.endless.wnd.buff.js "use strict"; var BridgeWindow = require("bridge.window"); var NxExpand = require("nx.fx.sv.expand"); var ItemLay = require("cmp.common.itemlayout"); var HeroVo = require("hero_vo"); var EndlessController = require("endless_trail_controller"); cc.Class({ "extends": BridgeWindow, properties: { cur_num: { "default": null, type: cc.Label }, form_txt: { "default": null, type: cc.Label }, role_list: { "default": null, type: ItemLay }, list: { "default": null, type: NxExpand }, desc: { "default": null, type: cc.RichText }, autoSkip: { "default": null, type: cc.Toggle } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { this.ctrl = EndlessController.getInstance(); this.model = this.ctrl.getModel(); this.autoSkip.node.on("toggle", this.skipCheck.bind(this)); }, start: function start() {}, skipCheck: function skipCheck(e) { this.ctrl.setAutoCheck(e.isChecked); }, onOpenConfigs: function onOpenConfigs(data) { var _this = this; this.ctrl.setAutoCheck(this.autoSkip.isChecked); if (data) { this.buff_data = data; this.cur_num.string = cc.js.formatStr(nx.text.getKey("labendless_trail_buff_window_tip4"), data.round); if (game.configs.formation_data.data_form_data) { var name = game.configs.formation_data.data_form_data[data.formation_type].name; this.form_txt.string = name + " Lv." + data.formation_lev; } this.updateBuffData(data); this.updatePartnerData(data); var time = data.end_time - client.socket.getTime(); if (time <= 0) { time = 0; } if (time > 30) { time = 30; } time = 15; this.desc.string = cc.js.formatStr(nx.text.getKey("labendless_trail_buff_window_tip5"), time); this.schedule(function () { if (time > 0) { time--; } _this.desc.string = cc.js.formatStr(nx.text.getKey("labendless_trail_buff_window_tip5"), time); if (time == 0) { //随机一个buff选出 var id = Math.floor(Math.random() * 3); var buff = _this.buff_data.list[id]; if (buff) { _this.ctrl.send23911(buff.buff_id, _this.autoSkip.isChecked || 0); } } }, 1, time - 1, 1); } }, // 增益buff选择 updateBuffData: function updateBuffData(data) { if (data) { data.list.sort(function (a, b) { return a.buff_id - b.buff_id; }); this.list.rebuild(data.list); } }, updatePartnerData: function updatePartnerData(data) { if (data) { var pos_info = data.partner; if (pos_info) { var temp = []; for (var i in pos_info) { pos_info[i].rare_type = pos_info[i].quality; var vo = new HeroVo(); vo.updateHeroVo(pos_info[i]); temp.push(vo); } this.role_list.rebuild(temp); // if(temp_item){ // temp_item.setExtendData({from_type:HeroConst.ExhibitionItemType.eEndLessHero}) // temp_item.setData(temp[j],true) // var width = 120 * 0.8 // temp_item.setPosition(width * 0.5 + 16 + (width + 25)* j, this.partner_container.getContentSize().height / 2 - 10); // } } } }, onPreClosed: function onPreClosed() { this.list.rebuild([]); this.role_list.rebuild([]); }, onDisable: function onDisable() { if (nx.bridge.prompt) { nx.bridge.prompt.delPrompt(16); } } // update (dt) {}, }); cc._RF.pop();