def __setVehicleSlot(self, invID): self.onWindowClose() result = yield SetVehicleBranchProcessor(invID, self.__slot.getSlotID()).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: NewYearSoundsManager.playEvent(NewYearSoundEvents.TANKS_SET)
def __onStopPrintSound(self): self.__stopCounter = self.__stopCounter + 1 eventCounter = self.__getEventCounter() if not self.__stopped and self.__stopCounter >= eventCounter: self.__stopped = True NewYearSoundsManager.playEvent( NewYearSoundEvents.CRAFT_MONITOR_PRINTING_STOP)
def _finalize(self): NewYearSoundsManager.playEvent( NewYearSoundEvents.AWARD_STYLE_SCREEN_EXIT) setOverlayHangarGeneral(False) super(NewYearStyleRewardView, self)._finalize() self.__rewards = None self.viewModel.onClose -= self.__onClose self._nyController.onStateChanged -= self.__onEventStateChanged return
def __onSettingChanged(self, settingData): if not self.__isBlockActive(): return settingData = int(settingData.get('setting', RANDOM_TYPE)) self._viewModel.setCurrentSettingIndex(settingData) NewYearSoundsManager.playEvent( NewYearSoundEvents.CRAFT_CHANGE_TOYS_SETTING) self.__setSoundStyles() self._raiseOnDataChanged()
def __playTransitionSound(cls, objectName): if cls.getCurrentViewName() not in (ViewAliases.GLADE_VIEW, ViewAliases.CELEBRITY_VIEW): return if objectName == AdditionalCameraObject.CELEBRITY and not cls._celebrityController.isChallengeVisited: eventName = NewYearSoundEvents.CELEBRITY_INTRO else: eventName = _SWITCH_OBJECT_SOUND_EVENTS.get(objectName) if eventName: NewYearSoundsManager.playEvent(eventName)
def onMouseClick(self): anchorName = self.anchorName if self.enabled and anchorName and anchorName != self.__customizableObjectsMgr.getCurrentCameraAnchor(): self.logClick(anchorName) NewYearSoundsManager.playEvent(NewYearSoundEvents.ENTER_CUSTOME) NewYearNavigation.switchByAnchorName(anchorName) for cameraObject in ClientSelectableCameraObject.allCameraObjects: if cameraObject.state != CameraMovementStates.FROM_OBJECT: cameraObject.onDeselect(None) return
def __onTypeChanged(self, typeData): if not self.__isBlockActive(): return else: selectedType = typeData.get('type', RANDOM_TYPE) groupName = typeData.get('groupName', None) self._viewModel.setSelectedType(selectedType) self._viewModel.setCurrentCategory(groupName) NewYearSoundsManager.playEvent( NewYearSoundEvents.CRAFT_CHANGE_TOY_TYPE) self._raiseOnDataChanged() return
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 updateData(self): isMegaDeviceTurnedOn = self._nodesHolder.megaDevice.getState() in MegaDeviceState.ACTIVATED toyTypeIdx, toySettingIdx, toyRankIdx, _ = self._nodesHolder.regularToysBlock.getToyConfig() fillerState = self._nodesHolder.antiduplicator.getState() craftCost = self._craftCtrl.calculateToyCraftCost(isMegaToy=isMegaDeviceTurnedOn, toyTypeIdx=toyTypeIdx, toySettingIdx=toySettingIdx, toyRankIdx=toyRankIdx, fillerState=fillerState) self.__toyTypeID, self.__toySettingID, self.__toyRankID = mapToyParamsFromCraftUiToSrv(toyTypeIdx, toySettingIdx, toyRankIdx) if isMegaDeviceTurnedOn: self.__toySettingID = YEARS_INFO.CURRENT_SETTING_IDS_BY_NAME[ToySettings.MEGA_TOYS] shardsCount = self._itemsCache.items.festivity.getShardsCount() if shardsCount < craftCost: NewYearSoundsManager.playEvent(NewYearSoundEvents.COST_TOYS_NOT_CHANGE) elif self.__craftCost > craftCost: NewYearSoundsManager.playEvent(NewYearSoundEvents.COST_TOYS_DOWN) elif self.__craftCost < craftCost: NewYearSoundsManager.playEvent(NewYearSoundEvents.COST_TOYS_UP) self.__craftCost = craftCost with self._viewModel.transaction() as tx: tx.setCraftPrice(self.__craftCost)
def onMouseClick(self): super(NewYearCelebrityEntryObject, self).onMouseClick() NewYearSoundsManager.playEvent(NewYearSoundEvents.ENTER_CUSTOME) self.logClick(AnchorNames.CELEBRITY) NewYearNavigation.switchByAnchorName(AnchorNames.CELEBRITY)
class NYSidebar(HistorySubModelPresenter): __slots__ = ('__tabsController', '__controllers', '__currentTab', '__currentViewName', '__soundsManager') __celebrityController = dependency.descriptor(ICelebritySceneController) __newYearController = dependency.descriptor(INewYearController) __settingsCore = dependency.descriptor(ISettingsCore) __flowUILogger = NySideBarFlowLogger() def __init__(self, viewModel, parentView, *args, **kwargs): super(NYSidebar, self).__init__(viewModel, parentView) self.__tabsController = None self.__controllers = {} self.__currentTab = None self.__currentViewName = None self.__soundsManager = None return @property def viewModel(self): return self.getViewModel() def initialize(self, ctx=None, *args, **kwargs): super(NYSidebar, self).initialize(*args, **kwargs) self.viewModel.onSideBarBtnClick += self.__onSideBarBtnClick self._nyController.onDataUpdated += self.__onDataUpdated self.__celebrityController.onQuestsUpdated += self.__onQuestUpdated AccountSettings.onSettingsChanging += self.__onAccountDataUpdated self.__settingsCore.onSettingsChanged += self.__onSettingsChanged soundConfig = {NewYearSoundConfigKeys.ENTRANCE_EVENT: self.__getEntranceSoundEvent, NewYearSoundConfigKeys.EXIT_EVENT: self.__getExitSoundEvent, NewYearSoundConfigKeys.STATE_VALUE: self.__getSoundStateValue} self.__soundsManager = NewYearSoundsManager(soundConfig) self.__controllers = {NyWidgetTopMenu.GLADE: GladeTabsController(), NyWidgetTopMenu.COLLECTIONS: AlbumsTabsController(), NyWidgetTopMenu.REWARDS: RewardsTabsController()} g_eventBus.addListener(events.NewYearEvent.ON_SWITCH_VIEW, self.__onSwitchViewEvent, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.NewYearEvent.SELECT_SIDEBAR_TAB_OUTSIDE, self.__onSelectTabOutside, scope=EVENT_BUS_SCOPE.LOBBY) if ctx is not None: self.__onSwitchView(ctx) return def finalize(self): self._nyController.onDataUpdated -= self.__onDataUpdated self.__celebrityController.onQuestsUpdated -= self.__onQuestUpdated self.viewModel.onSideBarBtnClick -= self.__onSideBarBtnClick AccountSettings.onSettingsChanging -= self.__onAccountDataUpdated self.__settingsCore.onSettingsChanged -= self.__onSettingsChanged g_eventBus.removeListener(events.NewYearEvent.ON_SWITCH_VIEW, self.__onSwitchViewEvent, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.removeListener(events.NewYearEvent.SELECT_SIDEBAR_TAB_OUTSIDE, self.__onSelectTabOutside, scope=EVENT_BUS_SCOPE.LOBBY) self.__tabsController = None self.__controllers.clear() self.__soundsManager.onExitView() self.__soundsManager.clear() self.__soundsManager = None self.__currentViewName = None super(NYSidebar, self).finalize() return def __onSwitchViewEvent(self, event): ctx = event.ctx self.__onSwitchView(ctx) def __onSwitchView(self, ctx): menuName = ctx.menuName selectedTab = None self.viewModel.setViewName(menuName) self.__tabsController = self.__controllers.get(menuName) if self.__tabsController is not None: self.__updateTabs(ctx.tabName, menuName) selectedTab = self.__tabsController.getSelectedName(self.viewModel.getItemsTabBar()) else: self.__clearTabs() if self.__currentViewName != menuName or self.__currentTab != selectedTab: self.__soundsManager.onExitView() self.__currentViewName = menuName self.__currentTab = selectedTab self.__soundsManager.onEnterView() return def __onSelectTabOutside(self, event): menuName = event.ctx['menuName'] tabName = event.ctx['tabName'] if self.__currentViewName != menuName or self.__tabsController is None or self.__currentTab == tabName: return else: needToInvokeSound = self.__currentViewName != NyWidgetTopMenu.COLLECTIONS or self.__newYearController.isMaxAtmosphereLevel() if needToInvokeSound: self.__soundsManager.onExitView() self.__currentTab = tabName self.__tabsController.selectTab(tabName) self.viewModel.setStartIndex(self.__tabsController.getSelectedTabIdx()) if needToInvokeSound: self.__soundsManager.onEnterView() return def __updateTabs(self, tabName, menuName): if tabName is not None: if self.__tabsController.getCurrentTabName() != tabName: self.__tabsController.selectTab(tabName) if self._tabCache.getIntroScreenState(menuName) == NewYearTabCache.OPENED_INTRO_STATE: self.__clearTabs() else: self.__fillTabs() return def __fillTabs(self): with self.viewModel.transaction() as model: tabsArray = model.getItemsTabBar() self.__tabsController.createTabModels(tabsArray) tabIdx = self.__tabsController.getSelectedTabIdx() model.setStartIndex(tabIdx) def __validateTabs(self): if self._tabCache.getIntroScreenState(self.__currentViewName) == NewYearTabCache.OPENED_INTRO_STATE: return self.__tabsController.updateTabModels(self.viewModel.getItemsTabBar()) def __clearTabs(self): with self.viewModel.transaction() as model: tabsArray = model.getItemsTabBar() tabsArray.clear() tabsArray.invalidate() model.setStartIndex(0) def __onDataUpdated(self, keys): if self.__tabsController is None: return else: checkKeys = {SyncDataKeys.INVENTORY_TOYS, SyncDataKeys.SLOTS, SyncDataKeys.TOY_COLLECTION, SyncDataKeys.TOY_FRAGMENTS} if set(keys) & checkKeys: self.__validateTabs() return def __onQuestUpdated(self): if self.__tabsController is None: return else: self.__validateTabs() return def __onAccountDataUpdated(self, key, value): if self.__tabsController is None: return else: if key in (NY_OLD_COLLECTIONS_BY_YEAR_VISITED, NY_OLD_REWARDS_BY_YEAR_VISITED): self.__validateTabs() return def __onSettingsChanged(self, diff): if self.__tabsController is None: return else: if NewYearStorageKeys.GLADE_INTRO_VISITED in diff: self.__updateTabs(self.__currentTab, self.__currentViewName) return def __onSideBarBtnClick(self, args): tabName = args['tabName'] self.__soundsManager.playEvent(NewYearSoundEvents.SIDE_BAR_CLICK) self.__flowUILogger.logTabSelect(view=self.__currentViewName, currentTab=self.__tabsController.getCurrentTabName(), targetTab=tabName) self.__selectTab(tabName) def __selectTab(self, tabName): needToInvokeSound = self.__currentViewName != NyWidgetTopMenu.COLLECTIONS or self.__newYearController.isMaxAtmosphereLevel() if needToInvokeSound: self.__soundsManager.onExitView() self.__currentTab = tabName self.__tabsController.selectTab(tabName) with self.viewModel.transaction() as model: model.setStartIndex(self.__tabsController.getSelectedTabIdx()) g_eventBus.handleEvent(events.NewYearEvent(events.NewYearEvent.ON_SIDEBAR_SELECTED, ctx=NYTabCtx(tabName=tabName, menuName=self.viewModel.getViewName())), scope=EVENT_BUS_SCOPE.LOBBY) if needToInvokeSound: self.__soundsManager.onEnterView() def __getEntranceSoundEvent(self): return self.__getSoundEvent(NewYearSoundConfigKeys.ENTRANCE_EVENT) def __getExitSoundEvent(self): return self.__getSoundEvent(NewYearSoundConfigKeys.EXIT_EVENT) def __getSoundEvent(self, eventType): if self.__currentViewName == NyWidgetTopMenu.GLADE: return _GLADE_SOUNDS_MAP.get(eventType, {}).get(self.__currentTab) else: if self.__currentViewName == NyWidgetTopMenu.COLLECTIONS and (self.__currentTab == Collections.NewYear22 or self.__newYearController.isMaxAtmosphereLevel()): return _COLLECTIONS_SOUNDS_MAP.get(eventType, {}).get(self.__currentTab) return None def __getSoundStateValue(self): if self.__currentViewName == NyWidgetTopMenu.GLADE: selectedTabName = self.__tabsController.getCurrentTabName() return _GLADE_SOUNDS_MAP.get(NewYearSoundConfigKeys.STATE_VALUE, {}).get(selectedTabName) else: return None
class NyMainWidget(ViewImpl): _nyController = dependency.descriptor(INewYearController) _COManager = dependency.descriptor(ICustomizableObjectsManager) _itemsCache = dependency.descriptor(IItemsCache) settingsCore = dependency.descriptor(ISettingsCore) __gui = dependency.descriptor(IGuiLoader) __uiLogger = NyMainWidgetLogger() def __init__(self): settings = ViewSettings(R.views.lobby.new_year.components. ny_main_widget.NewYearMainWidget()) settings.flags = ViewFlags.COMPONENT settings.model = NewYearMainWidgetModel() super(NyMainWidget, self).__init__(settings) self._lobbyMode = True self.__level = NewYearAtmospherePresenter.getLevel() self.__maxLevel = self._itemsCache.items.festivity.getMaxLevel() self.__soundManager = NewYearSoundsManager({}) self.__soundRTPCController = None return @property def viewModel(self): return super(NyMainWidget, self).getViewModel() def createToolTipContent(self, event, contentID): if event.contentID == R.views.lobby.new_year.tooltips.NyMainWidgetTooltip( ): return NyMainWidgetTooltip() else: return NyTotalBonusTooltip( ) if event.contentID == R.views.lobby.new_year.tooltips.NyTotalBonusTooltip( ) else None 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 _finalize(self): if self.__soundRTPCController is not None: self.__soundRTPCController.fini() self.__soundRTPCController = None self.__soundManager.clear() self.viewModel.onClick -= self.__onWidgetClick self._nyController.onDataUpdated -= self.__onDataUpdated g_eventBus.removeListener(NewYearEvent.ON_SWITCH_VIEW, self.__onSwitchView, scope=EVENT_BUS_SCOPE.LOBBY) NewYearNavigation.onObjectStateChanged -= self.__onObjectStateChanged super(NyMainWidget, self)._finalize() return def getLobbyMode(self, *_): return self._lobbyMode def __onWidgetClick(self, *_): self.__uiLogger.logClick(self._lobbyMode) NewYearNavigation.switchTo(CustomizationObjects.FIR, True, withFade=True) if self._lobbyMode: self.__soundManager.playEvent(NewYearSoundEvents.ENTER_CUSTOME) self.__soundManager.playEvent(NewYearSoundEvents.TRANSITION_TREE) def __onDataUpdated(self, keys): if SyncDataKeys.POINTS in keys: with self.viewModel.transaction() as model: self.__updateData(model) self.__updateLevel(model) def __updateLevel(self, model): animationType = NewYearMainWidgetAnimTypes.ANIM_TYPE_NONE level = NewYearAtmospherePresenter.getLevel() if level != self.__level: self.__level = level self.__onLevelChanged() maxLevel = self._itemsCache.items.festivity.getMaxLevel() if maxLevel != self.__maxLevel: self.__maxLevel = maxLevel animationType = NewYearMainWidgetAnimTypes.ANIM_TYPE_UP_LONG model.setAnimationType(animationType) model.setLevel(self.__level) model.setLevelRoman(int2roman(self.__maxLevel)) currentPoints, nextPoints = NewYearAtmospherePresenter.getLevelProgress( ) model.setCurrentPoints(currentPoints) model.setNextPoints(nextPoints) 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) @staticmethod def __updateActiveState(model): currentView = NewYearNavigation.getCurrentViewName() model.setIsVisible(currentView != ViewAliases.INFO_VIEW) model.setIsEnabled( currentView != ViewAliases.GLADE_VIEW or NewYearNavigation.getCurrentObject() != CustomizationObjects.FIR) 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 __onSwitchView(self, _): with self.viewModel.transaction() as tx: self.__updateActiveState(tx) if not self.viewModel.getIsVisible(): self.__tryToDestroyWidgetTooltip() def __tryToDestroyWidgetTooltip(self): tooltipIDs = (R.views.lobby.new_year.tooltips.NyMainWidgetTooltip(), R.views.lobby.new_year.tooltips.NyTotalBonusTooltip()) for tooltipID in tooltipIDs: tooltipView = self.__gui.windowsManager.getViewByLayoutID( tooltipID) if tooltipView: tooltipView.destroyWindow() def __onLevelChanged(self): self.__soundRTPCController.setLevelAtmosphere( self._itemsCache.items.festivity.getMaxLevel())
def _initialize(self, rewards): super(NewYearStyleRewardView, self)._initialize() NewYearSoundsManager.playEvent(NewYearSoundEvents.AWARD_STYLE_SCREEN) self.viewModel.onClose += self.__onClose self._nyController.onStateChanged += self.__onEventStateChanged setOverlayHangarGeneral(True)
class NYMainMenu(HistorySubModelPresenter, GiftEventHubWatcher): _GIFT_EVENT_ID = GiftEventID.NY_HOLIDAYS __celebrityController = dependency.descriptor(ICelebritySceneController) __settingsCore = dependency.descriptor(ISettingsCore) __topMenuLogger = NyWidgetTopMenuLogger() __flowLogger = NyTopMenuFlowLogger() def __init__(self, viewModel, parentView, *args, **kwargs): super(NYMainMenu, self).__init__(viewModel, parentView, *args, **kwargs) self.__tabsController = NewYearMainTabsController() self.__soundsManager = None self.__currentView = None return @property def viewModel(self): return self.getViewModel() def createToolTipContent(self, event, contentID): tooltips = R.views.lobby.new_year.tooltips if event.contentID == tooltips.NyMenuGiftTooltip(): return NyMenuGiftTooltip() if contentID == tooltips.NyMenuShardsTooltip(): return NyMenuShardsTooltip() return NyMenuCollectionsTooltip( ) if contentID == tooltips.NyMenuCollectionsTooltip() else super( NYMainMenu, self).createToolTipContent(event, contentID) def initialize(self, *args, **kwargs): super(NYMainMenu, self).initialize(*args, **kwargs) self.catchGiftEventHub() soundConfig = { NewYearSoundConfigKeys.ENTRANCE_EVENT: self.__getEntranceSoundEvent, NewYearSoundConfigKeys.EXIT_EVENT: self.__getExitSoundEvent, NewYearSoundConfigKeys.STATE_VALUE: self.__getSoundStateValue } self.__soundsManager = NewYearSoundsManager(soundConfig) self.viewModel.setIsExtendedAnim(not isMemoryRiskySystem()) def finalize(self): self.__soundsManager.onExitView() self.__soundsManager.clear() self.__soundsManager = None self.__currentView = None self.releaseGiftEventHub() super(NYMainMenu, self).finalize() return def _getEvents(self): return ((self.viewModel.onInfoBtnClick, self.__onInfoBtnClick), (self.viewModel.onSwitchContent, self.__onMenuItemSelected), (self._nyController.onDataUpdated, self.__onDataUpdated), (self.__celebrityController.onQuestsUpdated, self.__onDataUpdated), (AccountSettings.onSettingsChanging, self.__onAccountDataUpdated), (self.__settingsCore.onSettingsChanged, self.__onSettingsChanged)) def _getListeners(self): return ((events.NewYearEvent.ON_SWITCH_VIEW, self.__onSwitchViewEvent, EVENT_BUS_SCOPE.LOBBY), ) def _getCallbacks(self): return (('tokens', self.__onTokensChanged), ) def _onGiftHubUpdate(self, reason, _=None): if reason == HubUpdateReason.SETTINGS: self.__recreateMenu() elif reason == HubUpdateReason.STAMPER_UPDATE: self.__updateMenu() 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 __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 __onSwitchViewEvent(self, event): self.__onSwitchView(event.ctx) def __onSwitchView(self, ctx): menuName = ctx.menuName if menuName != self.__currentView: self.__soundsManager.onExitView() self.__currentView = menuName self.__soundsManager.onEnterView() if menuName != NyWidgetTopMenu.INFO and self.__tabsController.getCurrentTabName( ) != menuName: self.__tabsController.selectTab(menuName) self.__updateMenu() def __onDataUpdated(self, *_): self.__updateMenu() def __onAccountDataUpdated(self, key, _): if key in (NY_CELEBRITY_QUESTS_VISITED_MASK, NY_OLD_COLLECTIONS_BY_YEAR_VISITED, NY_OLD_REWARDS_BY_YEAR_VISITED): self.__updateMenu() def __onSettingsChanged(self, diff): if NewYearStorageKeys.CELEBRITY_CHALLENGE_VISITED in diff: self.__updateMenu() def __onTokensChanged(self, tokens): if any((token.startswith(CelebrityQuestTokenParts.PREFIX) for token in tokens)): self.__updateMenu() def __recreateMenu(self): with self.viewModel.transaction() as model: tabIdx = self.__getTabIdx() model.setStartIndexMenu(tabIdx) self.__tabsController.setSelectedTabIdx(tabIdx) self.__tabsController.createTabModels(model.getItemsMenu()) def __updateMenu(self): with self.viewModel.transaction() as model: self.__tabsController.updateTabModels(model.getItemsMenu()) model.setStartIndexMenu(self.__getTabIdx()) def __getEntranceSoundEvent(self): return _SOUNDS_MAP.get(NewYearSoundConfigKeys.ENTRANCE_EVENT, {}).get(self.__currentView) def __getExitSoundEvent(self): return _SOUNDS_MAP.get(NewYearSoundConfigKeys.EXIT_EVENT, {}).get(self.__currentView) def __getSoundStateValue(self): return _SOUNDS_MAP.get(NewYearSoundConfigKeys.STATE_VALUE, {}).get(self.__currentView) def __getTabIdx(self): currentView = self.__currentView if currentView == NyWidgetTopMenu.INFO: return -1 return 0 if currentView not in self.__tabsController.getEnabledTabsArray( ) else self.__tabsController.tabOrderKey(currentView)
def __onPlayPrintSound(self): if self.__printingSoundEnabled: self.__stopped = False NewYearSoundsManager.playEvent( NewYearSoundEvents.CRAFT_MONITOR_PRINING_START)
def __playToggleSound(isOn): soundEvent = NewYearSoundEvents.CRAFT_MEGA_MODULE_ON if isOn else NewYearSoundEvents.CRAFT_MEGA_MODULE_OFF NewYearSoundsManager.playEvent(soundEvent)
def _onLoaded(self, *args, **kwargs): setOverlayHangarGeneral(onState=True) NewYearSoundsManager.playEvent( NewYearSoundEvents.CELEBRITY_SCREEN_REWARD) super(ChallengeRewardView, self)._onLoaded(*args, **kwargs)