def __loadSmokeScreen(self, equipmentID, position):
     smokeScreenEquipment = vehicles.g_cache.equipments()[equipmentID]
     settingsData = ResMgr.openSection(ENVIRONMENT_EFFECTS_CONFIG_FILE +
                                       '/' +
                                       smokeScreenEquipment.smokeEffectName)
     if settingsData is None:
         return
     else:
         smokeEffect = effectsFromSection(settingsData)
         player = BigWorld.player()
         if player is None:
             return
         self.__effectID = player.terrainEffects.addNew(
             position, smokeEffect.effectsList, smokeEffect.keyPoints, None)
         return
예제 #2
0
 def __init__(self, pointModelName, effectsSectionName):
     self.__modelFile = None
     self.__model = None
     self.__effectsTimeLine = None
     self.__effectsPlayer = None
     self.__loadTask = None
     g_ctfManager.registerResourcePointModel(self)
     modelParams = _g_ctfConfig.readModelParams(pointModelName)
     if modelParams is not None:
         self.__modelFile = modelParams.get('file')
     if self.__modelFile is None:
         LOG_ERROR('%s: can\'t find the "%s" model.' % (_g_ctfConfig.name, pointModelName))
     effectsSection = _g_ctfConfig.readFirstLvlSection(effectsSectionName)
     if effectsSection is not None:
         self.__effectsTimeLine = effectsFromSection(effectsSection)
예제 #3
0
    def __readHeroEffects(self):
        if not self.effectsXmlPath:
            return
        else:
            rootSection = ResMgr.openSection(self.effectsXmlPath)
            if rootSection is None:
                return
            effectsSection = rootSection['effects']
            if effectsSection is None:
                return
            for effectValues in effectsSection.values():
                name = effectValues.name
                effect = effectsFromSection(effectValues)
                player = EffectsListPlayer(effect.effectsList,
                                           effect.keyPoints)
                self.__effects[name] = player

            return
예제 #4
0
    def activate(self):
        gameObject = CGF.GameObject(self.spaceID)
        self.gameObject = gameObject
        pointDescr = _getTrapOrRepairPointDescr(self.equipmentID)
        from AffectComponent import getInfluenceZoneType
        self.__influenceZoneType = getInfluenceZoneType(pointDescr)
        dynObjCache = dependency.instance(IBattleDynamicObjectsCache)
        config = dynObjCache.getConfig(BigWorld.player().arenaGuiType)
        effectConfig = self.__getEffectConfig(config)
        if effectConfig is not None:
            import AnimationSequence
            effectPath = effectConfig.path
            if pointDescr.fireEffectName:
                player = BigWorld.player()
                if player is None:
                    return
                environmentEffectsConfigFile = 'scripts/dynamic_objects.xml'
                settingsData = ResMgr.openSection(
                    environmentEffectsConfigFile + '/' +
                    pointDescr.fireEffectName)
                if settingsData is None:
                    return
                fireEffect = effectsFromSection(settingsData)
                firePoints = []
                firePoints.extend(self.zonesPosition)
                for position in firePoints:
                    self.fireIDs.append(
                        player.terrainEffects.addNew(position,
                                                     fireEffect.effectsList,
                                                     fireEffect.keyPoints,
                                                     None))

            for position in self.zonesPosition:
                BigWorld.loadResourceListBG(
                    (AnimationSequence.Loader(effectPath,
                                              BigWorld.player().spaceID), ),
                    makeCallbackWeak(self.__onResourceLoaded, effectPath,
                                     position, effectConfig.scaleRatio,
                                     pointDescr))

        else:
            _logger.debug('Trap point: Effect name is not defined')
        self.gameObject.activate()
        return
 def __playEffect(self, effectName, model):
     if self.__effectsPlayer is not None or None in (model, effectName):
         return
     else:
         effectsSection = destructible_entities.g_destructibleEntitiesCache.getDestroyEffectList(
             effectName)
         if effectsSection is None:
             return
         effects = effectsFromSection(effectsSection)
         if effects is None:
             return
         fakeModel = helpers.newFakeModel()
         BigWorld.player().addModel(fakeModel)
         tmpMatrix = Math.Matrix(self.__visualModel.matrix)
         fakeModel.position = tmpMatrix.translation
         self.__effectsPlayer = EffectsListPlayer(effects.effectsList,
                                                  effects.keyPoints)
         self.__effectsPlayer.play(fakeModel, None)
         return
예제 #6
0
    def __readEffects(self):
        effects = ResMgr.openSection(_TOY_EFFECTS_CONFIG_FILE) or {}
        for effect in effects.values():
            self.__effectsCache[effect.name] = effectsFromSection(effect)

        ResMgr.purge(_TOY_EFFECTS_CONFIG_FILE, True)