108 lines
3.1 KiB
JavaScript
108 lines
3.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'f58e1SmTlRLeqFk1H98oJLj', 'cmp.trainingcamp.wnd');
|
||
|
|
// Scripts/mod/pve/trainingcamp/cmp/cmp.trainingcamp.wnd.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var FxSVC = require("nx.fx.sv.expand");
|
||
|
|
var TCController = require("trainingcamp_controller");
|
||
|
|
var BattleController = require("battle_controller");
|
||
|
|
var BattleConst = require("battle_const");
|
||
|
|
var TrainingcampEvent = require("trainingcamp_event");
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
svcList: {
|
||
|
|
"default": null,
|
||
|
|
type: FxSVC,
|
||
|
|
displayName: "训练列表"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.openTrain();
|
||
|
|
this.bindGEvent(TrainingcampEvent.Update_Trainingcamp_Data_Event, this.refreshItem.bind(this));
|
||
|
|
this.bindGEvent(TrainingcampEvent.Is_Show_Formation_Event, this.refreshItemDiff.bind(this));
|
||
|
|
},
|
||
|
|
// 重载:参数打开
|
||
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
||
|
|
nx.storage.set("battleArena", null);
|
||
|
|
|
||
|
|
// BattleController.getInstance().send20060( BattleConst.Fight_Type.Training_Camp );
|
||
|
|
// console.log( "当前的完成状态显示" + JSON.stringify( finishes ) );
|
||
|
|
},
|
||
|
|
|
||
|
|
openTrain: function openTrain() {
|
||
|
|
var cfg = game.configs.training_camp_data.data_info;
|
||
|
|
var lst = [];
|
||
|
|
this.plotData = {};
|
||
|
|
var TTC = TCController.getInstance().getModel();
|
||
|
|
for (var i in cfg) {
|
||
|
|
var item = nx.dt.objClone(cfg[i]);
|
||
|
|
if (item) {
|
||
|
|
item.open = 0;
|
||
|
|
if (item.id <= TTC.finish_ids.length + 1) {
|
||
|
|
item.open = 1;
|
||
|
|
}
|
||
|
|
var finish = TTC.IsFinishById(i);
|
||
|
|
var complete = TTC.IsCompleteById(i);
|
||
|
|
item.finish = finish;
|
||
|
|
item.complete = complete;
|
||
|
|
if (item.id == 1) {
|
||
|
|
this.plotData = nx.dt.objClone(item);
|
||
|
|
}
|
||
|
|
lst.push(item);
|
||
|
|
// finishes.push( finish );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
this.svcList.rebuild(lst);
|
||
|
|
},
|
||
|
|
refreshItem: function refreshItem(_data) {
|
||
|
|
if (_data) {
|
||
|
|
var id = _data.id;
|
||
|
|
var chd = nx.gui.find(this.svcList, "view/content").children;
|
||
|
|
var nod = chd[id - 1];
|
||
|
|
var cmp = nod.svItem;
|
||
|
|
if (cmp) {
|
||
|
|
var data = nx.dt.objClone(cmp.mdata);
|
||
|
|
data.isfirst = false;
|
||
|
|
data.complete = true;
|
||
|
|
data.plot = data.id == 1;
|
||
|
|
cmp.rebind(id - 1, data);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
refreshItemDiff: function refreshItemDiff(_data) {
|
||
|
|
if (_data.flag != 1) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var id = _data.id;
|
||
|
|
var chd = nx.gui.find(this.svcList, "view/content").children;
|
||
|
|
var nod = chd[id - 1];
|
||
|
|
var cmp = nod.svItem;
|
||
|
|
if (cmp) {
|
||
|
|
var data = nx.dt.objClone(cmp.mdata);
|
||
|
|
nx.bridge.createPanel("WndTrainingCampMore", data);
|
||
|
|
nx.bridge.closePanel("WndTrainingCamp");
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// onTouchGoPlot: function(){
|
||
|
|
|
||
|
|
// nx.bridge.createPanel( "WndTrainingCampMore", this.plotData );
|
||
|
|
// nx.bridge.closePanel( "WndTrainingCamp" );
|
||
|
|
|
||
|
|
// },
|
||
|
|
|
||
|
|
// nx.bridge.createPanel( "WndTrainingCampMore", this.mdata );
|
||
|
|
// nx.bridge.closePanel( "WndTrainingCamp" );
|
||
|
|
|
||
|
|
// 重载:关闭前
|
||
|
|
onPreClosed: function onPreClosed() {
|
||
|
|
// this.svcschemeList.rebuild( [] );
|
||
|
|
this.svcList.rebuild([]);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|