"use strict"; cc._RF.push(module, 'c14a8QKRG5KoIB8GhMVmrTd', 'cmp.bag.batchuse.wnd'); // Scripts/mod/backpack/cmps/cmp.bag.batchuse.wnd.js "use strict"; /****************************************************************** * * 背包道具批量使用界面 * ******************************************************************/ var ItemBase = require("cmp.item.base"); var BridgeWindow = require("bridge.window"); var SliderProgress = require("cmp.slider.prog.selector"); var BackPackConst = require("backpack_const"); var BackPackController = require("backpack_controller"); var BBC = BackPackConst.Bag_Code; var BTT = BackPackConst.item_sub_type; cc.Class({ "extends": BridgeWindow, properties: { cmpItem: { "default": null, type: ItemBase }, cmpCounter: { "default": null, type: SliderProgress } }, // 重载:参数打开 onOpenConfigs: function onOpenConfigs(_params) { this.item = _params[0]; this.selects = _params[2]; // 这里暂时没有解析ItemConsumeType参数 用到再说 if (_params[1] > 1) { nx.error("[BatchUse]失败,暂无处理这种情况!"); this.close(); return; } this.config = this.item ? this.item.config : null; if (!this.item || !this.config) { nx.error("[BatchUse]失败,参数无效!"); this.close(); return; } // 重建 this.rebuild(); }, // 重建 rebuild: function rebuild() { var _this = this; // 道具信息 this.cmpItem.setData(this.item); // 设置滚动条 var total = this.item.quantity; this.cmpCounter.build(1, total, total, function (_count) { _this.changeCount(_count); }); // 数量为1不显示计数条 nx.gui.setActive(this.cmpCounter, "", total > 1); // 数量改变 this.changeCount(total); }, // 数量改变 changeCount: function changeCount(_count) { if (this.cur == _count || !nx.dt.numPositive(_count, false)) { return; } this.cur = _count; this.cmpItem.setCount(_count); }, // 点击确认 onTouchConfirm: function onTouchConfirm() { var BagC = BackPackController.getInstance(); BagC.sender10515(this.item.id, this.cur, this.selects); BagC.openItemSellPanel(false); } }); cc._RF.pop();