Exemplo n.º 1
0
    def dispossessUI(self):
        LOG_DEBUG('dispossessUI')
        self.__clearVoiceChatMicDeviceCallback()
        VOIP.api().localTestMode = False
        VOIP.api().clearEventCaptureDevicesUpdated()
        player = BigWorld.player()
        from Account import PlayerAccount
        if player is not None and player.__class__ == PlayerAccount:
            player.onInitPremium -= self.__onPremiumChanged
        Settings.g_instance.eChangedGraphicsDetails -= self.__onChangeGraphicsDetails
        GlobalEvents.onRefreshResolutions -= self.__handleRefreshResolutions
        InputMapping.g_instance.onProfileLoaded -= self.__inputProfileChanged
        for command in self.__externalCallbacks.iterkeys():
            self.uiHolder.removeExternalCallback(command)

        self.__externalCallbacks = None
        self.__eUpdateSettings()
        self.__gameOptionsManager.destroy()
        self.__gameOptionsManager = None
        Settings.g_instance.cmdFilter = list()
        self.__virtualJoystick.dispose()
        self.__virtualJoystick = None
        self.__virtualGamePad.dispose()
        self.__virtualGamePad = None
        self.__virtualJoystickProfile.dispose()
        self.__virtualJoystickProfile = None
        Settings.g_instance.save()
        UIInterface.dispossessUI(self)
        return
Exemplo n.º 2
0
    def load(self, src, pList, settings, forceLoad):
        if not SoundSettingsLoader.IS_VOICE_CHAT_DEVICES_REFRESHED:
            SoundSettingsLoader.IS_VOICE_CHAT_DEVICES_REFRESHED = True
            VOIP.api().requestCaptureDevices()
        for flashKey, SettingsKey in SOUND_SETTINGS_DICT.iteritems():
            setattr(src, flashKey, settings.getSoundSettings()['volume'][SettingsKey])

        for flashKey, SettingsKey in Settings.SOUND_PARAMETERS.iteritems():
            setattr(src, flashKey, settings.getSoundSettings()['volumeEnabled'][SettingsKey])

        voipPrefs = settings.getVoipSettings()
        for flashKey, SettingsKey in Settings.VOIP_PARAMETERS_DICT.iteritems():
            if SettingsKey == 'isVoipEnabled':
                src.enableVoiceChat = voipPrefs[SettingsKey] and VOIP.api().voipSupported
            elif SettingsKey == 'captureDevice':
                src.voiceChatMicDevice.index = -1
                src.voiceChatMicDevice.data = [voipPrefs[SettingsKey]]
            else:
                setattr(src, flashKey, voipPrefs[SettingsKey])

        src.voiceChatMicActivationButtonId = InputMapping.CMD_PUSH_TO_TALK
        src.voiceChatMicActivationButtonId2 = InputMapping.CMD_PUSH_TO_TALK_SQUAD
        src.voiceChatMicActivationButtonId3 = InputMapping.CMD_TOGGLE_ARENA_VOICE_CHANNEL
        src.isVoiceChatVisible = VOIP.api().voipSupported
        src.isArenaVoiceChatVisible = VOIP.api().arenaChannelSupported
        src.qualitySound.data = [ localizeOptions(quality) for quality in QUALITY_SOUND_LOC ]
        src.qualitySound.index = SOUND_QUALITY_IDX_DICT[settings.getSoundSettings()['quality']]
        src.soundType.data = [ localizeOptions(id) for id in SOUND_TYPE_LOC ]
        src.soundType.index = settings.getSoundSettings()['speakerPreset']
        self._isLoaded = True
 def save(self, value):
     voipCaptureDevices = Settings.g_instance.voipCaptureDevices
     deviceIndex = int(value)
     if 0 <= deviceIndex < len(voipCaptureDevices):
         device = voipCaptureDevices[deviceIndex]
         Settings.g_instance.setVoipValue('captureDevice', device)
         VOIP.api().updateSettings(captureDevice=device)
 def save(self, value):
     Settings.g_instance.setVoipValue(self.__SettingsKey, value)
     if self.__SettingsKey == 'isVoipEnabled':
         VOIP.api().enabled = value
     else:
         key = self.__voipKey if self.__voipKey is not None else self.__SettingsKey
         kwargs = {key: value}
         VOIP.api().updateSettings(**kwargs)
     return
Exemplo n.º 5
0
    def setUserMuted(self, userId, mute):
        try:
            dbid = int(userId)
        except:
            LOG_DEBUG(
                "Xmpp chat: setUserMuted can not request non int value '%s'" %
                userId)
            return

        VOIP.api().setClientMuted(dbid, mute)
Exemplo n.º 6
0
 def editMuteList(self, userId, operationType):
     self._logger.debug(
         "editMuteList fromFlash : userId = '{0}', operationType = '{1}'".
         format(userId, operationType))
     operation = int(operationType)
     operation = bool(operation)
     self._logger.debug(
         "editMuteList: userId = '{0}', operationType = '{1}'".format(
             userId, operation))
     VOIP.api().setAvatarMuted(userId, operationType)
Exemplo n.º 7
0
    def doLeaveWorld(self):
        self.__isBattleUILoaded = False
        self.__eventManager.clear()
        for avatarInfo in self.avatarInfos.values():
            self.__destroyObjectControllers(avatarInfo)

        for objData in self.__allObjectsData.itervalues():
            self.__destroyObjectControllers(objData)

        VOIP.api().unsubscribeMemberStateObserversByType(
            consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES.ARENA_HUD)
        self.gameMode.destroy()
        self._gameActionsManager.cleanup()
        self._gameActionsManager = None
        return
Exemplo n.º 8
0
    def fill(self):
        from clientConsts import SOUND_QUALITY_IDX_DICT, SOUND_SETTINGS_DICT
        import VOIP
        import Settings
        settings = Settings.g_instance
        container = dict()
        container[GAME_OPTIONS_STATS.IS_VOICE_CHAT_VISIBLE] = VOIP.api(
        ).voipSupported
        container[GAME_OPTIONS_STATS.IS_ARENA_VOICE_CHAT_VISIBLE] = VOIP.api(
        ).arenaChannelSupported
        container[
            GAME_OPTIONS_STATS.QUALITY_SOUND_INDEX] = SOUND_QUALITY_IDX_DICT[
                settings.getSoundSettings()['quality']]
        for flashKey, SettingsKey in SOUND_SETTINGS_DICT.iteritems():
            id = GAME_OPTIONS_STATS.__dict__.get(
                'SOUND_SETTINGS_' + SettingsKey.upper(), None)
            if id is not None:
                container[id] = settings.getSoundSettings(
                )['volume'][SettingsKey]

        for flashKey, SettingsKey in Settings.SOUND_PARAMETERS.iteritems():
            id = GAME_OPTIONS_STATS.__dict__.get(
                'SOUND_PARAMETERS_' + SettingsKey.upper(), None)
            if id is not None:
                container[id] = settings.getSoundSettings(
                )['volumeEnabled'][SettingsKey]

        voipPrefs = settings.getVoipSettings()
        for flashKey, SettingsKey in Settings.VOIP_PARAMETERS_DICT.iteritems():
            if SettingsKey == 'isVoipEnabled':
                container[GAME_OPTIONS_STATS.ENABLE_VOICE_CHAT] = voipPrefs[
                    SettingsKey] and VOIP.api().voipSupported
            elif SettingsKey == 'captureDevice':
                pass
            else:
                id = GAME_OPTIONS_STATS.__dict__.get(
                    'VOIP_PARAMETERS_' + SettingsKey.upper(), None)
                if id is not None:
                    container[id] = voipPrefs[SettingsKey]

        self._checkForSubmit(container)
        return
Exemplo n.º 9
0
    def populateUI(self, proxy):
        UIInterface.populateUI(self, proxy)
        self.uiHolder.movie.backgroundAlpha = 0
        self.uiHolder.addExternalCallbacks(self.__externalCallbacks)
        GlobalEvents.onRefreshResolutions += self.__handleRefreshResolutions
        VOIP.api().eventCaptureDevicesUpdated += self.__onCaptureDevicesUpdated
        Settings.g_instance.eChangedGraphicsDetails += self.__onChangeGraphicsDetails
        InputMapping.g_instance.onProfileLoaded += self.__inputProfileChanged
        player = BigWorld.player()
        from Account import PlayerAccount
        if player is not None and player.__class__ == PlayerAccount:
            player.onInitPremium += self.__onPremiumChanged
        self.call_1('settings.initialized')

        class VirtualJoystickProfile:
            def __init__(self, sendPrimaryAxisCallBack):
                """
                @param sendPrimaryAxisCallBack: function (axis, value)
                """
                self.__sendPrimaryAxisCallBack = sendPrimaryAxisCallBack

            def sendData(self, axis, value, rawValue):
                if self.__sendPrimaryAxisCallBack is not None:
                    self.__sendPrimaryAxisCallBack(axis, value, rawValue)
                return

            def dispose(self):
                self.__sendPrimaryAxisCallBack = None
                return

        self.__virtualJoystickProfile = VirtualJoystickProfile(
            self.__sendPrimaryAxis)
        from input.InputSubsystem.JoyInput import JoystickExpertInput
        self.__virtualJoystick = JoystickExpertInput(
            self.__virtualJoystickProfile)
        from input.InputSubsystem.GamepadInput import GamePadExpertInput
        self.__virtualGamePad = GamePadExpertInput(
            self.__virtualJoystickProfile)
        self.__virtualJoystick.setRawForceAxis(False)
        LOG_DEBUG('populateUI')
        return
Exemplo n.º 10
0
    def obdataResponse(callback, dbgCallback, movieClipRef, responseob):
        headers, respdata, code = responseob
        try:
            if respdata:
                for ifaces, idTypeList in respdata:
                    if 'ISquad' in ifaces:
                        import VOIP
                        VOIP.api().updateSquad(idTypeList[0][0], ifaces['ISquad'])

        except:
            pass

        movieClip = movieClipRef()
        if movieClip:
            if dbgCallback:
                dbgCallback(respdata)
            if code == 0:
                movieClip.subscribeIFace(respdata, callback, False)
                sendDataToUICallbacks(headers, respdata, callback, movieClip, broadcast=headers[1] != METHODTOINDEX['view'] or callback is None)
            elif callback:
                movieClip.call_1(callback, respdata, code)
        else:
            LOG_WARNING('obdataRequest: Movie already unloaded')
        return
Exemplo n.º 11
0
def prepareControlsGroup(mapping, groupID, controls):
    for cmdID, record in mapping.iteritems():
        cmd = record['cmdName']
        cmdLabel = InputMapping.getCommandLocalization(cmd)
        isHide = InputMapping.getCommandHideStatus(cmd)
        if cmdLabel is not None and not isHide and not (
            (cmdID == InputMapping.CMD_PUSH_TO_TALK
             or cmdID == InputMapping.CMD_PUSH_TO_TALK_SQUAD
             or cmdID == InputMapping.CMD_TOGGLE_ARENA_VOICE_CHANNEL)
                and not VOIP.api().voipSupported):
            LOG_DEBUG('__ prepareControlsGroup : show ', cmd)
            if groupID == InputMapping.g_descriptions.getCommandGroupID(
                    cmd) or groupID == 'SETTINGS_BASIC' and record['isBase']:
                commandVO = CommandVO()
                commandVO.id = cmdID
                commandVO.title = cmdLabel
                commandVO.switchingStyle = record['switchingStyle']
                commandVO.enabled = cmd not in Settings.g_instance.cmdFilter
                isFireAxis = len(record['linkedAxisName']) <= 0
                commandVO.axes.sign = record['fireAxisSign']
                if not isFireAxis:
                    commandVO.axes.axisDeadzone = record['linkedAxisDeadZone']
                    commandVO.axes.axisInverted = record['linkedAxisInverted']
                    commandVO.axes.axisSensitivity = record[
                        'linkedAxisSensitivity']
                    commandVO.axes.axisGroup = record['linkedAxisName']
                    commandVO.axes.axisSmoothing = record[
                        'linkedAxisSmoothWindow']
                commandVO.axes.axisDeviceId = str(record[
                    'fireAxisDevice' if isFireAxis else 'linkedAxisDevice'])
                commandVO.axes.axisDeviceName = record[
                    'fireAxisDeviceName'
                    if isFireAxis else 'linkedAxisDeviceName']
                commandVO.axes.axisId = record[
                    'fireAxisIndex' if isFireAxis else 'linkedAxisIndex']
                commandVO.axes.axisLabel = InputMapping.getAxisLocalization(
                    commandVO.axes.axisId)
                for key in record['keyNames']:
                    buttonEntryVO = ButtonEntryVO()
                    buttonEntryVO.id = key['name']
                    buttonEntryVO.deviceId = str(key['device'])
                    buttonEntryVO.label = InputMapping.getKeyLocalization(
                        key['name'])
                    commandVO.buttons.append(buttonEntryVO)

                controls.append(commandVO)

    return
Exemplo n.º 12
0
 def __switchTab(self, tab):
     if tab != SETTINGS_TABS.AUDIO:
         self.__clearVoiceChatMicDeviceCallback()
         VOIP.api().localTestMode = False
Exemplo n.º 13
0
 def getMuteList(self):
     VOIP.api().requestMuteList(self.receiveMuteList)
Exemplo n.º 14
0
 def load(self, src, pList, settings, forceLoad):
     VOIP.api().localTestMode = not VOIP.api().localTestMode
Exemplo n.º 15
0
 def load(self, src, pList, settings, forceLoad):
     VOIP.api().requestCaptureDevices()
Exemplo n.º 16
0
    def __onNewAvatarsInfo(self, argStr):
        newAvatarsList = translateDictThroughAnother(
            wgPickle.loads(wgPickle.FromServerToClient, argStr),
            NEW_AVATARS_INFO_KEYS_INVERT_DICT, True)
        LOG_INFO('__onNewAvatarsInfo', self.__ownerID,
                 [avatarData['avatarID'] for avatarData in newAvatarsList])
        LOG_INFO('INFO extUpgrades',
                 [(avatarData['avatarID'], avatarData['extUpgrades'])
                  for avatarData in newAvatarsList])
        for avatarData in newAvatarsList:
            avatarID = avatarData['avatarID']
            airplaneInfo = avatarData['airplaneInfo']
            currentOwner = None
            avatarData['planeTypeRank'] = dict(avatarData['planeTypeRank'])
            avatarPrevInfo = self.avatarInfos.get(avatarID, None)
            if not avatarPrevInfo:
                self.avatarInfos[avatarID] = avatarData
            else:
                if 'airplaneInfo' in avatarPrevInfo and avatarPrevInfo[
                        'airplaneInfo']['globalID'] != airplaneInfo['globalID']:
                    self.onBeforePlaneChanged(avatarID)
                    currentOwner = self.__destroyControllers(avatarPrevInfo)
                self.avatarInfos[avatarID].update(avatarData)
            extUpgrades = dict(avatarData['extUpgrades'])
            pilotUpgradeId = extUpgrades.get(LOGICAL_PART.PILOT, 1)
            controllersData = self.createControllers(
                avatarID,
                airplaneInfo['globalID'],
                camouflage=airplaneInfo['camouflage'],
                decals=airplaneInfo['decals'],
                pilotUpgradeId=pilotUpgradeId)
            if currentOwner:
                currentOwner.registerControllers(controllersData)
                self.onAvatarChangedPlane(currentOwner.id)
                if currentOwner == BigWorld.player():
                    self.onRecreateAvatar()
            avatarInfo = self.avatarInfos[avatarID]
            if avatarInfo['isNPC']:
                if avatarInfo['NPCType'] == ACNPCTypes.Bomber:
                    avatarInfo['playerName'] = localizeLobby(
                        avatarInfo['playerName'])
                elif avatarInfo['NPCType'] == ACNPCTypes.Defender:
                    avatarInfo['playerName'] = localizeHUD(
                        avatarInfo['playerName'])
            else:
                avatarInfo['playerName'] = getBotName(
                    avatarData['playerName'],
                    getAirplaneConfiguration(airplaneInfo['globalID']).planeID)
            avatarInfo['maxHealth'] = avatarData['maxHealth']
            avatarInfo['equipment'] = avatarData['equipment']
            if avatarID == BigWorld.player().id:
                LOG_TRACE('ClientArena: VOIP.initialize()')
                wasInit = bool(VOIP.api())
                VOIP.initialize(avatarInfo['databaseID'])
                if not wasInit:
                    VOIP.api().onEnterArenaScreen()

        self.__sortAvatars()
        for ids in self.__sortedAvatarsIDs.values():
            for i, avatarID in enumerate(ids):
                self.avatarInfos[avatarID]['airplaneInfo']['decals'][4] = i + 1
                self.avatarInfos[avatarID][
                    'modelManipulator'].surface.setDecalsByIds(
                        self.avatarInfos[avatarID]['airplaneInfo']
                        ['camouflage'],
                        self.avatarInfos[avatarID]['airplaneInfo']['decals'])

        teamMembers = dict()
        for avatarID, info in self.avatarInfos.iteritems():
            if info['teamIndex'] == BigWorld.player().teamIndex:
                teamMembers[info['databaseID']] = avatarID

        VOIP.api().unsubscribeMemberStateObserversByType(
            consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES.ARENA_HUD)
        VOIP.api().subscribeMemberStateObserver(
            consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES.ARENA_HUD, teamMembers)
        self.__avatarsDataReceived = True
        self.onNewAvatarsInfo(newAvatarsList)
        return