const GuildBatMod = require("guildbat.mod"); const BridgeWindow = require( "bridge.window" ); const GuildwarEvent = require("guildwar_event"); const NxExpand = require("nx.fx.sv.expand"); const 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 () { this.mod = GuildBatMod.getInstance(); this.bindGEvent(GuildwarEvent.UpdateMateViewsEvent,this.updateMateViews.bind(this)); }, updateMateViews(data){ let match_info = data.match_info; //篩選自己的工會 let my_gud = null; let myRole = RoleController.getInstance().getRoleVo(); for(let 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; } let 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() { this.mod.requestGuildWarBattleList(); nx.gui.setString(this.tipsNd,"",game.configs.guild_war_data.data_const.time_desc.desc); }, onPreClosed() { this.viewList.rebuild([]); }, });