82 lines
1.7 KiB
JavaScript
82 lines
1.7 KiB
JavaScript
|
|
const ItemBase = require( "nx.fx.sv.expand.item" );
|
||
|
|
const HeroVo = require("hero_vo");
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
extends: ItemBase,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
tog:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
},
|
||
|
|
pname:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Label
|
||
|
|
},
|
||
|
|
atk:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Label
|
||
|
|
},
|
||
|
|
fabHero:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Prefab
|
||
|
|
},
|
||
|
|
heroNd:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
|
||
|
|
onLoad () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 数据重置
|
||
|
|
rebind: function( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData( _data );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
setEmpty(){
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onFocus(){
|
||
|
|
nx.gui.setActive(this.tog,"check",true);
|
||
|
|
},
|
||
|
|
|
||
|
|
outFocus(){
|
||
|
|
nx.gui.setActive(this.tog,"check",false);
|
||
|
|
},
|
||
|
|
|
||
|
|
setData(data){
|
||
|
|
if(nx.dt.objEmpty(data)){
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
var hero_base_cfg = gdata("partner_data","data_partner_base",data.bid)
|
||
|
|
if (! hero_base_cfg ){ return }
|
||
|
|
this.pname.string = hero_base_cfg.name;
|
||
|
|
this.atk.string = data.power || 0;
|
||
|
|
hero_base_cfg.level = data.lev;
|
||
|
|
if(!this.hero_item){
|
||
|
|
this.hero_item = cc.instantiate(this.fabHero);
|
||
|
|
this.hero_item.parent = this.heroNd;
|
||
|
|
}
|
||
|
|
let hero = new HeroVo();
|
||
|
|
hero.updateHeroVo(data);
|
||
|
|
hero.camp_type = hero_base_cfg.camp_type;
|
||
|
|
hero.hp_per = null;//需要特殊设置
|
||
|
|
let cmp = nx.gui.getComponent(this.hero_item,"","cmp.partner.item.planesafk");
|
||
|
|
cmp.rebind(0,hero,"");
|
||
|
|
},
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
});
|