59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
|
|
const ItemBase = require("nx.fx.sv.expand.item");
|
||
|
|
const HEACT = require("heaven_controller");
|
||
|
|
const HeavenEvent = require("heaven_event");
|
||
|
|
cc.Class({
|
||
|
|
extends: ItemBase,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
chapter:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
},
|
||
|
|
star:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
},
|
||
|
|
progress:{
|
||
|
|
default:null,
|
||
|
|
type:cc.ProgressBar
|
||
|
|
},
|
||
|
|
mask:{
|
||
|
|
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.chapter,"",cc.js.formatStr(nx.text.getKey("HeaChapter"),data.id));
|
||
|
|
this.chapter_data = HEACT.getInstance().getModel().getChapterDataById(data.id);
|
||
|
|
if(!this.chapter_data){
|
||
|
|
this.star.active = false;
|
||
|
|
this.progress.node.active = false;
|
||
|
|
this.mask.active = true;
|
||
|
|
nx.gui.setString(this.mask,"txt",cc.js.formatStr(nx.text.getKey("LockMaxDun"),data.id - 1));
|
||
|
|
}else{
|
||
|
|
nx.gui.setString(this.star,"num",this.chapter_data.all_star + "/30");
|
||
|
|
this.progress.progress = this.chapter_data.all_star / 30;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
clickAwards(){
|
||
|
|
if(!this.mdata)return;
|
||
|
|
nx.bridge.createPanel("WndHeavenAward",{id:this.mdata.id});
|
||
|
|
},
|
||
|
|
|
||
|
|
clickGotoChapter(){
|
||
|
|
if(!this.mdata)return;
|
||
|
|
gcore.GlobalEvent.fire(HeavenEvent.Add_Chapter_Data_Event,this.mdata.id);
|
||
|
|
}
|
||
|
|
// update (dt) {},
|
||
|
|
});
|