80 lines
1.7 KiB
JavaScript
80 lines
1.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'ededer9lRpB5Z+XXneyfpwD', 'cmp.reward.wnd');
|
|
// Scripts/mod/backpack/cmps/cmp.reward.wnd.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
*
|
|
* 奖励界面
|
|
*
|
|
******************************************************************/
|
|
|
|
var FxSVC = require("nx.fx.sv.expand");
|
|
var FxLay = require("cmp.item.layout");
|
|
var BridgeWindow = require("bridge.window");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
lstSL: {
|
|
"default": null,
|
|
type: FxLay
|
|
},
|
|
lstML: {
|
|
"default": null,
|
|
type: FxSVC
|
|
},
|
|
nodOps: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 重载:参数打开
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
|
var _this = this;
|
|
this.source = _params.source;
|
|
this.optype = _params.open_type;
|
|
|
|
// 道具拆解
|
|
this.items = [];
|
|
_params.list.forEach(function (_t) {
|
|
_this.items.push([_t.bid, _t.num || 1]);
|
|
});
|
|
|
|
// 判空
|
|
if (nx.dt.arrEmpty(this.items)) {
|
|
this.close();
|
|
nx.error("[REWARD]无效的道具表!");
|
|
return;
|
|
}
|
|
|
|
// 道具刷新
|
|
this.freshItems();
|
|
|
|
// 操作刷新
|
|
this.freshOps();
|
|
},
|
|
// 道具刷新
|
|
freshItems: function freshItems() {
|
|
var ml = this.items.length > 5;
|
|
var lst = ml ? this.lstML : this.lstSL;
|
|
nx.gui.setActive(this.lstML, "", ml);
|
|
nx.gui.setActive(this.lstSL, "", !ml);
|
|
lst.rebuild(this.items);
|
|
},
|
|
// 操作刷新
|
|
freshOps: function freshOps() {
|
|
// 无附加功能
|
|
if (!nx.dt.numGood(this.optype) || this.optype <= 1) {
|
|
nx.gui.setActive(this.nodOps, "func", false);
|
|
return;
|
|
}
|
|
|
|
// 其他
|
|
},
|
|
|
|
// 点击功能键
|
|
onTouchFunc: function onTouchFunc() {}
|
|
});
|
|
|
|
cc._RF.pop(); |