Files
2026-05-23 22:10:14 +08:00

96 lines
2.6 KiB
JavaScript

const BridgeWindow = require( "bridge.window" );
const ADVCT = require("adventure_controller");
cc.Class({
extends: BridgeWindow,
properties: {
ico:{
default:null,
type:cc.Node
},
num:{
default:null,
type:cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.ctrl = ADVCT.getInstance();
this.is_relive = false;//是否有復活幣
this.endless_relive_ids = [2077 ,3053 ,4077 ,1062];
this.weekly_relive_ids = [20170 ,30146 ,40170 ,50170];
},
start () {
},
//msg不需要定位,detail需要設置位置
onOpenConfigs(params) {
this.model_type = this.ctrl.getPlayModel();
this.showRelive();
},
showRelive(){
let idx = [];
if(this.model_type == 1){
idx = this.endless_relive_ids;
}else{
idx = this.weekly_relive_ids;
}
for(let i=0;i<idx.length;i++){
let id = idx[i];
let item = this.ctrl.getItemBybid(id);
if(item){
if(item.num > 0){
let res_id = null;
if(this.model_type == 1){
res_id = game.configs.adventure_endless_data.data_item_icon[item.bid];
}else{
res_id = game.configs.adventure_weekly_data.data_adventure_event[item.bid].item_icon;
}
nx.gui.setSpriteFrame(this.ico,"",cc.js.formatStr("prefab/pve/starlost/icons/%s",res_id));
nx.gui.setString(this.num,"",item.num);
this.relive_id = item.bid;
this.is_relive = true;
break;
}
}else{
let res_id = null;
if(this.model_type == 1){
res_id = game.configs.adventure_endless_data.data_item_icon[id];
}else{
res_id = game.configs.adventure_weekly_data.data_adventure_event[id].item_icon;
}
nx.gui.setSpriteFrame(this.ico,"",cc.js.formatStr("prefab/pve/starlost/icons/%s",res_id));
nx.gui.setString(this.num,"",0);
}
}
},
onPreClosed() {
},
clickRelive(){
if(this.is_relive){
if(!this.relive_id)return;
this.ctrl.send29507(this.relive_id,this.model_type);
this.close();
}else{
nx.tbox("AdvenNoRelive");
}
},
clickEnd(){
if(this.model_type == 1){
this.ctrl.send29512();
}
this.close();
}
});