68 lines
2.7 KiB
JavaScript
68 lines
2.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'a50edInDc9B2a8xZflkVmfm', 'cmp.guildbat.logwin');
|
|
// Scripts/mod/guild/guildbat/cmp/cmp.guildbat.logwin.js
|
|
|
|
"use strict";
|
|
|
|
var GuildBatMod = require("guildbat.mod");
|
|
var BridgeWindow = require("bridge.window");
|
|
var GuildwarEvent = require("guildwar_event");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
content: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
logItem: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
var _this$ruins_type, _this$log_type;
|
|
this.mod = GuildBatMod.getInstance();
|
|
this.ruins_type = (_this$ruins_type = {}, _this$ruins_type[0] = nx.text.getKey("GuildBatRuin"), _this$ruins_type[1] = nx.text.getKey("GuildBatFortress"), _this$ruins_type[2] = nx.text.getKey("GuildBatRuin"), _this$ruins_type);
|
|
this.log_type = (_this$log_type = {}, _this$log_type[1] = nx.text.getKey("GuildBatLog2_"), _this$log_type[2] = nx.text.getKey("GuildBatLog3_"), _this$log_type[3] = "", _this$log_type[4] = nx.text.getKey("GuildBatLog4_"), _this$log_type[5] = "", _this$log_type[6] = "", _this$log_type);
|
|
this.bindGEvent(GuildwarEvent.UpdateBatLogEvent, this.updateLogs.bind(this));
|
|
},
|
|
onOpenConfigs: function onOpenConfigs() {
|
|
this.mod.requestBattleLogData();
|
|
},
|
|
updateLogs: function updateLogs(data) {
|
|
nx.bridge.NodeChidrenDestroy(this.content);
|
|
for (var i in data.guild_war_log) {
|
|
var log_data = data.guild_war_log[i];
|
|
var str = ""; //總體描述
|
|
var svid0 = log_data.srv_id2.split('_');
|
|
var svid1 = log_data.srv_id1.split('_');
|
|
var resultT = log_data.int_args[4].val == 2 ? nx.text.getKey("FAil") : nx.text.getKey("Success");
|
|
if (log_data.flag1 == 0) {
|
|
//敵方
|
|
str += cc.js.formatStr(nx.text.getKey("GuildBatLog1_"), nx.text.format("Srever", svid0[1]), log_data.name2, nx.text.format("Srever", svid1[1]), log_data.name1, this.ruins_type[log_data.flag2], resultT);
|
|
} else {
|
|
//我方
|
|
str += cc.js.formatStr(nx.text.getKey("GuildBatLog1_"), nx.text.format("Srever", svid1[1]), log_data.name1, nx.text.format("Srever", svid0[1]), log_data.name2, this.ruins_type[log_data.flag2], resultT);
|
|
}
|
|
|
|
//結算
|
|
for (var v in log_data.int_args) {
|
|
var arg = log_data.int_args[v];
|
|
if (arg.key == 1 || arg.key == 2 || arg.key == 4) {
|
|
str += cc.js.formatStr(this.log_type[arg.key], arg.val);
|
|
}
|
|
}
|
|
var item = cc.instantiate(this.logItem);
|
|
if (item) {
|
|
item.parent = this.content;
|
|
nx.gui.setString(item, "", str);
|
|
}
|
|
}
|
|
},
|
|
onPreClosed: function onPreClosed() {
|
|
nx.bridge.NodeChidrenDestroy(this.content);
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |