def _populate(self): super(MainView, self)._populate() self.__controller = g_customizationController self.__controller.init() self.__controller.events.onCartUpdated += self.__setBottomPanelData self.__controller.events.onMultiplePurchaseProcessed += self.__onPurchaseProcessed self.__controller.events.onCarouselUpdated += self.__setCarouselData self.__controller.events.onSlotUpdated += self.__onSlotUpdated self.__controller.events.onCartEmptied += self.as_hideBuyingPanelS self.__controller.events.onCartFilled += self.as_showBuyingPanelS self.__controller.events.onBonusesUpdated += self.__setBonusData self.__controller.start() self.as_setSlotsPanelDataS( _getSlotsPanelDataVO(self.__controller.slots.currentSlotsData)) g_clientUpdateManager.addCallbacks({ 'stats.credits': self.__setBottomPanelData, 'stats.gold': self.__setBottomPanelData }) g_currentVehicle.onChanged += self.__setHeaderInitData self.__setHeaderInitData() self.__setFooterInitData() self.__setCarouselInitData() self.__setBottomPanelData() self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True))
def closeHelpLayout(self): self.gui.windowsManager.onWindowStatusChanged -= self.__onWindowLoaded nextTick( partial(self.fireEvent, LobbySimpleEvent(LobbySimpleEvent.CLOSE_HELPLAYOUT), EVENT_BUS_SCOPE.LOBBY)) self.as_closeHelpLayoutS()
def _populate(self): super(MainView, self)._populate() g_currentVehicle.onChanged += self.__setHeaderInitData g_customizationController.carousel.updated += self.__setCarouselData g_customizationController.carousel.slots.updated += self.as_updateSlotS g_customizationController.carousel.slots.cart.totalPriceUpdated += self.__setBottomPanelData g_customizationController.carousel.slots.cart.availableMoneyUpdated += self.__setBottomPanelData g_customizationController.carousel.slots.cart.emptied += self.as_hideBuyingPanelS g_customizationController.carousel.slots.cart.filled += self.as_showBuyingPanelS g_customizationController.carousel.slots.bonusPanel.bonusesUpdated += self.__setBonusData g_customizationController.carousel.slots.cart.purchaseProcessed += self.__onPurchaseProcessed Cart.purchaseProcessStarted += self.__onPurchaseProcessStarted self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True)) self.__setHeaderInitData() self.__setBonusData( g_customizationController.carousel.slots.bonusPanel.bonusData) self.as_setSlotsPanelDataS( g_customizationController.carousel.slots.getData()) self.__setCarouselInitData() self.__setBottomPanelData() self.as_setBottomPanelInitDataS({ 'backBtnLabel': _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_BOTTOMPANEL_BACKBTN_LABEL), 'backBtnDescription': _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_BOTTOMPANEL_BACKBTN_DESCRIPTION), 'pricePanelVO': { 'goldIcon': RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_1, 'creditsIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_1 } })
def __premiumBuyRequest(self, days, cost): wasPremium = self.itemsCache.items.stats.isPremium arenaUniqueID = self._arenaUniqueID result = yield PremiumAccountBuyer(days, cost, arenaUniqueID).request() if not result.success and result.auxData and result.auxData.get( 'errStr', '') in ('Battle not in cache', 'Not supported'): arenaUniqueID = 0 result = yield PremiumAccountBuyer(days, cost, arenaUniqueID, withoutBenefits=True).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: if arenaUniqueID and self._premiumBonusesDiff: SystemMessages.pushI18nMessage( '#system_messages:premium/post_battle_premium', type=SystemMessages.SM_TYPE.Information, priority=NotificationPriorityLevel.MEDIUM, **self._premiumBonusesDiff) becomePremium = self.itemsCache.items.stats.isPremium and not wasPremium self.fireEvent( LobbySimpleEvent(LobbySimpleEvent.PREMIUM_BOUGHT, ctx={ 'arenaUniqueID': arenaUniqueID, 'becomePremium': becomePremium })) self.onWindowClose()
def showHelpLayout(self): containerManager = self.app.containerManager dialogsContainer = containerManager.getContainer(VIEW_TYPE.DIALOG) windowsContainer = containerManager.getContainer(VIEW_TYPE.WINDOW) if not dialogsContainer.getViewCount() and not windowsContainer.getViewCount(): self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_showHelpLayoutS()
def showHelpLayout(self): windows = self.gui.windowsManager.findWindows( predicateHelpLayoutAllowedWindow) if not windows: self.gui.windowsManager.onWindowStatusChanged += self.__onWindowLoaded self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_showHelpLayoutS()
def showHelpLayout(self): containerManager = self.app.containerManager dialogsContainer = containerManager.getContainer(ViewTypes.TOP_WINDOW) windowsContainer = containerManager.getContainer(ViewTypes.WINDOW) browserWindowContainer = containerManager.getContainer(ViewTypes.BROWSER) if not dialogsContainer.getViewCount() and not windowsContainer.getViewCount() and not browserWindowContainer.getViewCount(): containerManager.onViewAddedToContainer += self.__onViewAddedToContainer self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_showHelpLayoutS()
def _populate(self): BigWorld.player().resyncDossiers() self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True)) View._populate(self) credits, gold = g_itemsCache.items.stats.money self.as_setCreditsS(credits) self.as_setGoldS(gold) g_playerEvents.onDossiersResync += self.__pe_onDossiersResync g_clientUpdateManager.addCallbacks({ 'stats.gold': self.onGoldUpdate, 'stats.credits': self.onCreditsUpdate, 'cache.mayConsumeWalletResources': self.onGoldUpdate, 'account.attrs': self.onCameraUpdate, 'inventory.1.compDescr': self.onVehiclesUpdate, 'cache.vehsLock': self.__cv_onChanged }) g_itemsCache.onSyncCompleted += self.__pe_onShopResync game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRTypeChanged g_currentVehicle.onChanged += self.__cv_onChanged g_hangarSpace.onSpaceCreate += self.__hs_onSpaceCreate g_eventsCache.onSyncCompleted += self.__onEventsCacheSyncCompleted vehDescr = None vehType = None if g_currentVehicle.isPresent(): vehDescr = CustomizationHelper.getUpdatedDescriptor( g_currentVehicle.item.descriptor) vehType = vehDescr.type VehicleCustomizationModel.setVehicleDescriptor(vehDescr) self.__steps = len(_VEHICLE_CUSTOMIZATIONS) for customization in _VEHICLE_CUSTOMIZATIONS: sectionName = customization['sectionName'] interface = customization['interface']( sectionName, vehDescr.type.customizationNationID, customization['type'], customization['position']) interface.onDataInited += self.__ci_onDataInited interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed interface.onCurrentItemChange += self.__ci_onCurrentItemChanged self.__interfaces[sectionName] = interface interface.updateSlotsPosition(vehDescr) interface.setFlashObject(self.flashObject, setScript=False) interface.fetchCurrentItem(vehDescr) interface.invalidateViewData(vehType) if not self.__steps: self.__finishInitData() self.setupContextHints(TUTORIAL.CUSTOMIZATION) return
def _showWaiting(cls, waiting): view = Waiting.getWaitingView() if view is not None: view.showS(i18n.makeString('#waiting:%s' % waiting.message), cls._hasOverlapsUIWaiting() or waiting.overlapsUI) Waiting.__isVisible = True view.setCallback(waiting.interrupt) from gui.shared.events import LobbySimpleEvent from gui.shared import EVENT_BUS_SCOPE view.fireEvent(LobbySimpleEvent(LobbySimpleEvent.WAITING_SHOWN), scope=EVENT_BUS_SCOPE.LOBBY) return
def _externalSwitchToViewWithCtx(ctx, *args, **kwargs): ctx.update({ 'anchordAsObject': True, 'instantly': True, 'args': args, 'kwargs': kwargs }) g_eventBus.handleEvent( LobbySimpleEvent(LobbySimpleEvent.SWITCH_NEW_YEAR_VIEW, ctx), EVENT_BUS_SCOPE.LOBBY)
def switchNewYearView(anchorName, aliasName=None): kwargs = {'forceShowMainView': True} ctx = { 'anchorName': anchorName, 'viewAlias': aliasName, 'instantly': True, 'kwargs': kwargs } g_eventBus.handleEvent( LobbySimpleEvent(LobbySimpleEvent.SWITCH_NEW_YEAR_VIEW, ctx), EVENT_BUS_SCOPE.LOBBY)
def showHelpLayout(self): containerManager = self.app.containerManager topSubViewContainer = containerManager.getContainer(ViewTypes.LOBBY_TOP_SUB) dialogsContainer = containerManager.getContainer(ViewTypes.TOP_WINDOW) windowsContainer = containerManager.getContainer(ViewTypes.WINDOW) browserWindowContainer = containerManager.getContainer(ViewTypes.BROWSER) overlayContainer = containerManager.getContainer(ViewTypes.OVERLAY) unboundWindows = self.gui.windowsManager.findWindows(predicateNotEmptyWindow) if not dialogsContainer.getViewCount() and not windowsContainer.getViewCount() and not browserWindowContainer.getViewCount() and not overlayContainer.getViewCount() and not unboundWindows and not topSubViewContainer.getViewCount(): containerManager.onViewAddedToContainer += self.__onViewAddedToContainer self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_showHelpLayoutS()
def show(message, isSingle=False, interruptCallback=lambda: None): BigWorld.Screener.setEnabled(False) if not (isSingle and message in Waiting.__waitingStack): Waiting.__waitingStack.append(message) view = Waiting.getWaitingView() if view is not None: view.showS(i18n.makeString('#waiting:%s' % message)) Waiting.__isVisible = True view.setCallback(interruptCallback) from gui.shared.events import LobbySimpleEvent from gui.shared import EVENT_BUS_SCOPE view.fireEvent(LobbySimpleEvent(LobbySimpleEvent.WAITING_SHOWN), scope=EVENT_BUS_SCOPE.LOBBY)
def __premiumBuyRequest(self, days, cost): wasPremium = g_itemsCache.items.stats.isPremium result = yield PremiumAccountBuyer(days, cost, self._arenaUniqueID).request() if len(result.userMsg): SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: becomePremium = g_itemsCache.items.stats.isPremium and not wasPremium self.onWindowClose() self.fireEvent( LobbySimpleEvent(LobbySimpleEvent.PREMIUM_BOUGHT, ctx={ 'arenaUniqueID': self._arenaUniqueID, 'becomePremium': becomePremium }))
def _dispose(self): self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, False)) self.__resetPreviewMode() for interface in self.__interfaces.itervalues(): interface.destroy() interface.onDataInited -= self.__ci_onDataInited interface.onCustomizationChangeSuccess -= self.__ci_onCustomizationChangeSuccess interface.onCustomizationChangeFailed -= self.__ci_onCustomizationChangeFailed interface.onCustomizationDropSuccess -= self.__ci_onCustomizationDropSuccess interface.onCustomizationDropFailed -= self.__ci_onCustomizationDropFailed interface.onCurrentItemChange -= self.__ci_onCurrentItemChanged self.__interfaces.clear() self.__onceDataInited = False g_itemsCache.onSyncCompleted -= self.__pe_onShopResync game_control.g_instance.igr.onIgrTypeChanged -= self.__onIGRTypeChanged g_currentVehicle.onChanged -= self.__cv_onChanged g_hangarSpace.onSpaceCreate -= self.__hs_onSpaceCreate g_eventsCache.onSyncCompleted -= self.__onEventsCacheSyncCompleted g_playerEvents.onDossiersResync -= self.__pe_onDossiersResync g_clientUpdateManager.removeObjectCallbacks(self) CustomizationHelper.clearStoredCustomizationData() View._dispose(self)
def __upgradeToPremium(self, days): Waiting.show('loadStats') attrs = yield StatsRequester().getAccountAttrs() isPremium = account_helpers.isPremiumAccount(attrs) success = yield StatsRequester().upgradeToPremium(days) if success: premiumCost = yield StatsRequester().getPremiumCost() if premiumCost: if isPremium: successMessage = SYSTEM_MESSAGES.PREMIUM_CONTINUESUCCESS else: successMessage = SYSTEM_MESSAGES.PREMIUM_BUYINGSUCCESS SystemMessages.pushI18nMessage( successMessage, days, formatPrice((0, premiumCost[int(days)])), type=SystemMessages.SM_TYPE.PurchaseForGold) self.fireEvent(LobbySimpleEvent( LobbySimpleEvent.UPDATE_TANK_PARAMS), scope=EVENT_BUS_SCOPE.LOBBY) else: self.__systemErrorMessage(SYSTEM_MESSAGES.PREMIUM_SERVER_ERROR, days, SystemMessages.SM_TYPE.Error) Waiting.hide('loadStats')
def closeHelpLayout(self): self.app.containerManager.onViewAddedToContainer -= self.__onViewAddedToContainer self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.CLOSE_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_closeHelpLayoutS()
def highlightParams(self, type): self.fireEvent( LobbySimpleEvent(LobbySimpleEvent.HIGHLIGHT_TANK_PARAMS, {'type': type}), EVENT_BUS_SCOPE.LOBBY)
def showLootBox(lootBoxType, category=''): ctx = {'lootBoxType': lootBoxType, 'category': category} g_eventBus.handleEvent( LobbySimpleEvent(LobbySimpleEvent.SHOW_LOOT_BOX_VIEW, ctx), EVENT_BUS_SCOPE.LOBBY)
def __unlockOverlays(): ctx = {'source': _LOCK_SOURCE_NAME} g_eventBus.handleEvent( LobbySimpleEvent(LobbySimpleEvent.UNLOCK_OVERLAY_SCREEN, ctx), EVENT_BUS_SCOPE.LOBBY)
def closeHelpLayout(self): self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.CLOSE_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY) self.as_closeHelpLayoutS()