def __init__(self): super(BWBattleChannelFindCriteria, self).__init__() self.__ids = [] for item in BATTLE_CHANNEL.ALL: clientID = channel_num_gen.getClientID4BattleChannel(item.name) if clientID: self.__ids.append(clientID) clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.SQUAD) if clientID: self.__ids.append(clientID) clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.EVENT_SQUAD) if clientID: self.__ids.append(clientID)
def setSquadTeamReadyInCarousel(self, prbType, isTeamReady): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR("Client ID not found", "setSquadTeamReadyInCarousel", prbType) return readyData = self.__getReadyPrbData(isTeamReady) g_eventBus.handleEvent( events.ChannelManagementEvent( clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {"key": "readyData", "value": readyData, "isShowByReq": False, "showIfClosed": True}, ), scope=EVENT_BUS_SCOPE.LOBBY, ) g_eventBus.handleEvent( events.ChannelManagementEvent( clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, { "key": "tooltipData", "value": self.__getTooltipPrbData( CHAT.CHANNELS_SQUADREADY_TOOLTIP if isTeamReady else CHAT.CHANNELS_SQUADNOTREADY_TOOLTIP ), "isShowByReq": False, "showIfClosed": True, }, ), scope=EVENT_BUS_SCOPE.LOBBY, )
def addSquadToCarousel(self, isReady = False): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.SQUAD) if not clientID: LOG_ERROR('Client ID not found', 'addSquadToCarousel') return currCarouselItemCtx = _defCarouselItemCtx._replace(label=CHAT.CHANNELS_SQUAD, icon=RES_ICONS.MAPS_ICONS_MESSENGER_SQUAD_ICON, criteria={POP_UP_CRITERIA.VIEW_ALIAS: PREBATTLE_ALIASES.SQUAD_WINDOW_PY}, openHandler=self.showSquadWindow, readyData=self.__getReadyPrbData(isReady), tooltipData=self.__getTooltipPrbData(CHAT.CHANNELS_SQUADREADY_TOOLTIP if isReady else CHAT.CHANNELS_SQUADNOTREADY_TOOLTIP)) self._handleAddPreBattleRequest(clientID, currCarouselItemCtx._asdict())
def _showUnitProgress(self, prbType, show): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR("Client ID not found", "_showUnitStatus", prbType) return self._fireEvent( events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_SHOW, {"show": show}) )
def setUnitProgressInCarousel(self, prbType, isInProgress): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'setUnitProgressInCarousel', prbType) return self._fireEvent(events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {'key': 'isInProgress', 'value': isInProgress, 'isShowByReq': isInProgress, 'showIfClosed': True}))
def setUnitProgressInCarousel(self, prbType, isInProgress): if prbType in PREBATTLE_TYPE.SQUAD_PREBATTLES: LOG_DEBUG('No unit progress for squad.') return clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'setUnitProgressInCarousel', prbType) return self._fireEvent(events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {'key': 'isInProgress', 'value': isInProgress, 'isShowByReq': isInProgress, 'showIfClosed': True}))
def addSquadToCarousel(): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.SQUAD) if not clientID: LOG_ERROR('Client ID not found', 'addSquadToCarousel') return g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_ADD, {'label': CHAT.CHANNELS_SQUAD, 'canClose': False, 'isNotified': False, 'icon': '../maps/icons/messenger/squad_icon.png', 'order': channel_num_gen.getOrder4Prebattle(), 'criteria': {POP_UP_CRITERIA.VIEW_ALIAS: guiFactory.getAliasByEvent(events.ShowWindowEvent.SHOW_SQUAD_WINDOW)}, 'openHandler': _showSquadWindow}), scope=EVENT_BUS_SCOPE.LOBBY)
def setUnitProgressInCarousel(self, prbType, isInProgress): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR("Client ID not found", "setUnitProgressInCarousel", prbType) return self._fireEvent( events.ChannelManagementEvent( clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {"key": "isInProgress", "value": isInProgress, "isShowByReq": isInProgress, "showIfClosed": True}, ) )
def addSpecBattleToCarousel(self, prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'addSpecBattleToCarousel') return if prbType is PREBATTLE_TYPE.CLAN: label = CHAT.CHANNELS_CLAN elif prbType is PREBATTLE_TYPE.TOURNAMENT: label = CHAT.CHANNELS_TOURNAMENT else: LOG_ERROR('Prebattle type is not valid', prbType) return currCarouselItemCtx = _defCarouselItemCtx._replace(label=label, criteria={POP_UP_CRITERIA.VIEW_ALIAS: PREBATTLE_ALIASES.BATTLE_SESSION_ROOM_WINDOW_PY}, openHandler=self.showBattleSessionWindow) self._handleAddPreBattleRequest(clientID, currCarouselItemCtx._asdict())
def addCompanyToCarousel(): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.COMPANY) if not clientID: LOG_ERROR('Client ID not found', 'addCompanyToCarousel') return else: g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_ADD, {'label': CHAT.CHANNELS_TEAM, 'canClose': False, 'isNotified': False, 'icon': None, 'order': channel_num_gen.getOrder4Prebattle(), 'criteria': {POP_UP_CRITERIA.VIEW_ALIAS: guiFactory.getAliasByEvent(events.ShowWindowEvent.SHOW_COMPANY_WINDOW)}, 'openHandler': _showCompanyWindow}), scope=EVENT_BUS_SCOPE.LOBBY) return
def setSquadTeamReadyInCarousel(self, prbType, isTeamReady): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'setSquadTeamReadyInCarousel', prbType) return readyData = self.__getReadyPrbData(isTeamReady) g_eventBus.handleEvent(events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {'key': 'readyData', 'value': readyData, 'isShowByReq': False, 'showIfClosed': True}), scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.handleEvent(events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {'key': 'tooltipData', 'value': self.__getTooltipPrbData(CHAT.CHANNELS_SQUADREADY_TOOLTIP if isTeamReady else CHAT.CHANNELS_SQUADNOTREADY_TOOLTIP), 'isShowByReq': False, 'showIfClosed': True}), scope=EVENT_BUS_SCOPE.LOBBY)
def setUnitProgressInCarousel(self, prbType, isInProgress): if prbType in (PREBATTLE_TYPE.SQUAD, PREBATTLE_TYPE.FALLOUT): LOG_DEBUG("No unit progress for squad.") return clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR("Client ID not found", "setUnitProgressInCarousel", prbType) return self._fireEvent( events.ChannelManagementEvent( clientID, events.ChannelManagementEvent.REQUEST_TO_CHANGE, {"key": "isInProgress", "value": isInProgress, "isShowByReq": isInProgress, "showIfClosed": True}, ) )
def addUnitToCarousel(): from gui.Scaleform.locale.CYBERSPORT import CYBERSPORT clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.UNIT) if not clientID: LOG_ERROR('Client ID not found', 'addUnitToCarousel') return else: g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_ADD, {'label': CYBERSPORT.WINDOW_TITLE, 'canClose': False, 'isNotified': False, 'icon': None, 'order': channel_num_gen.getOrder4Prebattle(), 'criteria': {POP_UP_CRITERIA.VIEW_ALIAS: guiFactory.getAliasByEvent(events.ShowWindowEvent.SHOW_UNIT_WINDOW)}, 'openHandler': showUnitWindow}), scope=EVENT_BUS_SCOPE.LOBBY) return
def addUnitToCarousel(self, prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'addUnitToCarousel') return if prbType in (PREBATTLE_TYPE.SORTIE, PREBATTLE_TYPE.FORT_BATTLE): from gui.Scaleform.locale.FORTIFICATIONS import FORTIFICATIONS from gui.Scaleform.genConsts.FORTIFICATION_ALIASES import FORTIFICATION_ALIASES label = FORTIFICATIONS.SORTIE_INTROVIEW_TITLE criteria = {POP_UP_CRITERIA.VIEW_ALIAS: FORTIFICATION_ALIASES.FORT_BATTLE_ROOM_WINDOW_ALIAS} else: from gui.Scaleform.locale.CYBERSPORT import CYBERSPORT label = CYBERSPORT.WINDOW_TITLE criteria = {POP_UP_CRITERIA.VIEW_ALIAS: CYBER_SPORT_ALIASES.CYBER_SPORT_WINDOW_PY} currCarouselItemCtx = _defCarouselItemCtx._replace(label=label, criteria=criteria, viewType=ViewTypes.WINDOW, openHandler=lambda : self.showUnitWindow(prbType)) self._handleAddPreBattleRequest(clientID, currCarouselItemCtx._asdict())
def addSpecBattleToCarousel(prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'addSpecBattleToCarousel') return else: if prbType is PREBATTLE_TYPE.CLAN: label = CHAT.CHANNELS_CLAN elif prbType is PREBATTLE_TYPE.TOURNAMENT: label = CHAT.CHANNELS_TOURNAMENT else: LOG_ERROR('Prebattle type is not valid', prbType) return g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_ADD, {'label': label, 'canClose': False, 'isNotified': False, 'icon': None, 'order': channel_num_gen.getOrder4Prebattle(), 'criteria': {POP_UP_CRITERIA.VIEW_ALIAS: guiFactory.getAliasByEvent(events.ShowWindowEvent.SHOW_BATTLE_SESSION_WINDOW)}, 'openHandler': _showBattleSessionWindow}), scope=EVENT_BUS_SCOPE.LOBBY) return
def _showUnitProgress(self, prbType, show): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', '_showUnitStatus', prbType) return self._fireEvent(events.ChannelManagementEvent(clientID, events.ChannelManagementEvent.REQUEST_TO_SHOW, {'show': show}))
def removeSquadFromCarousel(self): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.SQUAD) if not clientID: LOG_ERROR('Client ID not found', '_removeSquadFromCarousel') return self._handleRemoveRequest(clientID)
def removeCompanyFromCarousel(self): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.COMPANY) if not clientID: LOG_ERROR('Client ID not found', 'removeCompanyFromCarousel') return self._handleRemoveRequest(clientID)
def __init__(self, prbName = 'prebattle'): super(BasePrebattleRoomView, self).__init__() self.__prbName = prbName self.__clientID = channel_num_gen.getClientID4Prebattle(self.prbFunctional.getEntityType())
def removeSpecBattleFromCarousel(self, prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', '_removeSpecBattleFromCarousel') return self._handleRemoveRequest(clientID)
def removeSpecBattleFromCarousel(self, prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR("Client ID not found", "_removeSpecBattleFromCarousel") return self._handleRemoveRequest(clientID)
def _tryToSetTrusted(window, storedData): if window.getProtoType() == PROTO_TYPE.BW_CHAT2 and window.getClientID() == getClientID4Prebattle(PREBATTLE_TYPE.TRAINING): storedData.setTrusted(True)
def removeSpecBattleFromCarousel(prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', '_removeSpecBattleFromCarousel') return g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_REMOVE), scope=EVENT_BUS_SCOPE.LOBBY)
def __init__(self, prbName = 'prebattle'): super(PrebattleWindow, self).__init__() self.__prbName = prbName self.__clientID = channel_num_gen.getClientID4Prebattle(self.prbFunctional.getPrbType())
def __getClientIDForCompany(self): return channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.COMPANY)
def __init__(self, prbName='prebattle'): super(PrebattleWindow, self).__init__() self.__prbName = prbName self.__clientID = channel_num_gen.getClientID4Prebattle( self.prbEntity.getEntityType())
def __init__(self, prbName='prebattle'): super(PrebattleWindow, self).__init__() self.__prbName = prbName self.__clientID = channel_num_gen.getClientID4Prebattle( self.prbFunctional.getPrbType())
def removeSquadFromCarousel(): clientID = channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.SQUAD) if not clientID: LOG_ERROR('Client ID not found', '_removeSquadFromCarousel') return g_eventBus.handleEvent(ChannelManagementEvent(clientID, ChannelManagementEvent.REQUEST_TO_REMOVE), scope=EVENT_BUS_SCOPE.LOBBY)
def removeUnitFromCarousel(self, prbType): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'removeUnitFromCarousel', prbType) return self._handleRemoveRequest(clientID)
def __getClientID(self): return channel_num_gen.getClientID4Prebattle(PREBATTLE_TYPE.EXTERNAL)
def removeUnitFromCarousel(self, prbType, closeWindow=True): clientID = channel_num_gen.getClientID4Prebattle(prbType) if not clientID: LOG_ERROR('Client ID not found', 'removeUnitFromCarousel', prbType) return self.__handleRemoveRequest(clientID, closeWindow=closeWindow)
def getClientID(self): return channel_num_gen.getClientID4Prebattle(self.getPrbType())
def __init__(self, prbName='prebattle'): super(BasePrebattleRoomView, self).__init__() self.__prbName = prbName self.__clientID = channel_num_gen.getClientID4Prebattle( self.prbFunctional.getEntityType())