def _processBackClick(self, ctx=None): if self._previewBackCb: self._previewBackCb() elif self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH and g_currentPreviewVehicle.isPresent( ): event_dispatcher.showResearchView( self._vehicleCD, exitEvent=events.LoadViewEvent( SFViewLoadParams(VIEW_ALIAS.LOBBY_TECHTREE), ctx={'nation': g_currentPreviewVehicle.item.nationName})) elif self._backAlias == VIEW_ALIAS.VEHICLE_PREVIEW: entity = ctx.get('entity', None) if ctx else None if entity: compactDescr = entity.typeDescriptor.type.compactDescr if self.__itemsCache.items.inventory.getItemData( compactDescr) is not None: event_dispatcher.showHangar() else: event_dispatcher.showVehiclePreview( compactDescr, previewAlias=self._previousBackAlias) else: event_dispatcher.showHangar() elif self._backAlias == VIEW_ALIAS.LOBBY_STORE: showShop() else: event = g_entitiesFactories.makeLoadEvent( SFViewLoadParams(self._backAlias), {'isBackEvent': True}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) return
def onBackClick(self): if self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH: event_dispatcher.showResearchView(self._vehicleCD) else: event = g_entitiesFactories.makeLoadEvent(self._backAlias, {'isBackEvent': True}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def __processBackClick(self, ctx=None): if self._previewBackCb: self._previewBackCb() elif self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH: event_dispatcher.showResearchView(self._vehicleCD) elif self._backAlias == VIEW_ALIAS.VEHICLE_PREVIEW: entity = ctx.get('entity', None) if ctx else None if entity: descriptor = entity.typeDescriptor event_dispatcher.showVehiclePreview( descriptor.type.compactDescr, previewAlias=self._previousBackAlias) else: event_dispatcher.showHangar() elif self._backAlias == VIEW_ALIAS.LOBBY_STORE: if isIngameShopEnabled(): showWebShop(url=getBuyVehiclesUrl()) else: showOldShop( ctx={ 'tabId': STORE_TYPES.SHOP, 'component': STORE_CONSTANTS.VEHICLE }) else: event = g_entitiesFactories.makeLoadEvent(self._backAlias, {'isBackEvent': True}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) return
def onSelectModulesClick(self, vehicleID, index): if IS_TUTORIAL_ENABLED: g_loader.stopOnceOnlyHint('VehCompareConfig') event = g_entitiesFactories.makeLoadEvent( VIEW_ALIAS.VEHICLE_COMPARE_MAIN_CONFIGURATOR, ctx={'index': int(index)}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def onSelectModulesClick(self, vehicleID, index): tutorStorage = getTutorialGlobalStorage() if tutorStorage: tutorStorage.setValue(OnceOnlyHints.VEH_COMPARE_CONFIG_HINT, False) event = g_entitiesFactories.makeLoadEvent(SFViewLoadParams( VIEW_ALIAS.VEHICLE_COMPARE_MAIN_CONFIGURATOR), ctx={'index': int(index)}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def _onGoToHangar(url, tags): """ Does exactly what's said in name of function when founds tag written just bellow """ if 'go_to_hangar' in tags: LOG_DEBUG('Browser url has been processed: going to hangar. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent('hangar'), scope=EVENT_BUS_SCOPE.LOBBY) return True return False
def _onGoToHangar(url, tags): if 'go_to_hangar' in tags: LOG_DEBUG('Browser url has been processed: going to hangar. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent( SFViewLoadParams(VIEW_ALIAS.LOBBY_HANGAR)), scope=EVENT_BUS_SCOPE.LOBBY) return BrowserFilterResult(stopNavigation=True) return BrowserFilterResult()
def _onGoToMissions(url, tags): if 'go_to_missions' in tags: LOG_DEBUG('Browser url has been processed: going to missions. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent( SFViewLoadParams(VIEW_ALIAS.LOBBY_MISSIONS)), scope=EVENT_BUS_SCOPE.LOBBY) return BrowserFilterResult(stopNavigation=True, closeBrowser=True) return BrowserFilterResult()
def _onGoToMissions(url, tags): """ Triggers missions interface loading and closes promo screen. """ if 'go_to_missions' in tags: LOG_DEBUG('Browser url has been processed: going to missions. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent('missions'), scope=EVENT_BUS_SCOPE.LOBBY) return BrowserFilterResult(stopNavigation=True, closeBrowser=True) return BrowserFilterResult()
def __onServerSettingChanged(self, diff): if 'strongholdSettings' in diff and 'isStrongholdsEnabled' in diff['strongholdSettings']: enabled = diff['strongholdSettings']['isStrongholdsEnabled'] if not enabled: if self.__tabActive or self.__entityActive: if self.__tabActive: g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent(VIEW_ALIAS.LOBBY_HANGAR), scope=EVENT_BUS_SCOPE.LOBBY) if not self.__unitActive: self.__leave() self.__showPopupDlg()
def __triggerViewLoad(self, alias): if alias == 'browser': event = ShowWindowEvent(ShowWindowEvent.SHOW_BROWSER_WINDOW) else: event = g_entitiesFactories.makeLoadEvent(alias) if event is not None: self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) self.as_setScreenS(alias) else: LOG_ERROR("Passed alias '{1}' is not listed in alias to event dictionary!".format(alias)) return
def _onGoToHangar(url, tags): """ Does exactly what's said in name of function when founds tag written just bellow """ if 'go_to_hangar' in tags: LOG_DEBUG('Browser url has been processed: going to hangar. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent( VIEW_ALIAS.LOBBY_HANGAR), scope=EVENT_BUS_SCOPE.LOBBY) return BrowserFilterResult(stopNavigation=True) return BrowserFilterResult()
def __triggerViewLoad(self, alias): if alias == 'browser': game_control.getChinaCtrl().showBrowser() else: event = g_entitiesFactories.makeLoadEvent(alias) if event is not None: self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) else: LOG_ERROR('Invalid subview alias', alias) return self.as_setScreenS(alias)
def _onGoToPersonalMissions(url, tags): """ Triggers personal missions interface loading and closes promo screen. """ if 'go_to_campaigns' in tags: LOG_DEBUG( 'Browser url has been processed: going to personal missions. Url: ', url) g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent( VIEW_ALIAS.LOBBY_PERSONAL_MISSIONS), scope=EVENT_BUS_SCOPE.LOBBY) return BrowserFilterResult(stopNavigation=True, closeBrowser=True) return BrowserFilterResult()
def __triggerViewLoad(self, alias): if alias == self.TABS.BROWSER: self.chinaCtrl.showBrowser() else: if alias == self.TABS.ACADEMY: self.as_removeButtonCounterS(alias) event = g_entitiesFactories.makeLoadEvent(alias) if event is not None: self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) else: LOG_ERROR('Invalid subview alias', alias) return self.__setCurrentScreen(alias) return
def __onServerSettingChanged(self, diff): """ Check isStrongholdsEnabled flag for change. If true - leave from Strongholds Tab(if active) and if unit not created - close battle room window and show info popup """ if 'strongholdSettings' in diff and 'isStrongholdsEnabled' in diff['strongholdSettings']: enabled = diff['strongholdSettings']['isStrongholdsEnabled'] if not enabled: if self.__tabActive or self.__entityActive: if self.__tabActive: g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent(VIEW_ALIAS.LOBBY_HANGAR), scope=EVENT_BUS_SCOPE.LOBBY) if not self.__unitActive: self.__leave() self.__showPopupDlg()
def __processBackClick(self, ctx=None): if self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH: event_dispatcher.showResearchView(self._vehicleCD) elif self._backAlias == VIEW_ALIAS.VEHICLE_PREVIEW: entity = ctx.get('entity', None) if ctx else None if entity: descriptor = entity.typeDescriptor event_dispatcher.showVehiclePreview( descriptor.type.compactDescr, previewAlias=self._previousBackAlias) else: event_dispatcher.showHangar() else: event = g_entitiesFactories.makeLoadEvent(self._backAlias, {'isBackEvent': True}) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY) return
def closeView(self): event = g_entitiesFactories.makeLoadEvent( SFViewLoadParams(VIEW_ALIAS.LOBBY_HANGAR)) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def onBackClick(self): event = g_entitiesFactories.makeLoadEvent(self.__backAlias) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def __clanClickedHandler(): event = g_entitiesFactories.makeLoadEvent( SFViewLoadParams(VIEW_ALIAS.LOBBY_STRONGHOLD)) g_eventBus.handleEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def doJoin(): from gui.Scaleform.framework import g_entitiesFactories g_eventBus.handleEvent( g_entitiesFactories.makeLoadEvent('missions'), scope=EVENT_BUS_SCOPE.LOBBY)
def closeView(self, forcedBackAliace=None): event = g_entitiesFactories.makeLoadEvent(forcedBackAliace or self.__backAlias) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)
def __showElenPopupDlg(self): yield DialogsInterface.showI18nInfoDialog('elenDisabled') g_eventBus.handleEvent(g_entitiesFactories.makeLoadEvent( VIEW_ALIAS.LOBBY_HANGAR), scope=EVENT_BUS_SCOPE.LOBBY)
def onBackClick(self): if self.__backAlias == VIEW_ALIAS.LOBBY_RESEARCH: event_dispatcher.showResearchView(self.__vehicleCD) else: event = g_entitiesFactories.makeLoadEvent(self.__backAlias) self.fireEvent(event, scope=EVENT_BUS_SCOPE.LOBBY)