99 lines
2.9 KiB
JavaScript
99 lines
2.9 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '87f9cMmgkVJo5843nlA2Gpg', 'cmp.campfight.zige');
|
||
|
|
// Scripts/mod/pvp/campfight/cmp/cmp.campfight.zige.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var CampfightConst = require("campfight.const");
|
||
|
|
var CampfightMod = require("campfight.mod");
|
||
|
|
var BridgeCmp = require("bridge.component");
|
||
|
|
var NxTogs = require("nx.fx.togs");
|
||
|
|
var NxExpand = require("nx.fx.sv.expand");
|
||
|
|
var HeroConst = require("hero_const");
|
||
|
|
var HeroController = require("hero_controller");
|
||
|
|
var 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: function 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: function 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: function 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: function 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: function onTogMenu(_index) {
|
||
|
|
this.mod.reqZigeGroup(_index + 1);
|
||
|
|
},
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
this.list.svcKey = "2"; //需要展示陣容
|
||
|
|
this.mod.reqSelfGroup(); //再次請求分組
|
||
|
|
},
|
||
|
|
onDisable: function onDisable() {
|
||
|
|
this.list.rebuild([]);
|
||
|
|
// 监听事件释放
|
||
|
|
this.unbindGEvents();
|
||
|
|
},
|
||
|
|
onDestroy: function onDestroy() {},
|
||
|
|
//商店
|
||
|
|
onClickShop: function onClickShop() {},
|
||
|
|
//戰報
|
||
|
|
onClickReport: function onClickReport() {
|
||
|
|
nx.bridge.createPanel("WndCampfightRank");
|
||
|
|
},
|
||
|
|
onClickForm: function onClickForm() {
|
||
|
|
var 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) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|