109 lines
2.8 KiB
JavaScript
109 lines
2.8 KiB
JavaScript
const CampfightConst = require( "campfight.const" );
|
|
const CampfightMod = require("campfight.mod");
|
|
const BridgeCmp = require("bridge.component");
|
|
const NxTogs = require("nx.fx.togs");
|
|
const NxExpand = require("nx.fx.sv.expand");
|
|
const HeroConst = require("hero_const");
|
|
const HeroController = require("hero_controller");
|
|
const PartnerConst = require("partner_const");
|
|
cc.Class({
|
|
extends: BridgeCmp,
|
|
|
|
properties: {
|
|
groupTog:{
|
|
default:null,
|
|
type:NxTogs
|
|
},
|
|
list:{
|
|
default:null,
|
|
type:NxExpand
|
|
},
|
|
formBtn:{
|
|
default:null,
|
|
type:cc.Node
|
|
}
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
onLoad () {
|
|
this._super();
|
|
this.mod = CampfightMod.getInstance();
|
|
this.groupTog.posTog = this.onTogMenu.bind( this );
|
|
this.bindGEvent(CampfightConst.EVT_CAMP_ZIGE_UI,this.freshList.bind(this));
|
|
this.bindGEvent(CampfightConst.EVT_CAMP_UPSEAT,this.freshSeat.bind(this));
|
|
this.bindGEvent(CampfightConst.EVT_CAMP_UPDATE_BTN,this.freshBtns.bind(this));
|
|
},
|
|
|
|
freshBtns(_key){
|
|
// if(_key == "form"){
|
|
// let btnCmp = nx.gui.getComponent(this.formBtn,"",cc.Button);
|
|
// btnCmp.interactable = false;
|
|
// nx.gui.setString(this.formBtn,"txt",nx.text.getKey("CampFitFormed"));
|
|
// }
|
|
},
|
|
|
|
freshSeat(group){
|
|
if(group == 0){
|
|
this.groupTog.togTo(0,true);
|
|
this.mod.reqZigeGroup(1);
|
|
}else{
|
|
this.groupTog.togTo(group - 1);
|
|
this.mod.reqZigeGroup(group);
|
|
}
|
|
|
|
// //是否参赛
|
|
// let is_contest = this.mod.isContest();
|
|
// nx.gui.setActive(this.formBtn,"",is_contest);
|
|
},
|
|
|
|
freshList(data){
|
|
if(nx.dt.objEmpty(data)){
|
|
return this.list.rebuild([]);
|
|
}
|
|
|
|
data.rank_list.sort(Utils.tableLowerSorter(["rank"]))
|
|
this.list.rebuild(data.rank_list);
|
|
},
|
|
|
|
onTogMenu(_index){
|
|
this.mod.reqZigeGroup(_index + 1);
|
|
},
|
|
|
|
onEnable(){
|
|
this.list.svcKey = "2";//需要展示陣容
|
|
this.mod.reqSelfGroup();//再次請求分組
|
|
},
|
|
|
|
onDisable(){
|
|
this.list.rebuild([]);
|
|
// 监听事件释放
|
|
this.unbindGEvents();
|
|
},
|
|
|
|
onDestroy(){
|
|
|
|
},
|
|
|
|
//商店
|
|
onClickShop(){
|
|
|
|
},
|
|
|
|
//戰報
|
|
onClickReport(){
|
|
nx.bridge.createPanel("WndCampfightRank");
|
|
},
|
|
|
|
onClickForm(){
|
|
let status = this.mod.getActStatus();
|
|
if(status == 4){
|
|
HeroController.getInstance().openFormGoFightPanel(true, PartnerConst.Fun_Form.YearCross, {period:this.mod.getCurPeriod(),need_hide_top:true}, HeroConst.FormShowType.eFormSave)
|
|
}else{
|
|
nx.tbox("CampFitTwoEnd");
|
|
}
|
|
}
|
|
|
|
// update (dt) {},
|
|
});
|