def __onEventBtnClick(self, args): label = args.get('lootBoxType', None) shared_events.showLootBoxEntry(label) self.__flowLogger.logOpen( currentObject=NewYearNavigation.getCurrentObject()) self.destroyWindow() return
def __onPreviewStyleButton(self, *_): paramDict = { 'instantly': True, 'withFade': True, 'viewAlias': ViewAliases.REWARDS_VIEW, 'objectName': NewYearNavigation.getCurrentObject(), 'tabName': self.__yearName, 'collection': self.__collectionName, 'forceShowMainView': True } NewYearNavigation.switchTo(None, True) def _backCallback(): if not self.__nyController.isEnabled(): event_dispatcher.showHangar() else: NewYearNavigation.switchFromStyle(**paramDict) showStylePreview(getVehiclePreviewID(self.__currentStyle, self.__yearName, self.__collectionName), self.__currentStyle, self.__currentStyle.getDescription(), backCallback=_backCallback, backBtnDescrLabel=backport.text( R.strings.ny.collectionsReward.backLabel())) return
def __onInfoBtnClick(self): self.__flowLogger.logInfoClick( source=self.__currentView, albumTab=self._tabCache.getCurrentYear(), rewardTab=self._tabCache.getRewardsTab(), selectedObject=NewYearNavigation.getCurrentObject()) NewYearNavigation.showInfoView(showDefaultTabForced=True)
def __updateData(self, model): model.setLobbyMode(self._lobbyMode) model.setUserLanguage(str(getLanguageCode()).upper()) model.setBonusValue(CreditsBonusHelper.getBonusInPercents()) model.setIsRomanNumbersAllowed(IS_ROMAN_NUMBERS_ALLOWED) model.setIsEnabled( NewYearNavigation.getCurrentObject() != CustomizationObjects.FIR)
def externalSwitchToGiftSystemView(*args, **kwargs): ctx = { 'anchorName': NewYearNavigation.getCurrentObject() or CustomizationObjects.FIR, 'viewAlias': ViewAliases.GIFT_SYSTEM_VIEW } _externalSwitchToViewWithCtx(ctx, *args, **kwargs)
def externalSwitchToVehiclesView(*args, **kwargs): ctx = { 'anchorName': NewYearNavigation.getCurrentObject() or CustomizationObjects.FIR, 'viewAlias': ViewAliases.VEHICLES_VIEW } _externalSwitchToViewWithCtx(ctx, *args, **kwargs)
def onHighlightComponentAdded(self, highlightComponent): addedNavigationName = ANCHOR_TO_OBJECT.get( getattr(highlightComponent.owner, 'anchorName', None)) if addedNavigationName and addedNavigationName == NewYearNavigation.getCurrentObject( ): highlightComponent.owner.entityGameObject.createComponent( CurrentCameraObject) return
def __onObjectStateChanged(self): currentObject = NewYearNavigation.getCurrentObject() self._lobbyMode = currentObject is None with self.viewModel.transaction() as model: self.__updateData(model) self.__updateLevel(model) self.__updateActiveState(model) self.__soundRTPCController.setCurrentLocation(currentObject) return
def _goBack(self): if not self._navigationHistory.isEmpty: backPageAlias = self._navigationHistory.getLast() if backPageAlias: self.__flowLogger.logBackClick( view=VIEW_ALIAS_TO_MENU_NAME.get(backPageAlias), albumTab=self._tabCache.getCurrentYear(), rewardTab=self._tabCache.getRewardsTab(), selectedObject=NewYearNavigation.getCurrentObject()) super(NyInfoView, self)._goBack()
def __onWindowClose(self): if self.__isWaitingToHide: return if not self.__stopVideo(): g_eventBus.handleEvent(events.LootboxesEvent( events.LootboxesEvent.ON_MAIN_VIEW_CLOSED), scope=EVENT_BUS_SCOPE.LOBBY) self.__flowlogger.logCloseClick( currentObject=NewYearNavigation.getCurrentObject(), currentView=NewYearNavigation.getCurrentViewName()) self.destroyWindow()
def __onCameraEntityUpdated(self, event): ctx = event.ctx state = ctx['state'] entityId = ctx['entityId'] enabled = None if NewYearNavigation.getCurrentObject() is not None: enabled = True elif state == CameraMovementStates.FROM_OBJECT: enabled = not self.__isHangarVehicleEntity(entityId) elif state == CameraMovementStates.ON_OBJECT: enabled = self.__isHangarVehicleEntity(entityId) if enabled is not None and enabled != self.enabled: self.setEnable(enabled) return
def __onMenuItemSelected(self, args): menuName = args['view'] viewAlias = _NAVIGATION_ALIAS_VIEWS[menuName] self._navigationHistory.clear() self.__topMenuLogger.logClick(menuName) self.__flowLogger.logTabSelect( source=self.__currentView, view=menuName, albumTab=self._tabCache.getCurrentYear(), rewardTab=self._tabCache.getRewardsTab(), selectedObject=NewYearNavigation.getCurrentObject(), previousObject=NewYearNavigation.getPreviousObject()) with self.viewModel.transaction() as tx: tx.setStartIndexMenu(self.__tabsController.tabOrderKey(menuName)) self.__soundsManager.playEvent(NewYearSoundEvents.TAB_BAR_CLICK) self._goToByViewAlias(viewAlias, saveHistory=False)
def __onUpdate(self, *_, **__): if self._getNavigationAlias() != NewYearNavigation.getCurrentViewName( ): return newObject = NewYearNavigation.getCurrentObject() if self.__currentObject == newObject: return self.__currentObject = newObject with self.viewModel.transaction() as model: self.__updateSlots(fullUpdate=True, model=model) self.__clearPopovers() g_eventBus.handleEvent(events.NewYearEvent( events.NewYearEvent.SELECT_SIDEBAR_TAB_OUTSIDE, ctx={ 'menuName': NyWidgetTopMenu.GLADE, 'tabName': newObject }), scope=EVENT_BUS_SCOPE.LOBBY)
def __onSelectedDecoration(self): if not self.viewModel.getHasDecoration(): self.__craftCtrl.setSettings(isMegaOn=True) self.__flowLogger.logBigDecorationSlotClick( NewYearNavigation.getCurrentObject()) NewYearNavigation.switchToView(ViewAliases.CRAFT_VIEW) self.destroyWindow() return else: toyID = INVALID_TOY_ID if self.viewModel.getSelected( ) else self.viewModel.slot.getToyID() toy = self.__itemsCache.items.festivity.getToys().get(toyID) if toy is not None: isPureToy = toy.getPureCount() > 0 points = toy.getAtmosphere(isPureToy, self.__isPureSlot) toyUsage = TOY_SLOT_USAGE.PURE if isPureToy else TOY_SLOT_USAGE.USED else: points = 0 toyUsage = TOY_SLOT_USAGE.USED result = yield self._nyController.hangToy(toyID, self.__slotID, toyUsage) if result.success and self.viewStatus == ViewStatus.LOADED: g_eventBus.handleEvent(events.NewYearEvent( events.NewYearEvent.ON_TOY_INSTALLED, ctx={ 'toyID': toyID, 'slotID': self.__slotID, 'atmoshereBonus': points }), scope=EVENT_BUS_SCOPE.LOBBY) self.__isSelected = toyID != INVALID_TOY_ID with self.viewModel.transaction() as tx: tx.setSelected(self.__isSelected) self.__updateTitle(tx) if self.__isSelected: if self.__slotType in ToyTypes.MEGA: NewYearSoundsManager.playEvent( NewYearSoundEvents.ADD_TOY_MEGA) else: tx.slot.setIsNew(True) self.destroyWindow() return
def initialize(self, *args, **kwargs): super(NyGladeView, self).initialize(*args, **kwargs) self.__selectableLogic.init() self.__currentObject = NewYearNavigation.getCurrentObject() self._itemsCache.onSyncCompleted += self.__onSyncCompleted self.__settingsCore.onSettingsChanged += self.__onSettingsChanged g_eventBus.addListener(events.NewYearEvent.ON_SIDEBAR_SELECTED, self.__onSideBarSelected, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.NewYearEvent.ON_TOY_INSTALLED, self.__onToyInstalled, scope=EVENT_BUS_SCOPE.LOBBY) with self.viewModel.transaction() as model: self.__updateSlots(fullUpdate=True, model=model) self.__updateIntro(force=kwargs.get('forceShowIntro', False), model=model) self.__updateLootboxEntryPoint() model.intro.region.setRealm(CURRENT_REALM) model.intro.region.setLanguage(getLanguageCode()) model.atmosphereAnimation.setIsReady(False)
def _initialize(self): super(NyMainWidget, self)._initialize() self.viewModel.onClick += self.__onWidgetClick self._nyController.onDataUpdated += self.__onDataUpdated g_eventBus.addListener(NewYearEvent.ON_SWITCH_VIEW, self.__onSwitchView, EVENT_BUS_SCOPE.LOBBY) NewYearNavigation.onObjectStateChanged += self.__onObjectStateChanged currentObject = NewYearNavigation.getCurrentObject() self._lobbyMode = currentObject is None self.__soundRTPCController = SoundRTPCController() self.__soundRTPCController.init(currentObject) self.__soundRTPCController.setLevelAtmosphere( self._itemsCache.items.festivity.getMaxLevel()) with self.viewModel.transaction() as model: self.__updateData(model) self.__updateLevel(model) self.__updateActiveState(model) model.setIsExtendedAnim(not isMemoryRiskySystem()) ClientSelectableCameraObject.switchCamera() self.viewModel.setIsInited(True) return
def __onBuyBtnClick(self): shared_events.showLootBoxBuyWindow() self.__flowLogger.logBuy( currentObject=NewYearNavigation.getCurrentObject()) self.destroyWindow()
def onSelect(self): if NewYearNavigation.getCurrentObject() is not None: NewYearNavigation.closeMainView(False, False) else: super(HangarVehicle, self).onSelect() return
def logClick(self, anchorName): currentObject = NewYearNavigation.getCurrentObject() self.__selectableObjectLogger.logClick(anchorName, currentObject) self.__flowUILogger.logClick(anchorName, currentObject)
def __init__(self, objectName=None): self.__objectName = objectName or NewYearNavigation.getCurrentObject()
def __updateActiveState(model): currentView = NewYearNavigation.getCurrentViewName() model.setIsVisible(currentView != ViewAliases.INFO_VIEW) model.setIsEnabled( currentView != ViewAliases.GLADE_VIEW or NewYearNavigation.getCurrentObject() != CustomizationObjects.FIR)