コード例 #1
0
 def __setSoundStyles(self):
     toySettingIdx = self._viewModel.getCurrentSettingIndex()
     _, toySettingIdx, _ = mapToyParamsFromCraftUiToSrv(0, toySettingIdx, 0)
     toySetting = getSafeFromCollection(ToySettings.NEW,
                                        toySettingIdx,
                                        default=RANDOM_STYLE_BOX)
     NewYearSoundsManager.setStylesSwitchBox(toySetting)
コード例 #2
0
 def __updateMainContent(self,
                         isClickTab=False,
                         prevBoxType=None,
                         prevHasBoxes=False):
     with self.viewModel.transaction() as model:
         hasBoxes = False
         boxType = self.__tabsController.getSelectedBoxType()
         boxCategory = self.__tabsController.getSelectedBoxCategory()
         if boxType in self.__availableBoxes:
             available = self.__availableBoxes[boxType]
             if boxType == NewYearLootBoxes.PREMIUM:
                 categories = available['categories']
                 boxNumber = categories[
                     boxCategory] if boxCategory in categories else available[
                         'total']
             else:
                 boxNumber = available['total']
             hasBoxes = boxNumber > 0
             if hasBoxes:
                 self.__updateBoxesButtons(
                     boxNumber, boxType == NewYearLootBoxes.PREMIUM)
         setting = self.__LOOT_BOX_CATEGORY_MAPPING.get(
             boxCategory) if boxCategory is not None else None
         NewYearSoundsManager.setStylesSwitchBox(
             setting if setting else RANDOM_STYLE_BOX)
         NewYearSoundsManager.setRTPCBoxEntryView(boxType)
         NewYearSoundsManager.setRTPCBoxAvailability(hasBoxes)
         if model.getCurrentName() and model.getCurrentName(
         ) != self.__tabsController.getSelectedBoxName():
             playSound(LootBoxViewEvents.LOGISTIC_CENTER_SWITCH)
         model.setSelectedBoxType(boxType)
         model.setCurrentName(self.__tabsController.getSelectedBoxName())
         model.setIsPremiumType(boxType == NewYearLootBoxes.PREMIUM)
         model.setRealm(CURRENT_REALM)
         lootboxItem = getLootBoxByTypeAndCategory(boxType,
                                                   boxCategory,
                                                   isInInventory=False)
         isBoxEnabled = lootboxItem is not None and self.lobbyContext.getServerSettings(
         ).isLootBoxEnabled(lootboxItem.getID())
         model.setIsOpenBoxBtnVisible(hasBoxes and isBoxEnabled)
         model.setIsBoxesAvailable(isBoxEnabled)
         model.setCurrentCountButton(self.__getSelectedCountIndx())
         nyStorage = self.settingsCore.serverSettings.getNewYearStorage()
         model.setIsStatisticsHintActive(
             not nyStorage.get(NewYearStorageKeys.NY_STATISTICS_HINT_SHOWN,
                               False)
             and bool(self.itemsCache.items.tokens.getLootBoxesStats()))
         if isClickTab and (prevBoxType != boxType or hasBoxes
                            or prevHasBoxes and not hasBoxes):
             model.setIsBoxChangeAnimation(True)
         setGaranteedRewardData(model.guaranteedReward, lootboxItem,
                                not self.__isViewHidden, True)
     g_eventBus.handleEvent(events.LootboxesEvent(
         events.LootboxesEvent.ON_TAB_SELECTED,
         ctx={
             'tabName': self.__tabsController.getSelectedBoxName(),
             'hasBoxes': hasBoxes
         }),
                            scope=EVENT_BUS_SCOPE.LOBBY)
     return
コード例 #3
0
 def __onAddCraftDecoration(self, *_):
     toyDescriptor = self._itemsCache.items.festivity.getToys().get(self.__currentCraftToyID)
     NewYearSoundsManager.setStylesSwitchBox(toyDescriptor.getSetting())
     with self.viewModel.transaction() as model:
         items = model.craftCarousel.getItems()
         item = CraftToyPresenter(toyDescriptor).asSlotViewModel()
         if CurrentNYCollectionPresenter.getCount() > self.__lastCollectionSize and not self.__nyController.isMaxAtmosphereLevel():
             atmospherePoints = NewYearAtmospherePresenter.getAtmPointsForNewToy(self.__currentCraftToyID)
             item.setAtmosphereBonus(atmospherePoints)
         items.addViewModel(item)
         items.invalidate()