43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
const SVCItem = require( "nx.fx.sv.expand.item" );
|
|
const ItemBase = require( "cmp.item.base" );
|
|
|
|
cc.Class({
|
|
|
|
extends: SVCItem,
|
|
|
|
properties: {
|
|
|
|
nodItem: { default: null, type : ItemBase, displayName: "基礎物品組件" },
|
|
nodMat: { default: null, type : cc.Node , displayName: "材料顯示" },
|
|
nodSold: { default: null, type : cc.Node , displayName: "售罄顯示" },
|
|
nodTime: { default: null, type : cc.Node , displayName: "購買次數顯示" },
|
|
nodDisCount:{ default: null, type : cc.Node , displayName: "折扣顯示" },
|
|
},
|
|
|
|
|
|
// 数据重置
|
|
rebind: function( _idx, _data, _key ) {
|
|
|
|
this._super( _idx, _data, _key );
|
|
this.setData();
|
|
},
|
|
|
|
/**{"id":3,"item_id":14001,"num1":1,"pay_id":1,"num2":8000,"limit_num":5
|
|
* */
|
|
setData: function(){
|
|
|
|
if( !this.mdata ){
|
|
return;
|
|
}
|
|
this.nodItem.setData( [ this.mdata.item_bid || this.mdata.item_id, this.mdata.item_num || this.mdata.num1 ] );
|
|
nx.bridge.setIconS( this.nodMat, "mat", this.mdata.pay_id );
|
|
nx.gui.setString( this.nodMat, "txt", this.mdata.price || this.mdata.num2 );
|
|
|
|
nx.gui.setActive( this.nodSold, "", this.mdata.limit == 0 || this.mdata.limit_num == 0 );
|
|
nx.gui.setString( this.nodTime, "txt", this.mdata.limit || this.mdata.limit_num );
|
|
nx.gui.setString( this.nodDisCount, "rate", this.mdata.discount ? this.mdata.discount : "" );
|
|
nx.gui.setActive( this.nodDisCount, "", this.mdata.discount );
|
|
nx.gui.setActive( this.nodTime, "", this.mdata.limit_num != 0 );
|
|
},
|
|
});
|