"use strict"; cc._RF.push(module, '719200WVPdJ0rQN4ai/9k9X', 'cmp.battledrama.hallowselect'); // Scripts/mod/battle_drama/cmp/form/cmp.battledrama.hallowselect.js "use strict"; var BridgeWindow = require("bridge.window"); var HallowsController = require("hallows_controller"); var NxExpand = require("nx.fx.sv.expand"); cc.Class({ "extends": BridgeWindow, properties: { list: { "default": null, type: NxExpand } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { this.hallows_model = HallowsController.getInstance().getModel(); }, start: function start() {}, onOpenConfigs: function onOpenConfigs(params) { this.hallows_id = params.hallows_id; this.select_cb = params.callback; this.updateWidgets(); }, updateWidgets: function updateWidgets() { var hallows_list = []; var config_list = game.configs.hallows_data.data_base; for (var hallow_i in config_list) { var hallow_data = {}; var hallow_cfg = config_list[hallow_i]; var hallow_vo = this.hallows_model.getHallowsById(hallow_cfg.id); if (hallow_vo) { if (this.hallows_id == hallow_vo.id) { hallow_vo.is_equip = true; } else { hallow_vo.is_equip = false; } } hallow_data.hallow_cfg = hallow_cfg; hallow_data.hallow_vo = hallow_vo; hallow_data.select_cb = this.select_cb; hallows_list.push(hallow_data); } this.list.rebuild(hallows_list); }, onFocusHallowsItem: function onFocusHallowsItem(_item) { if (nx.dt.objEmpty(_item) || nx.dt.objEmpty(_item.mdata)) { return; } // 聚焦 this.list.cleanFocus(); this.list.addFocus(_item.index); }, onPreClosed: function onPreClosed() { this.list.rebuild([]); } // update (dt) {}, }); cc._RF.pop();