Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    def __showStylePreview(self, styleID):
        styledVehicleCD = None
        minLvl, _ = self.__rankedController.getSuitableVehicleLevels()
        if g_currentVehicle.isPresent() and g_currentVehicle.item.level >= minLvl:
            styledVehicleCD = g_currentVehicle.item.intCD
        else:
            accDossier = self.__itemsCache.items.getAccountDossier()
            vehicles = accDossier.getRankedStats().getVehicles()
            if not vehicles:
                vehicles = accDossier.getRandomStats().getVehicles()
            if vehicles:
                sortedVehicles = sorted(vehicles.items(), key=lambda vStat: vStat[1].battlesCount, reverse=True)
                for vehicleCD, _ in sortedVehicles:
                    vehicleType = getVehicleType(vehicleCD)
                    if vehicleType.level >= minLvl:
                        styledVehicleCD = vehicleCD
                        break

            if not styledVehicleCD:
                vehiclesPool = AccountSettings.getSettings(RANKED_STYLED_VEHICLES_POOL)
                if not vehiclesPool:
                    vehiclesPool = list(_DEFAULT_STYLED_VEHICLES)
                vehicleName = vehiclesPool.pop(0)
                styledVehicleCD = VehicleDescriptor(typeName=vehicleName).type.compactDescr
                vehiclesPool.append(vehicleName)
                AccountSettings.setSettings(RANKED_STYLED_VEHICLES_POOL, vehiclesPool)
        styleDescr = self.__styleDescriptions.get(styleID, '')
        style = first(self.__itemsCache.items.getStyles(REQ_CRITERIA.CUSTOM(lambda item: item.id == styleID)).values())
        showStylePreview(styledVehicleCD, style, styleDescr, self._backToLeaguesCallback)
        return
Ejemplo n.º 3
0
 def __showStylePreview(self, vehicleCD, cmd):
     style = self.c11n.getItemByID(GUI_ITEM_TYPE.STYLE, cmd.style_id)
     vehicle = self.itemsCache.items.getItemByCD(vehicleCD)
     if vehicle is not None and style.mayInstall(vehicle):
         showStylePreview(vehicleCD, style, style.getDescription(), self._getVehicleStylePreviewCallback(cmd), backBtnDescrLabel=backport.text(R.strings.vehicle_preview.header.backBtn.descrLabel.dyn(cmd.back_btn_descr, '')()))
         return True
     else:
         return False
 def __showStylePreview(self, style, vehicleCD):
     itemsPack = (ItemPackEntry(type=ItemPackType.CREW_100, groupID=1), )
     showStylePreview(vehicleCD,
                      style=style,
                      topPanelData={
                          'linkage':
                          VEHPREVIEW_CONSTANTS.TOP_PANEL_TABS_LINKAGE,
                          'tabIDs': (TabID.VEHICLE, TabID.STYLE),
                          'currentTabID': TabID.STYLE
                      },
                      itemsPack=itemsPack,
                      backCallback=self.__getPreviewCallback())
 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())
Ejemplo n.º 6
0
def showStyledVehicleByStyleCD(styleIntCD, isBackToMultiOpen=False, itemsCache=None, c11nService=None):
    NewYearHangarHideManager.instance().openStyle()
    _hideLootBoxWindows(isBackToMultiOpen)
    vehicle = getVehByStyleCD(styleIntCD)
    style = itemsCache.items.getItemByCD(styleIntCD)
    if vehicle.isInInventory:

        def _callback():
            c11nService.getCtx().previewStyle(style, _ExitCallback(isBackToMultiOpen))

        c11nService.showCustomization(vehicle.invID, _callback)
    else:

        def _backCallback():
            NyLootBoxesRewardPreviewFlowLogger().logStylePreviewBack()
            _showLootBoxWindows(isBackToMultiOpen)
            NewYearHangarHideManager.instance().closeStyle()

        def _exitCallback():
            NyLootBoxesRewardPreviewFlowLogger().logStylePreviewExit()
            _closeLootBoxWindows()
            NewYearHangarHideManager.instance().closeStyle()

        showStylePreview(vehCD=vehicle.intCD, style=style, styleDescr=style.getDescription(), backCallback=_backCallback, destoryCallback=_exitCallback, backBtnDescrLabel=backport.text(R.strings.vehicle_preview.header.backBtn.descrLabel.personalAwards()))
Ejemplo n.º 7
0
 def __onPreviewStyleShow(self, args):
     backCallback = _ShowGiftSystemCallback()
     NewYearNavigation.switchTo(None, True)
     styleItem = self.__itemsCache.items.getItemByCD(int(args['styleID']))
     showStylePreview(getVehiclePreviewID(styleItem), styleItem, styleItem.getDescription(), backCallback=backCallback, backBtnDescrLabel=backport.text(R.strings.ny.giftSystem.backLabel()))
     return
Ejemplo n.º 8
0
 def _onSecondary(self):
     if self.__marathon.vehicle.isInInventory:
         self.c11n.showCustomization(self.__marathon.vehicle.invID)
     else:
         style = self.c11n.getItemByID(GUI_ITEM_TYPE.STYLE, self.__marathon.styleID)
         showStylePreview(self.__marathon.vehicle.compactDescr, style, style.getDescription(), showHangar)