def __handleSelectedEntityUpdated(self, event):
     ctx = event.ctx
     if ctx['state'] != CameraMovementStates.FROM_OBJECT:
         entity = BigWorld.entities.get(ctx['entityId'], None)
         if isinstance(entity, HeroTank):
             descriptor = entity.typeDescriptor
             if descriptor:
                 marathons = self.__marathonCtrl.getMarathons()
                 vehicleCD = descriptor.type.compactDescr
                 activeMarathon = next((marathon for marathon in marathons
                                        if marathon.vehicleID == vehicleCD),
                                       None)
                 if activeMarathon:
                     title = backport.text(
                         R.strings.marathon.vehiclePreview.buyingPanel.
                         title())
                     shared_events.showMarathonVehiclePreview(
                         vehicleCD, activeMarathon.remainingPackedRewards,
                         title, activeMarathon.prefix, True)
                 elif isResourceWellRewardVehicle(vehicleCD=vehicleCD):
                     shared_events.showResourceWellHeroPreview(vehicleCD)
                 else:
                     shared_events.showHeroTankPreview(vehicleCD)
     self.__checkVehicleCameraState()
     self.__updateState()
     return
Esempio n. 2
0
 def __handleSelectedEntityUpdated(self, event):
     ctx = event.ctx
     if ctx['state'] != CameraMovementStates.FROM_OBJECT:
         entity = BigWorld.entities.get(ctx['entityId'], None)
         if isinstance(entity, HeroTank):
             descriptor = entity.typeDescriptor
             if descriptor:
                 showHeroTankPreview(descriptor.type.compactDescr)
     return
 def handleSelectedEntityUpdated(self, event):
     ctx = event.ctx
     entity = BigWorld.entities.get(ctx['entityId'], None)
     if ctx['state'] == CameraMovementStates.MOVING_TO_OBJECT:
         if isinstance(entity, HeroTank):
             descriptor = entity.typeDescriptor
             if descriptor:
                 self._needToResetAppearance = False
                 event_dispatcher.showHeroTankPreview(
                     descriptor.type.compactDescr,
                     previewAlias=VIEW_ALIAS.VEHICLE_PREVIEW,
                     previousBackAlias=self._backAlias)
         elif entity.id == self.hangarSpace.space.vehicleEntityId:
             self.__processBackClick({'entity': entity})
     return