Ejemplo n.º 1
0
    def _onLoading(self, *args, **kwargs):
        super(BattlePass3dStyleChoiceView, self)._onLoading(*args, **kwargs)
        self.__addListeners()
        with self.viewModel.transaction() as tx:
            for styleBonus in self.__battlePassController.getStylesConfig():
                tankStyleModel = TankStyleModel()
                styleInfo = getStyleInfo(styleBonus)
                tankStyleModel.setStyleId(styleInfo.id)
                tankStyleModel.setStyleName(styleInfo.userName)
                vehicleCD = getVehicleCDForStyle(styleInfo)
                vehicle = getVehicleByIntCD(vehicleCD)
                fillVehicleInfo(tankStyleModel.vehicleInfo, vehicle)
                tankStyleModel.setIsInHangar(vehicle.isInInventory)
                tankStyleModel.setIsObtained(bool(styleInfo.fullCount()))
                tx.tankStylesList.addViewModel(tankStyleModel)

            currentChapterLevel = self.__battlePassController.getCurrentChapter(
            )
            chosenItems = self.__itemsCache.items.battlePass.getChosenItems()
            if currentChapterLevel not in chosenItems:
                isChoiceEnabled = True
                if chosenItems:
                    chapterLevel = max(chosenItems.keys()) + 1
                else:
                    chapterLevel = BattlePassConsts.MINIMAL_CHAPTER_NUMBER
            else:
                chapterLevel = currentChapterLevel
                isChoiceEnabled = False
            tx.setIsChoiceEnabled(isChoiceEnabled)
            tx.setChapterNumber(chapterLevel)
            tx.setCurrentLevel(
                getCurrentStyleLevel(self.__battlePassController.getSeasonID(),
                                     chapterLevel))
            tx.setSelectedLevel(self.__level)
        switchHangarOverlaySoundFilter(on=True)
Ejemplo n.º 2
0
    def __onPreviewClick(self, args):
        styleID = args.get('styleId')
        styleInfo = None
        for styleBonus in self.__battlePassController.getStylesConfig():
            if first(styleBonus.getValue()).get('id') == styleID:
                styleInfo = getStyleInfo(styleBonus)
                break

        if styleInfo is None:
            _logger.error(
                'Failed to get style for preview! Check server settings are correct.'
            )
            return
        else:
            self.__previewOpened = True
            hideVehiclePreview(back=False)
            vehicleCD = getVehicleCDForStyle(styleInfo)
            self.__battlePassController.getRewardLogic().postPreviewOpen()
            _BPViewStates.prepareToOpenPreview()
            showProgressionStylesStylePreview(
                vehicleCD, styleInfo, styleInfo.getDescription(),
                self.__previewCallback,
                backport.text(_rBattlePass.choose3dStyle.preview.backLabel()),
                self.__level)
            return
Ejemplo n.º 3
0
 def _onLoading(self, *args, **kwargs):
     super(ExtraIntroView, self)._onLoading(*args, **kwargs)
     style = getStyleForChapter(self.__chapterID)
     vehicleCD = getVehicleCDForStyle(style)
     vehicle = getVehicleByIntCD(vehicleCD)
     with self.viewModel.transaction() as tx:
         tx.setStyleName(style.userName)
         fillVehicleInfo(tx.vehicleInfo, vehicle)
Ejemplo n.º 4
0
 def __onPreviewClick(self):
     styleInfo = getStyleForChapter(self.__chosenChapter,
                                    itemsCache=self.__itemsCache)
     vehicleCD = getVehicleCDForStyle(styleInfo,
                                      itemsCache=self.__itemsCache)
     showProgressionStylesStylePreview(
         vehicleCD, styleInfo, styleInfo.getDescription(),
         showMissionsBattlePassCommonProgression)
 def __setStyleWidget(self, model):
     style = getStyleForChapter(self.__chapterID)
     model.widget3dStyle.setStyleName(style.userName if style else '')
     model.widget3dStyle.setStyleId(style.id if style else 0)
     if style is not None:
         vehicleCD = getVehicleCDForStyle(style,
                                          itemsCache=self.__itemsCache)
         vehicle = getVehicleByIntCD(vehicleCD)
         fillVehicleInfo(model.widget3dStyle.vehicleInfo, vehicle)
     return
 def __showPreview(self, args):
     chapterID = args.get('chapterID')
     if chapterID is None:
         return
     else:
         hideVehiclePreview(back=False)
         style = getStyleForChapter(chapterID, battlePass=self.__battlePass)
         vehicleCD = getVehicleCDForStyle(style,
                                          itemsCache=self.__itemsCache)
         if self.__battlePass.isExtraChapter(chapterID):
             self.__showStylePreview(style, vehicleCD)
         else:
             self.__showProgressionStylePreview(style, vehicleCD)
         self.destroyWindow()
         return
 def __onExtraPreviewClick(self):
     styleInfo = getStyleForChapter(self.__chapterID,
                                    battlePass=self.__battlePass)
     vehicleCD = getVehicleCDForStyle(styleInfo,
                                      itemsCache=self.__itemsCache)
     itemsPack = (ItemPackEntry(type=ItemPackType.CREW_100, groupID=1), )
     showStylePreview(vehicleCD,
                      style=styleInfo,
                      topPanelData={
                          'linkage':
                          VEHPREVIEW_CONSTANTS.TOP_PANEL_TABS_LINKAGE,
                          'tabIDs': (TabID.VEHICLE, TabID.STYLE),
                          'currentTabID': TabID.STYLE
                      },
                      itemsPack=itemsPack,
                      backCallback=self.__getPreviewCallback())
 def __onPreviewClick(self, args):
     level = args.get('level')
     if level is None:
         return
     else:
         styleInfo = getStyleForChapter(self.__chapterID,
                                        battlePass=self.__battlePass)
         vehicleCD = getVehicleCDForStyle(styleInfo,
                                          itemsCache=self.__itemsCache)
         showBattlePassStyleProgressionPreview(vehicleCD,
                                               styleInfo,
                                               styleInfo.getDescription(),
                                               self.__getPreviewCallback(),
                                               chapterId=self.__chapterID,
                                               styleLevel=int(level))
         return
Ejemplo n.º 9
0
 def __setStyleWidget(self, model):
     chosenItems = self.__itemsCache.items.battlePass.getChosenItems()
     if chosenItems is None or self.__chosenChapter not in chosenItems:
         style, level = (None, 0)
     else:
         intCD, level = chosenItems[self.__chosenChapter]
         style = self.__itemsCache.items.getItemByCD(intCD)
     isUnselectedPrevStyle = chosenItems is not None and self.__chosenChapter != BattlePassConsts.MINIMAL_CHAPTER_NUMBER and self.__chosenChapter - 1 not in chosenItems
     model.widget3dStyle.setStyleName(style.userName if style else '')
     model.widget3dStyle.setStyleId(style.id if style else 0)
     model.widget3dStyle.setLevel(level)
     model.widget3dStyle.setIsUnselectedPrevStyle(isUnselectedPrevStyle)
     if style is not None:
         vehicleCD = getVehicleCDForStyle(style,
                                          itemsCache=self.__itemsCache)
         vehicle = getVehicleByIntCD(vehicleCD)
         fillVehicleInfo(model.widget3dStyle.vehicleInfo, vehicle)
     return
 def __fillVehicle(self, style, model):
     vehicleCD = getVehicleCDForStyle(style, itemsCache=self.__itemsCache)
     vehicle = getVehicleByIntCD(vehicleCD)
     fillVehicleInfo(model.vehicleInfo, vehicle)
     model.setIsVehicleInHangar(vehicle.isInInventory)
 def __setStyleTaken(self, model):
     style = getStyleForChapter(self.__chapterID)
     vehicleCD = getVehicleCDForStyle(style, itemsCache=self.__itemsCache)
     vehicle = self.__itemsCache.items.getItemByCD(vehicleCD)
     model.setIsStyleTaken(style.isInInventory
                           or bool(style.installedCount(vehicle.intCD)))