def __startBuild(self, vDesc, vState): self.__curBuildInd += 1 self.__vDesc = vDesc self.__resources = {} self.__stickers = [] self.__componentIDs = { 'chassis': vDesc.chassis['models'][vState], 'hull': vDesc.hull['models'][vState], 'turret': vDesc.turret['models'][vState], 'gun': vDesc.gun['models'][vState], 'camouflageExclusionMask': vDesc.type.camouflageExclusionMask } customization = items.vehicles.g_cache.customization( vDesc.type.customizationNationID) if customization is not None and vDesc.camouflages is not None: camouflageID = vDesc.camouflages[g_tankActiveCamouflage.get( vDesc.type.compactDescr, 0)][0] camouflageDesc = customization['camouflages'].get(camouflageID) if camouflageDesc is not None: self.__componentIDs['camouflageTexture'] = camouflageDesc[ 'texture'] if vState == 'undamaged': self.__emblemsAlpha = _CFG['emblems_alpha_undamaged'] self.__isVehicleDestroyed = False else: self.__emblemsAlpha = _CFG['emblems_alpha_damaged'] self.__isVehicleDestroyed = True resources = self.__componentIDs.values() BigWorld.loadResourceListBG( tuple(resources), partial(self.__onResourcesLoaded, self.__curBuildInd)) return
def loadPrerequisites(self): prereqs = [] for visualData in self.__visualisationData.iteritems(): if 'visual' in visualData: prereqs.append(visualData['visual']) BigWorld.loadResourceListBG(prereqs, self.__onPrereqsLoaded)
def create(self, settings, startTime): self.__settings = settings self.__model = None self.__sound = None self.__cbID = None self.__startTime = startTime self.__fadedIn = False self.__period = self.__settings.readFloat('period', 0.0) self.__possibility = self.__settings.readFloat('possibility', 1.0) self.__position = self.__settings.readVector3('position', (0.0, 0.0, 0.0)) curveSettings = BigWorld.WGActionCurve(self.__settings) self.__soundName = None self.__soundName = curveSettings.getChannelProperty(0, 'wwsoundName') if self.__soundName is not None: self.__soundName = self.__soundName.asString else: self.__soundName = '' waveImpulseDs = curveSettings.getChannelProperty(0, 'waveImpulse') if waveImpulseDs is not None: startImpulse = waveImpulseDs.readFloat('start', 0.0) endImpulse = waveImpulseDs.readFloat('end', 0.0) count = waveImpulseDs.readInt('count', 0) - 1 time = waveImpulseDs.readFloat('time', 0.0) if count >= 0 and time > 0.0: deltaTime = time / count deltaImpulse = (endImpulse - startImpulse) / count self.__waveImpulse = WaveImpulse(startImpulse, endImpulse, deltaTime, deltaImpulse) self.clampStartTime() self.__firstLaunch = True self.__modelName = curveSettings.getChannelProperty(0, 'modelName').asString BigWorld.loadResourceListBG((self.__modelName,), self.__onModelLoaded) self.__isOver = True return True
def addTrack(self, isLeft): if self.__entity is None: return else: if self.__flags == 0 and self.__triggerEvents: TriggersManager.g_manager.activateTrigger(TriggersManager.TRIGGER_TYPE.PLAYER_VEHICLE_TRACKS_DAMAGED) if self.__entity.filter.placingOnGround: flying = self.__entity.filter.numLeftTrackContacts == 0 self.__flags |= 1 if isLeft else 2 elif isLeft: flying = self.__baseTrackFashion.isFlyingLeft self.__flags |= 1 else: flying = self.__baseTrackFashion.isFlyingRight self.__flags |= 2 if isLeft: self.__flags |= 1 else: self.__flags |= 2 if self.__model is None and not flying: if not self.__loading: BigWorld.loadResourceListBG((self.__setupTrackAssembler(),), self.__onModelLoaded) self.__loading = True else: self.__setupTracksHiding() return
def init(self, dataSection): if not self._initialized: self.__vehicleUpgradeEffect = _VehicleUpgradeEffect(dataSection) self.__kamikazeActivatedEffect = _KamikazeActivatedEffect( dataSection) self.__trapPoint = _BattleRoyaleTrapPointEffect(dataSection) self.__repairPoint = _BattleRoyaleRepairPointEffect(dataSection) self.__botDeliveryEffect = _BattleRoyaleBotDeliveryEffect( dataSection) self.__botDeliveryMarker = _BattleRoyaleBotDeliveryMarkerArea( dataSection) self.__minesEffects = _MinesEffects( plantEffect=_MinesPlantEffect(dataSection), idleEffect=_MinesIdleEffect(dataSection), destroyEffect=_MinesDestroyEffect(dataSection), blowUpEffectName='minesBlowUpEffect') self.__berserkerEffects = _BerserkerEffects( turretEffect=_BerserkerTurretEffect(dataSection), hullEffect=_BerserkerHullEffect(dataSection), transformPath=dataSection.readString('berserkerTransformPath')) prerequisites = set() self.__dropPlane = _createDropPlane(dataSection['dropPlane'], prerequisites) self.__airDrop = _createAirDrop(dataSection['airDrop'], prerequisites) self.__loots = _createLoots(dataSection, dataSection['lootTypes'], prerequisites) BigWorld.loadResourceListBG( list(prerequisites), makeCallbackWeak(self.__onResourcesLoaded)) super(_BattleRoyaleDynObjects, self).init(dataSection)
def onChunkLoad(self, chunkID, numDestructibles): if self.__spaceID is None: LOG_ERROR("Notification about chunk load came when no space started") return if numDestructibles > 256: if not isPlayerAccount(): self.__logErrorTooMuchDestructibles(chunkID) destrFilenames = BigWorld.wg_getChunkDestrFilenames(self.__spaceID, chunkID) if destrFilenames is None: LOG_ERROR("Can't get destructibles filenames list for space %s, chunk %s" % (self.__spaceID, chunkID)) return for destrIndex in xrange(numDestructibles): self.__setDestructibleInitialState(chunkID, destrIndex) self.__loadedChunkIDs[chunkID] = numDestructibles chunkEntries = self.__destructiblesWaitDestroy.get(chunkID) if chunkEntries is not None: for dmgType, destrData, isNeedAnimation in chunkEntries: self.__destroyDestructible(chunkID, dmgType, destrData, isNeedAnimation) del self.__destructiblesWaitDestroy[chunkID] consideredNames = set() prereqs = set() for fname in destrFilenames: if fname not in consideredNames: consideredNames.add(fname) desc = g_cache.getDescByFilename(fname) if desc is not None: effLists = _extractEffectLists(desc) for effList in effLists: prereqs.update(effList.prerequisites()) if prereqs: BigWorld.loadResourceListBG(list(prereqs), partial(self.__onResourceLoad, self.__spaceID, chunkID))
def _preloadBufferedOneShotEffect(fileName, maxDuration=10.0, prereqs=None): """This method preloads the whole effect buffer given by fileName. If no prerequisites are passed in, then the entire buffer is synchronously created. This may create a pause in the rendering thread. If prerequisites are provided, it immediately queues up one effect, and then asnychronously loads the rest. """ pSection = None if prereqs != None: pSection = prereqs[fileName] else: pSection = ResMgr.openSection(fileName) if not pSection: ERROR_MSG('Could not open file', fileName) return False else: _effectBuffer[fileName] = Queue() queue = _effectBuffer[fileName] bufferSize = pSection.readInt('bufferSize', 5) if prereqs != None: resourceIDs = tuple(prereqs.keys()) queue.put(_BufferedOneShot(fileName, maxDuration, queue, prereqs)) for i in xrange(0, bufferSize - 1): BigWorld.loadResourceListBG( resourceIDs, partial(_onAsyncLoadBufferedEffect, fileName, maxDuration)) else: for i in xrange(0, bufferSize): queue.put(_BufferedOneShot(fileName, maxDuration, queue)) return True
def loadResourceMapping(resourceMapping, callback, *args, **kwargs): resourceLoadingList = [ loader.resourceLoader for loader in resourceMapping.itervalues() ] BigWorld.loadResourceListBG( resourceLoadingList, stricted_loading.makeCallbackWeak(callback, *args, **kwargs))
def __startBuild(self, vDesc, vState): self.__curBuildInd += 1 self.__vDesc = vDesc self.__vState = vState self.__resources = {} self.__vehicleStickers = None self.__componentIDs = {'chassis': vDesc.chassis['models'][vState], 'hull': vDesc.hull['models'][vState], 'turret': vDesc.turret['models'][vState], 'gun': vDesc.gun['models'][vState], 'camouflageExclusionMask': vDesc.type.camouflageExclusionMask} customization = items.vehicles.g_cache.customization(vDesc.type.customizationNationID) if customization is not None and vDesc.camouflages is not None: activeCamo = g_tankActiveCamouflage['historical'].get(vDesc.type.compactDescr) if activeCamo is None: activeCamo = g_tankActiveCamouflage.get(vDesc.type.compactDescr, 0) camouflageID = vDesc.camouflages[activeCamo][0] camouflageDesc = customization['camouflages'].get(camouflageID) if camouflageDesc is not None: self.__componentIDs['camouflageTexture'] = camouflageDesc['texture'] if vState == 'undamaged': self.__emblemsAlpha = _CFG['emblems_alpha_undamaged'] self.__isVehicleDestroyed = False else: self.__emblemsAlpha = _CFG['emblems_alpha_damaged'] self.__isVehicleDestroyed = True resources = self.__componentIDs.values() splineDesc = vDesc.chassis['splineDesc'] if splineDesc is not None: resources.extend(splineDesc.values()) BigWorld.loadResourceListBG(tuple(resources), partial(self.__onResourcesLoaded, self.__curBuildInd)) return
def __loadVehicleCompound(self, vehicleDescr): vehicleName = vehicleDescr.name layout = self.__layouts.get(vehicleName, self.__layouts['default']) if vehicleName in self.__cachedCompound: _logger.debug('Loaded vehicle compound of "%s" from cache', vehicleName) BigWorld.buildBlueprint(self.__cachedCompound[vehicleName], _BLUEPRINT_BG_TEXTURE, layout.projections) self.__inProgress = None return elif vehicleName in self.__pendingCompound: _logger.debug('Vehicle compound of "%s" is loading at the moment.', vehicleName) return else: _logger.debug('Loading vehicle compound of "%s".', vehicleName) self.__pendingCompound.add(vehicleName) resources = (ma.prepareCompoundAssembler(vehicleDescr, ModelsSetParams( '', 'undamaged', []), BigWorld.camera().spaceID, lodIdx=layout.lodIdx, skipMaterials=True), ) BigWorld.loadResourceListBG( resources, makeCallbackWeak(self.__onResourcesLoaded, vehicleName)) return
def __createFlagAt(self, flagID, position, isVisible): if self.__flagModelFile is None: LOG_ERROR('CTFManager: flag model is not specified') return if 'spawnData' not in self.__flags[flagID]: BigWorld.loadResourceListBG((self.__flagModelFile, self.__flagCircleModelFile), partial(self.__onFlagModelLoaded, flagID)) self.__flags[flagID]['spawnData'] = (position, isVisible)
def __init__(self, desc): self.__desc = desc self.__model = None BigWorld.loadResourceListBG((self.__desc.modelName,), self.__onModelLoaded) self.__motor = BigWorld.PyTimedWarplaneMotor(self.__desc.initPointA, self.__desc.initPointB, Bomber.ROLL_SPEED) self.__sound = None self.__destroyed = False
def __createFlagAt(self, flagID, position, isVisible): if self.__flagModelFile is None: LOG_ERROR('CTFManager: flag model is not specified') return else: BigWorld.loadResourceListBG((self.__flagModelFile,), partial(self.__onFlagModelLoaded, flagID, position, isVisible)) return
def _preloadBufferedOneShotEffect(fileName, maxDuration = 10.0, prereqs = None): """This method preloads the whole effect buffer given by fileName. If no prerequisites are passed in, then the entire buffer is synchronously created. This may create a pause in the rendering thread. If prerequisites are provided, it immediately queues up one effect, and then asnychronously loads the rest. """ pSection = None if prereqs != None: pSection = prereqs[fileName] else: pSection = ResMgr.openSection(fileName) if not pSection: ERROR_MSG('Could not open file', fileName) return False else: _effectBuffer[fileName] = Queue() queue = _effectBuffer[fileName] bufferSize = pSection.readInt('bufferSize', 5) if prereqs != None: resourceIDs = tuple(prereqs.keys()) queue.put(_BufferedOneShot(fileName, maxDuration, queue, prereqs)) for i in xrange(0, bufferSize - 1): BigWorld.loadResourceListBG(resourceIDs, partial(_onAsyncLoadBufferedEffect, fileName, maxDuration)) else: for i in xrange(0, bufferSize): queue.put(_BufferedOneShot(fileName, maxDuration, queue)) return True
def addTrack(self, isLeft): if self.__entity is None: return else: if self.__flags == 0 and self.__triggerEvents: TriggersManager.g_manager.activateTrigger( TriggersManager.TRIGGER_TYPE.PLAYER_VEHICLE_TRACKS_DAMAGED) if self.__entity.filter.placingOnGround: flying = self.__entity.filter.numLeftTrackContacts == 0 self.__flags |= 1 if isLeft else 2 elif isLeft: flying = self.__baseTrackFashion.isFlyingLeft self.__flags |= 1 else: flying = self.__baseTrackFashion.isFlyingRight self.__flags |= 2 if isLeft: self.__flags |= 1 else: self.__flags |= 2 if self.__model is None and not flying: if not self.__loading: BigWorld.loadResourceListBG( (self.__setupTrackAssembler(), ), self.__onModelLoaded) self.__loading = True else: self.__setupTracksHiding() return
def onEnterWorld(self, prereqs): _logger.debug('Starting platoon lighting state machine.') if self.animationStateMachine: animationLoader = AnimationSequence.Loader( self.animationStateMachine, self.spaceID) BigWorld.loadResourceListBG( (animationLoader, ), makeCallbackWeak(self.__onAnimatorLoaded)) super(PlatoonLighting, self).onEnterWorld(prereqs)
def __init__(self, desc): self.__desc = desc self.__model = None BigWorld.loadResourceListBG((self.__desc.modelName,), self.__onModelLoaded) self.__motor = BigWorld.PyTimedWarplaneMotor(self.__desc.initPointA, self.__desc.initPointB, Bomber.ROLL_SPEED) self.__sound = None self.__destroyed = False return
def __requestModelsRefresh(self): currentModelState = self.__currentDamageState.modelState assembler = model_assembler.prepareCompoundAssembler( self.__typeDesc, currentModelState, self.__vehicle.spaceID, self.__vehicle.isTurretDetached) BigWorld.loadResourceListBG((assembler, ), makeCallbackWeak(self.__onModelsRefresh, currentModelState))
def assembleCompoundModel2(models, position, vehicleDesc): worldMatrix = mathUtils.createTranslationMatrix(position) chassisFashion = BigWorld.WGVehicleFashion() VehicleAppearance.setupTracksFashion(chassisFashion, vehicleDesc) fashions.append(chassisFashion) gunFashion = BigWorld.WGGunRecoil('G') fashions.append(gunFashion) assembler = prepareCompoundAssembler(vehicleDesc, ModelStates.UNDAMAGED, BigWorld.camera().spaceID if BigWorld.player().spaceID == 0 else BigWorld.player().spaceID) BigWorld.loadResourceListBG((assembler,), functools.partial(setupTank, chassisFashion, gunFashion, vehicleDesc, worldMatrix))
def __requestModelsRefresh(self): modelsSetParams = self.modelsSetParams assembler = model_assembler.prepareCompoundAssembler( self.__typeDesc, modelsSetParams, self.__vehicle.spaceID, self.__vehicle.isTurretDetached) BigWorld.loadResourceListBG((assembler, ), makeCallbackWeak(self.__onModelsRefresh, modelsSetParams.state), loadingPriority(self.__vehicle.id))
def initializeEffect(cls, effectRoot, bwComponent, entityGameObject): appearance = cls.getVehicleAppearance(entityGameObject) effectComponent = effectRoot.findComponentByType( BattleRoyaleAbilities.HealthRestoreAbilityComponent) resourcesList = cls.createParts(effectComponent.getMapping(), appearance) BigWorld.loadResourceListBG( resourcesList, partial(cls.onResourcesLoaded, effectRoot, bwComponent))
def __loadModel(self, trackAssembler): if not IS_EDITOR: BigWorld.loadResourceListBG((trackAssembler, ), self.__onModelLoaded, loadingPriority(self.__entity.id)) self.__loading = True else: self.__loading = True resourceRefs = BigWorld.loadResourceListFG((trackAssembler, )) self.__onModelLoaded(resourceRefs)
def simpleLoad(): import CurrentVehicle a = assemblerModule.prepareCompoundAssembler(CurrentVehicle.g_currentVehicle.item.descriptor, 'undamaged', BigWorld.camera().spaceID) a.assemblerName = 'a' def f(r): global tanks tanks.append(r['a']) BigWorld.loadResourceListBG([a], f)
def onEnterWorld(self, prereqs): super(NewYearCelebrityObject, self).onEnterWorld(prereqs) self._nyController.onStateChanged += self.__onStateChanged self.__onStateChanged() if self.stateMachine: animationLoader = AnimationSequence.Loader(self.stateMachine, self.spaceID) BigWorld.loadResourceListBG((animationLoader,), makeCallbackWeak(self.__onAnimatorLoaded, self.stateMachine)) self._celebrityController.addCelebrityEntity(self) if self.selectionGroupIdx: self.entityGameObject.createComponent(HighlightGroupComponent, self.selectionGroupIdx)
def __init__(self, idx, data): super(AnimationSequenceMarkerComponent, self).__init__(data) animSeqData = data.get(self.maskType)[idx] self.__path = animSeqData.get('path', None) self.__animator = None self.__spaceID = BigWorld.player().spaceID if self.__path is not None: loader = AnimationSequence.Loader(self.__path, self.__spaceID) BigWorld.loadResourceListBG((loader,), makeCallbackWeak(self.__onSequenceLoaded)) return
def __updateSequences(self, outfit): resources = camouflages.getModelAnimatorsPrereqs(outfit, self.__spaceId) resources.extend(camouflages.getAttachmentsAnimatorsPrereqs(self.__attachments, self.__spaceId)) if not resources: self.__clearModelAnimators() if not self.__isVehicleDestroyed: from vehicle_systems import model_assembler model_assembler.assembleCustomLogicComponents(self, self.__vEntity.typeDescriptor, self.__attachments, self.__modelAnimators) return BigWorld.loadResourceListBG(tuple(resources), makeCallbackWeak(self.__onAnimatorsLoaded, self.__curBuildInd, outfit))
def loadComponentSystem(componentSystem, callback, resourceMapping=None): componentSystem = weakref.ref(componentSystem) resourceLoadingList = [ loader.resourceLoader for loader in resourceMapping.itervalues() ] wrappedCallback = None if callback is None else stricted_loading.makeCallbackWeak( callback) loadingCallback = functools.partial(_processLoadedList, componentSystem, wrappedCallback, resourceMapping) BigWorld.loadResourceListBG(resourceLoadingList, loadingCallback) return
def onAdded(self, singleCollision, go): if not singleCollision.asset: _logger.warning( 'Single Collision component with empty asset in gameObject id=%d', go.id) return collisionAssembler = BigWorld.CollisionAssembler( ((0, singleCollision.asset), ), self.spaceID) collisionAssembler.name = 'collision' BigWorld.loadResourceListBG((collisionAssembler, ), functools.partial(self.__onLoaded, go))
def respawn(self, compactDescr): self.onLeaveWorld() self.typeDescriptor = None self.isCrewActive = True self.__isUnderWater = False prereqs = self.prerequisites(compactDescr) time = BigWorld.time() loadFunc = partial(self.__resourcesLoaded, id=self.id, seqtime=time) _g_respawnCache[self.id] = (loadFunc, time) BigWorld.loadResourceListBG(list(prereqs), loadFunc) return
def __createMarkerArea(self, config, equipmentDescr): markerArea = CGF.GameObject(self.__spaceID) effect3D = self.__getEffect(config.getBotDeliveryMarker()) if effect3D is not None: effectPath = effect3D.path markerTerrainPosition = self.__deliveryPosition - equipmentDescr.botSpawnPointOffset BigWorld.loadResourceListBG((AnimationSequence.Loader(effectPath, self.__spaceID),), makeCallbackWeak(self.__on3dEffectLoaded, equipmentDescr, effectPath, markerTerrainPosition)) return markerArea else: _logger.error('Marker Effect is not defined!') return
def __startBuild(self, vDesc, vState): self.__curBuildInd += 1 self.__vState = vState self.__resources = {} self.__vehicleStickers = None cfg = hangarCFG() if vState == 'undamaged': self.__currentEmblemsAlpha = cfg['emblems_alpha_undamaged'] self.__isVehicleDestroyed = False else: self.__currentEmblemsAlpha = cfg['emblems_alpha_damaged'] self.__isVehicleDestroyed = True self.__vDesc = vDesc resources = camouflages.getCamoPrereqs(self.__outfit, vDesc) splineDesc = vDesc.chassis.splineDesc if splineDesc is not None: resources.append(splineDesc.segmentModelLeft) resources.append(splineDesc.segmentModelRight) if splineDesc.leftDesc is not None: resources.append(splineDesc.leftDesc) if splineDesc.rightDesc is not None: resources.append(splineDesc.rightDesc) if splineDesc.segment2ModelLeft is not None: resources.append(splineDesc.segment2ModelLeft) if splineDesc.segment2ModelRight is not None: resources.append(splineDesc.segment2ModelRight) from vehicle_systems import model_assembler resources.append(model_assembler.prepareCompoundAssembler(self.__vDesc, ModelsSetParams(self.__outfit.modelsSet, self.__vState), self.__spaceId)) g_eventBus.handleEvent(CameraRelatedEvents(CameraRelatedEvents.VEHICLE_LOADING, ctx={'started': True, 'vEntityId': self.__vEntity.id}), scope=EVENT_BUS_SCOPE.DEFAULT) cfg = hangarCFG() gunScale = Math.Vector3(1.0, 1.0, 1.1) capsuleScale = Math.Vector3(1.5, 1.5, 1.5) loadedGunScale = cfg.get('cam_capsule_gun_scale', gunScale) if loadedGunScale is not None: gunScale = loadedGunScale loadedCapsuleScale = cfg.get('cam_capsule_scale', capsuleScale) if loadedCapsuleScale is not None: capsuleScale = loadedCapsuleScale bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS), vDesc.chassis.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.HULL), vDesc.hull.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.TURRET), vDesc.turret.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.GUN), vDesc.gun.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.GUN) + 1, vDesc.hull.hitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 2, vDesc.turret.hitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 3, vDesc.gun.hitTester.bspModelName, gunScale)) collisionAssembler = BigWorld.CollisionAssembler(bspModels, self.__spaceId) resources.append(collisionAssembler) physicalTracksBuilders = vDesc.chassis.physicalTracks for name, builder in physicalTracksBuilders.iteritems(): resources.append(builder.createLoader('{0}PhysicalTrack'.format(name))) BigWorld.loadResourceListBG(tuple(resources), makeCallbackWeak(self.__onResourcesLoaded, self.__curBuildInd)) return
def __handlePlaceToyEvent(self, event): self.__clearNodes() modelName = event.ctx['modelName'] effects = _ModelEffects(event.ctx['regularEffectName'], event.ctx['hangingEffectName']) for i in range(self.hardPointCount): BigWorld.loadResourceListBG([modelName], makeCallbackWeak(self.__onModelLoaded, nodeIndex=i + 1, modelName=modelName, effects=effects))
def __createDeliveryEffect(self, config): effect = self.__getEffect(config.getBotDeliveryEffect()) if effect is not None: effectPath = effect.path BigWorld.loadResourceListBG( (AnimationSequence.Loader(effectPath, self.__spaceID), ), makeCallbackWeak(self.__onDeliverEffectLoaded, effectPath, self.__deliveryPosition)) return else: return
def respawn(self, compactDescr): self.onLeaveWorld() self.typeDescriptor = None self.isCrewActive = True self.__isUnderWater = False prereqs = self.prerequisites(compactDescr) mark = random.random() loadFunc = partial(self.__resourcesLoaded, id=self.id, mark=mark) _g_respawnCache[self.id] = (loadFunc, mark, weakref.ref(self)) BigWorld.loadResourceListBG(list(prereqs), loadFunc) return
def __showEffect(self, vehicleID): vehicle = BigWorld.entities.get(vehicleID) if vehicle is None: _logger.warning('Kamikaze effect vehicle not found!') return else: spaceID = BigWorld.player().spaceID effectDescr = self.__getConfig() effectPath = effectDescr.path BigWorld.loadResourceListBG((AnimationSequence.Loader(effectPath, spaceID),), makeCallbackWeak(self.__onResourceLoaded, vehicleID, effectPath)) return
def __init__(self): BigWorld.UserDataObject.__init__(self) self.__prevTime = BigWorld.time() self.__angularVelocity = 2 * math.pi / self.rotationPeriod if not self.rotateClockwise: self.__angularVelocity *= -1 self.__currentAngle = 0.0 self.__updateCallbackId = None self.__model = None self.__modelMatrix = None self.__sound = None BigWorld.loadResourceListBG((self.modelName, self.pixieName), self.__onResourcesLoaded)
def __cacheApperance(self, vId, info): assembler = vehicle_assembler.createAssembler() prereqs = info.typeDescr.prerequisites(True) for hitTester in info.typeDescr.getHitTesters(): if hitTester.bspModelName is not None and not hitTester.isBspModelLoaded(): prereqs.append(hitTester.bspModelName) compoundAssembler, assemblerPrereqs = assembler.prerequisites(info.typeDescr, vId, info.health, info.isCrewActive, info.isTurretDetached) prereqs += assemblerPrereqs self.__assemblersCache[vId] = _AssemblerData(compoundAssembler, assembler, info, prereqs) if self.__spaceLoaded: BigWorld.loadResourceListBG(prereqs, partial(_resourceLoaded, prereqs, vId)) return (compoundAssembler, prereqs)
def __updateSequences(self, outfit): resources = camouflages.getModelAnimatorsPrereqs( outfit, self.__spaceId) resources.extend( camouflages.getAttachmentsAnimatorsPrereqs(self.__attachments, self.__spaceId)) if not resources: self.__clearModelAnimators() return BigWorld.loadResourceListBG( tuple(resources), makeCallbackWeak(self.__onAnimatorsLoaded, self.__curBuildInd, outfit))
def _loadSkyBoxes(self, callback = None, immediate = False): if self.loaded: if callback: callback() elif not immediate: BigWorld.loadResourceListBG(self.skyBoxes, partial(self._onLoadSkyBoxes, callback)) else: resourceRefs = {} for i in self.skyBoxes: try: resourceRefs[i] = BigWorld.Model(i) except ValueError: resourceRefs[i] = BigWorld.Model('') self._onLoadSkyBoxes(callback, resourceRefs)
def create(self, settings, startTime): self.__settings = settings self.__curve = None self.__model = None self.__motor = None self.__sound = None self.__particles = None self.__particlesNode = None self.__cbID = None self.__startTime = startTime self.__fadedIn = False self.__period = self.__settings.readFloat('period', 0.0) self.clampStartTime() self.__firstLaunch = True self.__curve = BigWorld.WGActionCurve(self.__settings) self.__modelName = self.__curve.getChannelProperty(0, 'modelName').asString BigWorld.loadResourceListBG((self.__modelName,), self.__onModelLoaded)
def create(self, settings, startTime): self.__settings = settings self.__curve = None self.__model = None self.__motor = None self.__sound = None self.__particles = None self.__particlesNode = None self.__cbID = None self.__startTime = startTime self.__canStart = True self.__fadedIn = False if BigWorld.serverTime() > self.__startTime + 5.0: self.__canStart = False return else: self.__curve = BigWorld.WGActionCurve(self.__settings) self.__modelName = self.__curve.getChannelProperty(0, 'modelName').asString BigWorld.loadResourceListBG((self.__modelName,), self.__onModelLoaded) return
def __init__(self, mapSettings = None): if mapSettings is None: mapSettings = _getDefaultMapSettings() CallbackDelayer.__init__(self) self.__mapSettings = mapSettings self.__gasAttackSettings = None self.__state = GasAttackState.NO self.__startTime = 0 self.__cloud = None if _ENABLE_DEBUG_LOG: self.__windupTime = 0 self.__evtManager = Event.EventManager() self.onAttackPreparing = Event.Event(self.__evtManager) self.onAttackStarted = Event.Event(self.__evtManager) self.onAttackStopped = Event.Event(self.__evtManager) if not mapSettings.cloudModel: LOG_ERROR('Empty model name for cloud model') else: BigWorld.loadResourceListBG([mapSettings.cloudModel], self.__onCloudModelLoaded) self.__cloudModelResource = None return
def _createFlag(self): raise self.__flagModelFile is not None or AssertionError BigWorld.loadResourceListBG((self.__flagModelFile,), self.__onModelLoaded) return
def startLoadTask(self, resourceList, callbackFn): task = self.__LoadTask() self.__tasks[task] = callbackFn BigWorld.loadResourceListBG(resourceList, partial(self.__onResourcesLoaded, task)) return task
def __requestFakeShadowModel(self): resources = [_CFG['shadow_model_name']] BigWorld.loadResourceListBG(tuple(resources), partial(self.__onFakeShadowLoaded))
def _loadFX(self, callback = None): if self.fxName != '': BigWorld.loadResourceListBG(FX.prerequisites(self.fxName), partial(self._onLoadFX, callback)) elif callback: callback()