コード例 #1
0
class SoundManager(SoundManagerMeta):

    def __init__(self):
        DAAPIModule.__init__(self)
        self.sounds = GuiSoundsLoader()

    def _populate(self):
        super(SoundManager, self)._populate()
        try:
            self.sounds.load()
        except Exception:
            LOG_ERROR('There is error while loading sounds xml data')
            LOG_CURRENT_EXCEPTION()

    def soundEventHandler(self, soundsTypeSection, state, type, id):
        self.playControlSound(state, type, id)

    def playControlSound(self, state, type, id):
        sound = self.sounds.getControlSound(type, state, id)
        if sound is not None:
            Sound(sound).play()
            if state == 'press':
                VibroManager.g_instance.playButtonClickEffect(type)
        return

    def playEffectSound(self, effectName):
        sound = self.sounds.getEffectSound(effectName)
        if sound is not None:
            Sound(sound).play()
        return
コード例 #2
0
class SoundManager(SoundManagerMeta):
    def __init__(self):
        super(SoundManager, self).__init__()
        self.sounds = GuiSoundsLoader()

    def _populate(self):
        super(SoundManager, self)._populate()
        try:
            self.sounds.load()
        except Exception:
            LOG_ERROR('There is error while loading sounds xml data')
            LOG_CURRENT_EXCEPTION()

    def soundEventHandler(self, soundsTypeSection, state, eventType, eventID):
        self.playControlSound(state, eventType, eventID)

    def playControlSound(self, state, eventType, eventID):
        sound = self.sounds.getControlSound(eventType, state, eventID)
        if sound is not None:
            SoundGroups.g_instance.playSound2D(sound)
            if state == 'press':
                VibroManager.g_instance.playButtonClickEffect(eventType)
        return

    def playEffectSound(self, effectName):
        sound = self.sounds.getEffectSound(effectName)
        if sound is not None:
            SoundGroups.g_instance.playSound2D(sound)
        else:
            _logger.warning('Sound effect "%s" not found', effectName)
        return
コード例 #3
0
ファイル: soundmanager.py プロジェクト: v3ss0n/WOTDecompiled
class SoundManager(SoundManagerMeta):
    def __init__(self):
        DAAPIModule.__init__(self)
        self.sounds = GuiSoundsLoader()

    def _populate(self):
        super(SoundManager, self)._populate()
        try:
            self.sounds.load()
        except Exception:
            LOG_ERROR('There is error while loading sounds xml data')
            LOG_CURRENT_EXCEPTION()

    def soundEventHandler(self, soundsTypeSection, state, type, id):
        self.playControlSound(state, type, id)

    def playControlSound(self, state, type, id):
        sound = self.sounds.getControlSound(type, state, id)
        if sound is not None:
            Sound(sound).play()
            if state == 'press':
                VibroManager.g_instance.playButtonClickEffect(type)
        return

    def playEffectSound(self, effectName):
        sound = self.sounds.getEffectSound(effectName)
        if sound is not None:
            Sound(sound).play()
        return