51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
const ItemBase = require("nx.fx.sv.expand.item");
|
|
const ADVCT = require("adventure_controller");
|
|
|
|
cc.Class({
|
|
extends: ItemBase,
|
|
|
|
properties: {
|
|
ico:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
isShowText:false
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
rebind(_idx,_data,_key){
|
|
this._super(_idx,_data,_key);
|
|
this.setData(_data);
|
|
},
|
|
|
|
setData(data){
|
|
if(nx.dt.objEmpty(data))return;
|
|
let model_type = ADVCT.getInstance().getPlayModel();
|
|
let cfg = null;
|
|
if(model_type == 1){
|
|
cfg = game.configs.adventure_endless_data.data_buff_icon[data.bid];
|
|
}else{
|
|
cfg = game.configs.adventure_weekly_data.data_buff_icon[data.bid];
|
|
}
|
|
this.cfg = cfg;
|
|
|
|
let res_path = cc.js.formatStr("prefab/pve/starlost/icons/%s",cfg.icon[data.time-1]);
|
|
nx.gui.setSpriteFrame(this.ico,"",res_path);
|
|
if(this.isShowText){//顯示描述文本
|
|
nx.gui.setString(this.node,"scroll/txt",cfg.desc);
|
|
}
|
|
},
|
|
|
|
start () {
|
|
|
|
},
|
|
|
|
onTouchBuffTip(){
|
|
if(!this.mdata)return;
|
|
nx.bridge.createPanel("WndAdventureMsg",{type:2,data:this.cfg});
|
|
},
|
|
|
|
// update (dt) {},
|
|
});
|