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)
def _onLoading(self, *args, **kwargs): self.__resourceWell.startNumberRequesters() with self.viewModel.transaction() as model: self.__fillEventTime(model=model) self.__fillRewardInfo(model=model) model.setVehicleName( getVehicleByIntCD( self.__resourceWell.getRewardVehicle()).userName)
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)
def __showIntro(self): with self.viewModel.transaction() as tx: videoIsOpening = self.__showIntroVideo(onStart=True) tx.setShowIntro(self.__isFirstShowView()) vehIntCDs = self.__battlePassController.getSpecialVehicles() capacity = self.__battlePassController.getVehicleProgression( vehIntCDs[0])[1] tx.intro.setPoints(capacity) for vehIntCD in vehIntCDs: if getVehicleByIntCD(vehIntCD) is not None: tx.intro.getTankNames().addString( getVehicleByIntCD(vehIntCD).userName) tx.intro.getTankNames().addString('') if not videoIsOpening: self.__setShowBuyAnimations(model=tx) return
def __getRewardModel(self, isTop): model = RewardModel() model.setIsTop(isTop) model.setIsEnabled(self.__resourceWell.isRewardEnabled(isTop)) model.setVehiclesLeftCount(self.__resourceWell.getRewardLeftCount(isTop)) model.setIsCountAvailable(self.__resourceWell.isRewardCountAvailable(isTop)) fillVehicleInfo(model.vehicleInfo, getVehicleByIntCD(self.__resourceWell.getRewardVehicle())) return model
def __init__(self, layoutID, backCallback): settings = ViewSettings( R.views.lobby.resource_well.CompletedProgressionView()) settings.flags = ViewFlags.LOBBY_SUB_VIEW settings.model = CompletedProgressionViewModel() self.__backCallback = backCallback self.__vehicle = getVehicleByIntCD( self.__resourceWell.getRewardVehicle()) super(CompletedProgressionView, self).__init__(settings)
def __genResCommPlaceholders(self): commonResArgs = {} vehIntCDs = self.__battlePass.getSpecialVehicles() commonResArgs['points'] = self.__battlePass.getSpecialVehicleCapBonus() for idx, vehIntCD in enumerate(vehIntCDs, 1): vehicle = getVehicleByIntCD(vehIntCD) commonResArgs['tankName{}'.format(idx)] = vehicle.userName if vehicle else '' return commonResArgs
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 __updateModel(self): resourceWell = self.__resourceWell isRewardLeft = resourceWell.getRewardLeftCount( isTop=True) or resourceWell.getRewardLeftCount(isTop=False) isVisible = resourceWell.isActive() and not isForbiddenAccount( resourceWell=resourceWell) and not resourceWell.isCompleted( ) and isRewardLeft with self.viewModel.transaction() as model: model.setIsVisible(isVisible) model.setTopRewardsCount( self.__resourceWell.getRewardLimit(isTop=True)) model.setRegularRewardsCount( self.__resourceWell.getRewardLimit(isTop=False)) model.setVehicleName( getVehicleByIntCD( self.__resourceWell.getRewardVehicle()).userName)
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 _getVehicle(self): return game_vars.getVehicleByIntCD(self.getVar(self._vehicleVarID))
def _getVehicle(self): return game_vars.getVehicleByIntCD(self.getVar(self._vehicleVarID))
def __fillVehicle(self, style, model): vehicleCD = getVehicleCDForStyle(style, itemsCache=self.__itemsCache) vehicle = getVehicleByIntCD(vehicleCD) fillVehicleInfo(model.vehicleInfo, vehicle) model.setIsVehicleInHangar(vehicle.isInInventory)
def _onLoading(self, *args, **kwargs): super(IntroView, self)._onLoading(*args, **kwargs) setIntroShown() with self.viewModel.transaction() as model: fillVehicleInfo(model.vehicleInfo, getVehicleByIntCD(self.__resourceWell.getRewardVehicle())) self.__fillEventInfo(model=model)
def __fillVehicleName(self, model=None): vehicle = getVehicleByIntCD(self.__resourceWell.getRewardVehicle()) model.setVehicleName(vehicle.userName)