78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
const ItemBase = require("nx.fx.sv.expand.item");
|
|
const ActFund = require("cmp.act.fund");
|
|
cc.Class({
|
|
extends: ItemBase,
|
|
|
|
properties: {
|
|
lev:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
lockNd:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
maskNd:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
free:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
fund:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
fabItem:{
|
|
default:null,
|
|
type:cc.Prefab
|
|
},
|
|
actCmp:{
|
|
default:null,
|
|
type:ActFund
|
|
},
|
|
rmbTip:{
|
|
default:null,
|
|
type:cc.Node
|
|
}
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
rebind(_index,_data,_key){
|
|
this._super(_index,_data,_key);
|
|
this.setData(_data);
|
|
},
|
|
|
|
setData(data){
|
|
if(nx.dt.objEmpty(data))return;
|
|
nx.gui.setString(this.lev,"",data.aim);
|
|
let awards = data.item_list;
|
|
if(!this.freeItem){
|
|
this.freeItem = cc.instantiate(this.fabItem);
|
|
this.freeItem.parent = this.free;
|
|
}
|
|
let freeCmp = nx.gui.getComponent(this.freeItem,"","cmp.item.base");
|
|
if(freeCmp){
|
|
freeCmp.rebind(0,awards[0],"");
|
|
}
|
|
if(!this.fundItem){
|
|
this.fundItem = cc.instantiate(this.fabItem);
|
|
this.fundItem.parent = this.fund;
|
|
}
|
|
let fundCmp = nx.gui.getComponent(this.fundItem,"","cmp.item.base");
|
|
if(fundCmp){
|
|
fundCmp.rebind(1,awards[1],"");
|
|
}
|
|
|
|
nx.gui.setActive(this.maskNd,"",data.status >= 2);
|
|
nx.gui.setActive(this.lockNd,"",this.actCmp.buy_status == 0);
|
|
if(this.actCmp.buy_status == 1){//已购买
|
|
nx.gui.setActive(this.node,"2",data.status == 2);
|
|
nx.gui.setActive(this.rmbTip,"",data.status == 4);
|
|
}else{
|
|
nx.gui.setActive(this.node,"2",false);
|
|
}
|
|
},
|
|
});
|