90 lines
1.8 KiB
JavaScript
90 lines
1.8 KiB
JavaScript
/******************************************************************
|
|
*
|
|
* 奖励界面
|
|
*
|
|
******************************************************************/
|
|
|
|
const FxSVC = require( "nx.fx.sv.expand" );
|
|
const FxLay = require( "cmp.item.layout" );
|
|
const 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( _params ) {
|
|
|
|
this.source = _params.source;
|
|
this.optype = _params.open_type;
|
|
|
|
// 道具拆解
|
|
this.items = [];
|
|
_params.list.forEach( _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() {
|
|
|
|
let ml = this.items.length > 5;
|
|
let lst = ml ? this.lstML : this.lstSL;
|
|
|
|
nx.gui.setActive( this.lstML, "", ml );
|
|
nx.gui.setActive( this.lstSL, "", !ml );
|
|
lst.rebuild( this.items );
|
|
|
|
},
|
|
|
|
// 操作刷新
|
|
freshOps: function() {
|
|
|
|
// 无附加功能
|
|
if( !nx.dt.numGood( this.optype ) || this.optype <= 1 ) {
|
|
nx.gui.setActive( this.nodOps, "func", false );
|
|
return;
|
|
}
|
|
|
|
// 其他
|
|
},
|
|
|
|
// 点击功能键
|
|
onTouchFunc: function() {
|
|
|
|
},
|
|
|
|
} );
|