Esempio n. 1
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 load(self, profileVO, profilePrimary):
        profileVO.cameraType = profilePrimary.CAMERA_TYPE
        profileVO.mouseInvertVert = profilePrimary.MOUSE_INVERT_VERT
        profileVO.safeRollOnLowAltitude = profilePrimary.SAFE_ROLL_ON_LOW_ALTITUDE
        profileVO.allowLead = profilePrimary.ALLOW_LEAD
        profileVO.automaticFlaps = profilePrimary.AUTOMATIC_FLAPS
        if hasattr(profilePrimary, MOUSE_INTENSITY_SPLINE_KEY):
            points = getattr(profilePrimary, MOUSE_INTENSITY_SPLINE_KEY).p
            for i, key in enumerate(MOUSE_TIGHTENING_KEYS):
                getattr(profileVO,
                        key).x, getattr(profileVO,
                                        key).y = points[i].x, points[i].y

        profileVO.supermouseCameraFlexibility = profilePrimary.CAMERA_FLEXIBILITY
        profileVO.radiusOfConducting = profilePrimary.RADIUS_OF_CONDUCTING
        profileVO.supermouseEqualizerForce = profilePrimary.EQUALIZER_FORCE
        profileVO.supermouseEqualizerZoneSize = profilePrimary.EQUALIZER_ZONE_SIZE
        profileVO.supermouseRollSpeed = profilePrimary.ROLL_SPEED_CFC
        profileVO.supermouseRotationZoneDepth = profilePrimary.SHIFT_TURN
        profileVO.cameraRollSpeed = profilePrimary.CAMERA_ROLL_SPEED
        profileVO.cameraAngle = profilePrimary.CAMERA_ANGLE
        profileVO.cameraAcceleration = profilePrimary.CAMERA_ACCELERATION
        profileVO.methodOfMixing.index = profilePrimary.METHOD_OF_MIXING
        profileVO.methodOfMixing.data = [
            localizeOptions('SETTINGS_MOUSE_MIXING_ALWAYS'),
            localizeOptions('SETTINGS_MOUSE_MIXING_HALF'),
            localizeOptions('SETTINGS_MOUSE_MIXING_BATTLECAM_ONLY')
        ]
Esempio n. 3
0
    def load(self, src, pList, settings, forceLoad):
        from gui.Scaleform.GameOptions.vo.HUDSettingsVO import MarkerTargetsVO, MarkerListVO, MarkerTypeVO
        baseData = Settings.g_instance.markersBaseData
        markers = settings.markersTemplates
        src.selectedSystemType = Settings.g_instance.gameUI[
            'measurementSystem']
        src.systemType = list()
        for systemType in [0, 1]:
            systemVo = MarkerTypeVO()
            stDistance = list()
            for key in g_instaceMarkerDistance().stepsDistance:
                stDistance.append(getValueBySystem(systemType, key))

            systemVo.stepsDistance = stDistance
            systemVo.altCmd = InputMapping.CMD_SHOW_PLAYERS_INFO
            for targetType in MARKER_TARGET_TYPE:
                target = getattr(systemVo.data, targetType)
                for key in AVAILABLE_MARKER_PROPERTIES:
                    addVO = getattr(target, key)
                    addVO.title = localizeOptions(
                        baseData[key][targetType]['label'])
                    addVO.tooltip = localizeTooltips(
                        baseData[key][targetType]['tooltip'])
                    addVO.data = list()
                    listData = baseData[key][targetType]['list']
                    for value in listData:
                        markerListVO = MarkerListVO()
                        num = getValueBySystem(systemType, value)
                        markerListVO.label = localizeOptions(
                            localizeMarkerValues(key, num))
                        markerListVO.num = num
                        addVO.data.append(markerListVO)

            src.systemType.append(systemVo)

        src.templates = list()
        for i in range(Settings.g_instance.countTemplates):
            vo = MarkerTargetsVO()
            isDefault = settings.getMarkerTemplateType(
            ) == 'SettingsDefaultMarker'
            loc = localizeOptions(localizeMarkerByPlane(isDefault, i))
            vo.label = loc
            for vehicleType in ('airMarker', 'groundMarker'):
                voVehicleType = getattr(vo, vehicleType)
                for targetType in ('enemy', 'target', 'friendly', 'squads'):
                    voTargetType = getattr(voVehicleType, targetType)
                    for altState in ('basic', 'alt'):
                        voAltState = getattr(voTargetType, altState)
                        for key in AVAILABLE_MARKER_PROPERTIES:
                            setattr(
                                voAltState, key, markers[vehicleType]
                                [targetType][altState][key][i])

            src.templates.append(vo)

        src.selectIDS = settings.selectedMarkers[:]
        self._isLoaded = True
Esempio n. 4
0
    def load(self, src, pList, settings, forceLoad):
        graphicsDetails = settings.graphicsDetails
        src.isHDContent = settings.isHDContent()
        src.graphicsWin32 = isLowMemory()
        src.waitVSync = settings.isVideoVSync()
        src.videoMode.modes.data = list()
        for i, locID in VIDE_MODES_KEYS_LOC.iteritems():
            src.videoMode.modes.data.insert(i, localizeOptions(locID))

        src.videoMode.modes.index = settings.getWindowMode()
        src.graphicsGamma = settings.getGamma()
        src.gsAutodetectEnabled = settings.gsAutodetectEnabled
        graphicsPresetKeys = settings.getGraphicsPresetKeys()
        src.videoMode.resolutions.data, src.videoMode.resolutions.index = settings.getVideoResolutions(
        )
        src.graphicsQuality.data = list(graphicsPresetKeys)
        for i in range(0, len(src.graphicsQuality.data)):
            src.graphicsQuality.data[i] = localizeOptions(
                src.graphicsQuality.data[i].upper().replace(' ', ''))

        src.graphicsQuality.index = Settings.g_instance.getIndexByValueGraphicsDetails(
            graphicsDetails)
        gdList = settings.graphicsPresets.getSettingValues()
        graphicsDetailsConfig = settings.graphicsPresets.getPresetValues()
        for key in graphicsPresetKeys:
            graphicsDetail = graphicsDetailsConfig.get(key, None)
            graphicsProfile = getattr(src.graphicProfiles,
                                      GRAPHICS_PRESET_KEYS.get(key))
            if graphicsDetail is not None:
                for graphicsDetailName, graphicsDetailValue in graphicsDetail.iteritems(
                ):
                    for detail in gdList:
                        detailID = detail[0]
                        if detailID == graphicsDetailName:
                            gSCommonVO = getattr(
                                graphicsProfile,
                                GRAPHICS_QUALITY_KEYS.get(detailID))
                            gSCommonVO.title = localizeOptions(
                                'SETTINGS_GS_%s' % settings.graphicsPresets.
                                showGraphicsSettingLocalize[detailID])
                            gSCommonVO.setting.data = [
                                localizeOptions(label) for label in detail[1]
                            ]
                            gSCommonVO.setting.index = graphicsDetailValue
                            break

        self._isLoaded = True
        return
    def load(self, src):
        profiles = InputMapping.g_instance.getProfileNames()
        curProfileName = InputMapping.g_instance.getCurProfileName()
        profilesSorted = [
            profileName for profileName in ORDER_PROFILES
            if profileName in profiles
        ]
        for profileName in profiles:
            if profileName not in profilesSorted:
                profilesSorted.append(profileName)
                LOG_DEBUG(
                    '__sendInputConfig - profileName(%s) was added to list without sorting'
                    % profileName)

        curProfileIndex = 0
        for profile in profilesSorted:
            if profile in INPUT_SYSTEM_PROFILES_LIST:
                profileID = INPUT_SYSTEM_PROFILES_LIST[profile]
                if profileID not in INPUT_SYSTEM_PROFILES:
                    LOG_ERROR(
                        '__sendInputConfig - profileID(%s) not in INPUT_SYSTEM_PROFILES(%s)'
                        % (profileID, INPUT_SYSTEM_PROFILES))
                keyValue = KeyValue()
                keyValue.key = INPUT_SYSTEM_PROFILES[profileID]
                keyValue.label = localizeOptions('CONTROL_PROFILE_%s' %
                                                 profile.upper())
                src.controlProfiles.data.append(keyValue)
                if curProfileName == profile:
                    src.controlProfiles.index = curProfileIndex
                curProfileIndex += 1
            else:
                LOG_DEBUG(
                    '__sendInputConfig - %s not in INPUT_SYSTEM_PROFILES_LIST'
                    % profile)
def prepareControls(mapping, container):
    for groupID in ALL_CONTROLS_GROUPS:
        o = GroupControlVO()
        o.id = groupID
        o.title = localizeOptions(groupID)
        prepareControlsGroup(mapping, groupID, o.controls)
        container.append(o)
Esempio n. 7
0
    def getLocalizedProfileNames(self):
        locProfiles = []
        profiles = self.getProfileNames()
        for profile in profiles:
            locProfiles.append(
                localizeOptions('CONTROL_PROFILE_' + profile.upper()))

        return locProfiles
 def load(self, container):
     container.turnGamepadCmd = InputMapping.CMD_GAMEPAD_TURN_LEFT
     container.pitchGamepadCmd = InputMapping.CMD_GAMEPAD_PITCH_DOWN
     container.rollGamepadCmd = InputMapping.CMD_ROLL_LEFT
     container.forceGamepadCmd = InputMapping.CMD_INCREASE_FORCE
     container.cmdFreeVerticalCam = InputMapping.CMD_FREE_VERTICAL_CAM_GAMEPA
     container.cmdFreeHorizontalCam = InputMapping.CMD_FREE_HORIZONTAL_CAM_GAMEPAD
     container.rollCmd = InputMapping.CMD_ROLL_LEFT
     container.pitchCmd = InputMapping.CMD_PITCH_DOWN
     container.turnCmd = InputMapping.CMD_TURN_LEFT
     container.forceCmd = InputMapping.CMD_INCREASE_FORCE
     container.cmdFreeVerticalCamDesc = localizeOptions(
         'TOOLTIP_SETTINGS_GAMEPAD_VERTICAL_VIEW')
     container.cmdFreeHorizontalCamDesc = localizeOptions(
         'TOOLTIP_SETTINGS_GAMEPAD_HORIZONTAL_VIEW')
     container.rollCmdDesc = localizeOptions(
         'TOOLTIP_SETTINGS_GAMEPAD_ROLL')
     container.pitchCmdDesc = localizeOptions(
         'TOOLTIP_SETTINGS_JOYSTICK_VERTICAL_AXIS')
     container.turnCmdDesc = localizeOptions(
         'TOOLTIP_SETTINGS_GAMEPAD_HORIZONTAL_AXIS')
     container.forceCmdDesc = localizeOptions(
         'TOOLTIP_SETTINGS_GAMEPAD_THRUST')
     container.inputHorizontalAxisId = HORIZONTAL_AXIS
     container.inputVerticalAxisId = VERTICAL_AXIS
     container.inputRollAxisId = ROLL_AXIS
     container.inputForceAxisId = FORCE_AXIS
     container.inputFlapsAxisId = FLAPS_AXIS
     container.inputFreeVerticalCamGamepadAxisId = FLAPS_AXIS
     container.inputFreeHorizontalCamGamepadAxisId = FLAPS_AXIS
     container.freeVerticalCamGamepadCmd = InputMapping.CMD_FREE_VERTICAL_CAM_GAMEPA
     container.freeHorizontalCamGamepadCmd = InputMapping.CMD_FREE_HORIZONTAL_CAM_GAMEPAD
    def _loadPresetsArray(self, settings, profileName, profileID, profileVO):
        if profileName not in self._profilePresetArrayLoaded:
            self._profilePresetArrayLoaded.append(profileName)
            presets = settings.inputProfilesPresets.get(profileName, None)
            if presets is not None:
                for i, preset in enumerate(presets):
                    presetName = preset['name']
                    presetID = len(profileVO.profilePreset.data)
                    if settings.inputProfilesPresetsCurrent[
                            profileName] == presetName:
                        profileVO.profilePreset.index = i
                    flashKey = ALL_PRESETS_KEYS_REVERT[profileID].get(
                        presetName)
                    if flashKey is not None:
                        keyValue = KeyValue()
                        keyValue.key = flashKey
                        keyValue.label = localizeOptions(
                            preset['localizationID'])
                        profileVO.profilePreset.data.append(keyValue)
                        profilePresetVO = getattr(profileVO, flashKey)
                        profilePresetVO.id = presetID

        return
Esempio n. 10
0
 def onSellPlaneResponse(self, resultID, aircraftID):
     """see AccountCommands.py for actual resultID format"""
     LOG_DEBUG('shop.sellPlaneResponse', resultID)
     if resultID == OPERATION_RETURN_CODE.SUCCESS:
         self.__lobbyCarouselHelper.removeCarouselAirplane(aircraftID)
         self.__lobbyCarouselHelper.inventory.syncAircraftsData(
             [aircraftID],
             partial(self.__sellPlaneResponse, resultID, aircraftID))
     else:
         if SyncOperationKeeper.getFlagStatus(FLAGS_CODE.SELL_PLANE):
             self.__lobby.call_1('shop.sellPlaneResponse', resultID)
             SyncOperationKeeper.stop(FLAGS_CODE.SELL_PLANE)
         if resultID == OPERATION_RETURN_CODE.FAILURE_MAX_SOLD_PLANES_PER_DAY_REACHED:
             msgHeader = localizeMessages('SYSTEM_MESSAGE_ERROR_HEADER')
             planeName = localizeAirplane(
                 db.DBLogic.g_instance.getAircraftName(aircraftID))
             msgData = localizeLobby('LOBBY_ERROR_SELL_LIMIT',
                                     plane=planeName)
             self.__lobby.showMessageBox(
                 msgHeader, msgData,
                 localizeOptions('SAVE_SETTINGS_BUTTON'), None, None, None,
                 False)
     return
Esempio n. 11
0
    def load(self, src, pList, settings, forceLoad):
        src.aviaHorizonType.index = settings.getGameUI()['horizonList']
        src.aviaHorizonType.data = [
            localizeOptions('battleui/horizon_v1'),
            localizeOptions('battleui/horizon_v2'),
            localizeOptions('battleui/horizon_v3'),
            localizeOptions('battleui/horizon_v4'),
            localizeOptions('battleui/horizon_v5'),
            localizeOptions('battleui/horizon_v6')
        ]
        src.playerListType.index = settings.getGameUI(
        )['curPlayerListState'] - 1
        src.playerListType.data = [
            localizeOptions('SETTINGS_MAXIMAL'),
            localizeOptions('SETTINGS_ENLARGED'),
            localizeOptions('SETTINGS_STANDART'),
            localizeOptions('SETTINGS_SMALL'),
            localizeOptions('SETTINGS_MINIMAL')
        ]
        for fKey, sKey in DEVICES_MAIN_UI_DATA.iteritems():
            setattr(src, fKey, settings.getGameUI()[sKey])

        self._isLoaded = True
Esempio n. 12
0
    def load(self, src, pList, settings, forceLoad):
        src.measurementSystem.data = [ localizeOptions(''.join(['SETTINGS_COMMON_MEASUREMENT_', ms])) for ms in MEASUREMENT_SYSTEMS ]
        src.measurementSystem.index = settings.getGameUI()['measurementSystem']
        src.heightMode.index = settings.getGameUI()['heightMode']
        src.heightMode.data = [localizeOptions('battleui/schema_height_v1'), localizeOptions('battleui/schema_height_v2'), localizeOptions('SETTINGS_ALTIMETER_DROPDOWN_MENU_VARIANT_BOTH')]
        for fKey, sKey in GAME_SETTINGS_MAIN_UI_DATA.iteritems():
            setattr(src, fKey, settings.getGameUI()[sKey])

        for fKey, sKey in GAME_SETTINGS_MAIN_DATA.iteritems():
            setattr(src, fKey, getattr(settings, sKey))

        for flashKey, SettingsKey in XMPP_CHAT_KEYS.iteritems():
            setattr(src, flashKey, settings.getXmppChatSettings()[SettingsKey])

        for key in Settings.REPLAY_KEYS.iterkeys():
            setattr(src, key, settings.getReplaySettings()[key])

        src.pathSaveBattleReplays = settings.getReplaysDirectory()
        src.pathSaveScreenshots = settings.getScreenShotDirectory()
        import BWPersonality
        import _warAction
        warAction = BWPersonality.gameParams.get('warAction', {})
        warActionEnabled = warAction.get('enabled', False)
        warActionState = warAction.get('state', WAR_STATE.UNDEFINED)
        src.radarSettings.radarState.data = [localizeOptions('SETTINGS_MARKERS_ZOOM_CLOSE'), localizeOptions('SETTINGS_MARKERS_ZOOM_MEDIUM'), localizeOptions('SETTINGS_MARKERS_ZOOM_FAR')]
        src.radarSettings.radarState.index = settings.getGameUI()['radarState']
        src.radarSettings.radarSize.data = [localizeOptions('SETTINGS_MARKERS_SMALL_SIZE'), localizeOptions('SETTINGS_MARKERS_MEDIUM_SIZE'), localizeOptions('SETTINGS_MARKERS_BIG_SIZE')]
        src.radarSettings.radarSize.index = settings.getGameUI()['radarSize']
        src.radarSettings.radarLockRotation.data = [localizeOptions('SETTINGS_ROTATE_RADAR-MINIMAP'), localizeOptions('SETTINGS_CHECKBOX_ROTATE_PLAYER_MINIMAP_FIXED')]
        src.radarSettings.radarLockRotation.index = settings.getGameUI()['radarLockRotation']
        src.radarSettings.showDefendersActive = settings.getGameUI()['showDefendersActive']
        src.attitudeIndicatorSettings.attitudeMode.data = [localizeOptions('SETTINGS_CHECKBOX_SHOW_ROLL_PLANE'), localizeOptions('SETTINGS_CHECKBOX_SHOW_ROLL_HORIZON')]
        src.attitudeIndicatorSettings.attitudeMode.index = settings.getGameUI()['attitudeMode']
        if warActionEnabled and warActionState not in [WAR_STATE.UNDEFINED, WAR_STATE.OFF, WAR_STATE.END]:
            return
        else:
            count = 0
            isEnableLobbyUI = gui.WindowsManager.g_windowsManager.getLobbyUI() is not None
            if isEnableLobbyUI:
                ad = IHangarSpacesAdapter('ICurrentHangarSpace')
                ob = ad(None, None)
                for i, spaceID in enumerate(ob['spaces']):
                    if DB.g_instance.userHangarSpaces.get(spaceID, None) is not None:
                        count += 1

            src.lobbySettings.isEnabled = (BWPersonality.g_initPlayerInfo.useGUIType == GUI_TYPES.PREMIUM or count > 1) and isEnableLobbyUI
            if src.lobbySettings.isEnabled:
                spaceData = DB.g_instance.userHangarSpaces.get(BWPersonality.g_settings.hangarSpaceSettings['spaceID'], None)
                src.lobbySettings.isEnabled = not spaceData.get('isModal', False)
            if src.lobbySettings.isEnabled:
                currentSpace = settings.getHangarSpaceSettings(BWPersonality.g_initPlayerInfo.databaseID)
                index = 0
                for spaceID in ob['spaces']:
                    spaceData = DB.g_instance.userHangarSpaces.get(spaceID, None)
                    skip = False
                    for ui in _warAction.WarAction.uiConfig.hangar:
                        skip = ui.name == spaceData['spaceID']
                        if skip:
                            break

                    if skip:
                        continue
                    if spaceData is not None:
                        kv = KeyValue()
                        kv.key = spaceID
                        kv.label = localizeLobby(spaceData['loc'])
                        src.lobbySettings.previewImg.append(spaceData['img'])
                        src.lobbySettings.hangar.data.append(kv)
                        if spaceID == currentSpace['spaceID']:
                            src.lobbySettings.hangar.index = index
                        index += 1

            self._isLoaded = True
            return
Esempio n. 13
0
 def getLocalizedProfileName(self, profileName=None):
     if profileName is None:
         profileName = self.getCurProfileName()
     return localizeOptions('CONTROL_PROFILE_%s' % profileName.upper())
Esempio n. 14
0
AIMS_SHAPE_CROSSHAIR_PREFIX = 'SETTINGS_DROPDOWN_MENU_VARIANT_CROSSHAIR'
AIMS_SHAPE_TARGET_PREFIX = 'SETTINGS_DROPDOWN_MENU_VARIANT_DISPERSION_AREA'
AIMS_SHAPE_EXTERNAL_PREFIX = 'SETTINGS_DROPDOWN_MENU_VARIANT_IRON_SIGHT'
AIMS_COLOR_PREFIX = 'SETTINGS_BATTLE_HUD_CROSSHAIR_COLOR_%s'
CROSSHAIR_SHAPES_COUNT = 13
TARGET_AREA_SHAPES_COUNT = 8
EXTERNAL_AIM_SHAPES_COUNT = 12
FP_COLORS = ['RED', 'GREEN', 'WHITE', 'LILAC', 'BLUE', 'BLACK', 'ORANGE']
if IS_EDITOR:
    FP_COLORS_LOC = []
    CROSSHAIR_SHAPES, CROSSHAIR_COLORS, TARGET_AREA_SHAPES, TARGET_AREA_COLORS, EXTERNAL_AIM_SHAPES = (
        [], [], [], [], [])
else:
    CROSSHAIR_SHAPES = [
        ''.join([localizeOptions(AIMS_SHAPE_CROSSHAIR_PREFIX), ' ',
                 str(i)]) for i in range(1, CROSSHAIR_SHAPES_COUNT)
    ]
    CROSSHAIR_COLORS = [
        localizeOptions(AIMS_COLOR_PREFIX % 'ORANGE'),
        localizeOptions(AIMS_COLOR_PREFIX % 'RED'),
        localizeOptions(AIMS_COLOR_PREFIX % 'GREEN'),
        localizeOptions(AIMS_COLOR_PREFIX % 'BLUE'),
        localizeOptions(AIMS_COLOR_PREFIX % 'COMBINED')
    ]
    TARGET_AREA_SHAPES = [
        ''.join([localizeOptions(AIMS_SHAPE_TARGET_PREFIX), ' ',
                 str(i)]) for i in range(1, TARGET_AREA_SHAPES_COUNT)
    ]
    TARGET_AREA_COLORS = [
        localizeOptions(AIMS_COLOR_PREFIX % 'RED'),