73 lines
2.1 KiB
JavaScript
73 lines
2.1 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'cababfz1URJzY/QboU0fUOT', 'cmp.guildbat.vswin');
|
|
// Scripts/mod/guild/guildbat/cmp/cmp.guildbat.vswin.js
|
|
|
|
"use strict";
|
|
|
|
var GuildBatMod = require("guildbat.mod");
|
|
var BridgeWindow = require("bridge.window");
|
|
var GuildwarEvent = require("guildwar_event");
|
|
var NxExpand = require("nx.fx.sv.expand");
|
|
var RoleController = require("role_controller");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
viewList: {
|
|
"default": null,
|
|
type: NxExpand
|
|
},
|
|
tagNd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fabView: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
tipsNd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
this.mod = GuildBatMod.getInstance();
|
|
this.bindGEvent(GuildwarEvent.UpdateMateViewsEvent, this.updateMateViews.bind(this));
|
|
},
|
|
updateMateViews: function updateMateViews(data) {
|
|
var match_info = data.match_info;
|
|
//篩選自己的工會
|
|
var my_gud = null;
|
|
var myRole = RoleController.getInstance().getRoleVo();
|
|
for (var i in match_info) {
|
|
if (match_info[i].g_id1 == myRole.gid && match_info[i].g_sid1 == myRole.gsrv_id || match_info[i].g_id2 == myRole.gid && match_info[i].g_sid2 == myRole.gsrv_id) {
|
|
my_gud = match_info[i];
|
|
}
|
|
}
|
|
if (my_gud) {
|
|
if (!this.my_gud_item) {
|
|
this.my_gud_item = cc.instantiate(this.fabView);
|
|
this.my_gud_item.parent = this.tagNd;
|
|
this.my_gud_item.active = true;
|
|
this.my_gud_item.y = 0;
|
|
}
|
|
var cmp = nx.gui.getComponent(this.my_gud_item, "", "cmp.guildbat.item.vs");
|
|
if (cmp) {
|
|
cmp.setData(my_gud);
|
|
}
|
|
}
|
|
nx.gui.setActive(this, "main/empty", !my_gud);
|
|
|
|
//刷新列表
|
|
this.viewList.rebuild(match_info);
|
|
},
|
|
onOpenConfigs: function onOpenConfigs() {
|
|
this.mod.requestGuildWarBattleList();
|
|
nx.gui.setString(this.tipsNd, "", game.configs.guild_war_data.data_const.time_desc.desc);
|
|
},
|
|
onPreClosed: function onPreClosed() {
|
|
this.viewList.rebuild([]);
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |