def __init__(self): self.__isEnabled = False self.__lightObject = BigWorld.WGLightFx() self.__lights = {} self.__isEnabled = self.__lightObject.initialize() if not self.__isEnabled: LOG_DEBUG('LightFx is not enabled') return else: self.__lightObject.reset() LightEffectsCache.load() for lightEffect in LightEffectsCache.allEffects().values(): lightEffect.onStop += self.__onEffectStop numberOfDevices = self.__lightObject.getNumberOfDevices() for deviceIndex in range(numberOfDevices): numberOfLights = self.__lightObject.getNumberOfLights(deviceIndex) for lightIndex in range(numberOfLights): lightDescription = self.__lightObject.getLightDescription(deviceIndex, lightIndex) self.__lights[lightDescription] = (deviceIndex, lightIndex) self.__runningEffects = [] self.__lastUpdateTime = None self.__periodicTimerID = None LightManager._chatActionsHandler = _ChatActionsHandler() self.__periodicUpdate() return
def startLightEffect(self, lightEffectName): if not self.isEnabled(): return lightEffect = LightEffectsCache.getEffect(lightEffectName) if not lightEffect.isRunning(): self.__runningEffects.append(lightEffect) lightEffect.start() for oneLightAction in lightEffect.lightActions.values(): self.setLightAction(oneLightAction.lightDescription, oneLightAction.color, oneLightAction.action)
def destroy(self): if not self.__isEnabled: return if self.__periodicTimerID is not None: BigWorld.cancelCallback(self.__periodicTimerID) for lightEffect in LightEffectsCache.allEffects().values(): lightEffect.destroy() LightManager._chatActionsHandler.destroy()
def stopLightEffect(self, lightEffectName): if not self.isEnabled(): return lightEffect = LightEffectsCache.getEffect(lightEffectName) if lightEffect.isRunning(): lightEffect.stop()