def showPersonalCase(tankmanInvID, tabIndex, scope=EVENT_BUS_SCOPE.DEFAULT): """ Show personalCase window on current tab. :param tankmanInvID: int-type tankman inventory ID. :param tabIndex: int-type tab index :param scope: """ from bootcamp.BootcampGarage import g_bootcampGarage if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): g_bootcampGarage.closeAllPopUps() g_eventBus.handleEvent( events.LoadViewEvent( VIEW_ALIAS.BOOTCAMP_PERSONAL_CASE, getViewName(VIEW_ALIAS.BOOTCAMP_PERSONAL_CASE, tankmanInvID), { 'tankmanID': tankmanInvID, 'page': tabIndex }), scope) return g_eventBus.handleEvent( events.LoadViewEvent( VIEW_ALIAS.PERSONAL_CASE, getViewName(VIEW_ALIAS.PERSONAL_CASE, tankmanInvID), { 'tankmanID': tankmanInvID, 'page': tabIndex }), scope)
def getShellsLayoutPrice(self): """ @return: price that should be paid to fill layout """ if self.shellsLayoutHelper is None: return MONEY_UNDEFINED else: price = MONEY_UNDEFINED if g_bootcamp.isRunning(): return price for shellCompDescr, count, isBuyingForAltPrice in LayoutIterator( self.shellsLayoutHelper.getRawLayout()): if not shellCompDescr or not count: continue shell = self.itemsCache.items.getItemByCD(int(shellCompDescr)) vehShell = findFirst( lambda s, intCD=shellCompDescr: s.intCD == intCD, self.vehicle.shells) vehCount = vehShell.count if vehShell is not None else 0 buyCount = count - shell.inventoryCount - vehCount if buyCount: itemPrice = shell.buyPrices.itemAltPrice if isBuyingForAltPrice else shell.buyPrices.itemPrice buyPrice = buyCount * itemPrice.price price += buyPrice return price
def showGUI(self, bootcampCtxStr): LOG_DEBUG_DEV_BOOTCAMP('showGUI called') g_bootcamp.hideActionWaitWindow() bootcampCtx = cPickle.loads(bootcampCtxStr) self.databaseID = bootcampCtx['databaseID'] currentLesson = bootcampCtx['lessonNum'] isBattleLesson = bootcampCtx['isBattleLesson'] g_bootcamp.setAccount(self) g_bootcamp.setContext(bootcampCtx) events.isPlayerEntityChanging = False firstRun = currentLesson == 0 and not g_bootcamp.isRunning() events.onBootcampShowGUI(firstRun) if g_bootcamp.isRunning(): g_bootcamp.onBattleLessonFinished(currentLesson, bootcampCtx['lessonResults']) elif not g_bootcamp.isManualStart(): g_bootcamp.start(currentLesson, isBattleLesson)
def showVehiclePreview(vehTypeCompDescr, previewAlias=VIEW_ALIAS.LOBBY_HANGAR, vehStrCD=None): from CurrentVehicle import g_currentPreviewVehicle if g_currentPreviewVehicle.isPresent(): g_currentPreviewVehicle.selectVehicle(vehTypeCompDescr) else: if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): from debug_utils_bootcamp import LOG_DEBUG_DEV_BOOTCAMP LOG_DEBUG_DEV_BOOTCAMP('showVehiclePreview', vehTypeCompDescr, previewAlias) g_eventBus.handleEvent(events.LoadViewEvent( VIEW_ALIAS.BOOTCAMP_VEHICLE_PREVIEW, ctx={ 'itemCD': vehTypeCompDescr, 'previewAlias': previewAlias }), scope=EVENT_BUS_SCOPE.LOBBY) return g_eventBus.handleEvent(events.LoadViewEvent(VIEW_ALIAS.VEHICLE_PREVIEW, ctx={ 'itemCD': vehTypeCompDescr, 'previewAlias': previewAlias, 'vehicleStrCD': vehStrCD }), scope=EVENT_BUS_SCOPE.LOBBY)
def onBecomeNonPlayer(self): if g_bootcamp.isRunning() or self.__isBattleRoyale(): return self.settingsCore.onSettingsChanged -= self.__onSettingsChanged self.settingsCache.onSyncCompleted -= self.__onSettingsReady if not self.__isEnabled: return self.__deactivateHandling()
def onBecomePlayer(self): if g_bootcamp.isRunning() or self.__isBattleRoyale(): return self.settingsCore.onSettingsChanged += self.__onSettingsChanged if not self.settingsCache.settings.isSynced(): self.settingsCache.onSyncCompleted += self.__onSettingsReady else: self.__isEnabled = bool(self.settingsCore.getSetting(BattleCommStorageKeys.ENABLE_BATTLE_COMMUNICATION)) if not self.__isEnabled: return self.__activateHandling()
def showModuleInfo(itemCD, vehicleDescr): if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): return itemCD = int(itemCD) g_eventBus.handleEvent( events.LoadViewEvent( VIEW_ALIAS.MODULE_INFO_WINDOW, getViewName(VIEW_ALIAS.MODULE_INFO_WINDOW, itemCD), { 'moduleCompactDescr': itemCD, 'vehicleDescr': vehicleDescr }), EVENT_BUS_SCOPE.LOBBY)
def _computePiercingPowerRandomization(cls, shell): if constants.IS_BOOTCAMP_ENABLED: from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): if g_bootcamp.getPredefinedPiercingPower(): return (100.0, 100.0) piercingPowerRandomization = shell.piercingPowerRandomization minPP = 100.0 * ( 1.0 - piercingPowerRandomization * cls._PP_RANDOM_ADJUSTMENT_MIN) maxPP = 100.0 * ( 1.0 + piercingPowerRandomization * cls._PP_RANDOM_ADJUSTMENT_MAX) return (minPP, maxPP)
def _computePiercingPowerAtDist(cls, ppDesc, dist, maxDist): if constants.IS_BOOTCAMP_ENABLED: from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): bootcampPP = g_bootcamp.getPredefinedPiercingPower() if bootcampPP: return bootcampPP p100, p500 = ppDesc if dist <= 100.0: return p100 if dist < maxDist: return max(0.0, p100 + (p500 - p100) * (dist - 100.0) / 400.0) return 0.0
def requestShowPopover(self, alias, data): if IS_BOOTCAMP_ENABLED: from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): if data is not None and hasattr(data, 'slotType') and data.slotType != 'optionalDevice' and not g_bootcamp.isResearchFreeLesson(): return if data is None and alias != 'bootcampBattleTypeSelectPopover': return event = g_entitiesFactories.makeShowPopoverEvent(alias, {'data': data}) if event is not None: self.fireEvent(event, scope=self.__scope) else: LOG_ERROR('Event of opening popover can not be created', alias) return
def showBattleResultsWindow(arenaUniqueID): if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): g_eventBus.handleEvent( events.LoadViewEvent(VIEW_ALIAS.BOOTCAMP_BATTLE_RESULT, getViewName( VIEW_ALIAS.BOOTCAMP_BATTLE_RESULT, str(arenaUniqueID)), ctx={'arenaUniqueID': arenaUniqueID}), EVENT_BUS_SCOPE.LOBBY) return g_eventBus.handleEvent( events.LoadViewEvent( VIEW_ALIAS.BATTLE_RESULTS, getViewName(VIEW_ALIAS.BATTLE_RESULTS, str(arenaUniqueID)), {'arenaUniqueID': arenaUniqueID}), EVENT_BUS_SCOPE.LOBBY)
def processSwitchNotifications(self): if g_bootcamp.isRunning(): return serverSettings = self._lobbyContext.getServerSettings() isEnabled = serverSettings.isTelecomRentalsEnabled() with settings.telecomRentalsSettings() as dt: hasPartnership = BigWorld.player().telecomRentals.hasPartnership() if not hasPartnership: return isBlocked = BigWorld.player().telecomRentals.isBlocked() if not isBlocked and isEnabled != dt.isTelecomRentalsEnabled: if isEnabled: self._showNotification( SystemMessages.SM_TYPE.FeatureSwitcherOn, backport.text(R.strings.system_messages. telecom_rentals.switch_on.title()), '') else: self._showNotification( SystemMessages.SM_TYPE.WarningHeader, backport.text(R.strings.system_messages. telecom_rentals.switch_off.title()), backport.text(R.strings.system_messages. telecom_rentals.switch_off.body())) elif isEnabled and isBlocked != dt.isTelecomRentalsBlocked: if isBlocked: self._showNotification( SystemMessages.SM_TYPE.WarningHeader, backport.text(R.strings.system_messages. telecom_rentals.switch_off.title()), backport.text(R.strings.system_messages. telecom_rentals.switch_off.body())) else: self._showNotification( SystemMessages.SM_TYPE.FeatureSwitcherOn, backport.text(R.strings.system_messages. telecom_rentals.switch_on.title()), '') elif not dt.isTelecomRentalsBlocked and isBlocked and dt.isTelecomRentalsEnabled and not isEnabled: self._showNotification( SystemMessages.SM_TYPE.WarningHeader, backport.text(R.strings.system_messages.telecom_rentals. switch_off.title()), backport.text(R.strings.system_messages.telecom_rentals. switch_off.body())) dt.setTelecomRentalsEnabledState(isEnabled) dt.setTelecomRentalsBlockedState(isBlocked)
def showGUI(self, ctx): LOG_DEBUG_DEV_BOOTCAMP('showGUI called') g_bootcamp.hideActionWaitWindow() ctx = cPickle.loads(ctx) guiCtx = ctx['gui'] self.lobbyContext.onAccountShowGUI(guiCtx) self._initTimeCorrection(guiCtx) bootcampCtx = ctx['bootcamp'] self.databaseID = bootcampCtx['databaseID'] currentLesson = bootcampCtx['lessonNum'] isBattleLesson = bootcampCtx['isBattleLesson'] g_bootcamp.setAccount(self) g_bootcamp.setContext(bootcampCtx) events.isPlayerEntityChanging = False if g_bootcamp.isRunning(): g_bootcamp.onBattleLessonFinished(currentLesson, bootcampCtx['lessonResults']) elif not g_bootcamp.isManualStart(): g_bootcamp.start(currentLesson, isBattleLesson)
def handleKeyEvent(event): if OfflineMode.handleKeyEvent(event): return True elif LightingGenerationMode.handleKeyEvent(event): return True else: isDown, key, mods, isRepeat = convertKeyEvent(event) if g_bootcamp.isRunning(): g_bootcamp.handleKeyEvent(event) if WebBrowser.g_mgr.handleKeyEvent(event): return True if g_replayCtrl.isPlaying: if g_replayCtrl.handleKeyEvent(isDown, key, mods, isRepeat, event): return True if isRepeat: if onRepeatKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventBeforeGUI(isDown, key, mods, event): return True if not isRepeat: InputHandler.g_instance.handleKeyEvent(event) if GUI.handleKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventAfterGUI(isDown, key, mods, event): return True if not isRepeat: if MessengerEntry.g_instance.gui.handleKey(event): return True inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: if inputHandler.handleKeyEvent(event): return True for handler in g_keyEventHandlers: try: if handler(event): return True except Exception: LOG_CURRENT_EXCEPTION() return False
def showVehicleBuyDialog(vehicle, isTradeIn=False): if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): g_eventBus.handleEvent( events.LoadViewEvent(VIEW_ALIAS.BOOTCAMP_VEHICLE_BUY_WINDOW, ctx={ 'nationID': vehicle.nationID, 'itemID': vehicle.innationID }), EVENT_BUS_SCOPE.LOBBY) return alias = VIEW_ALIAS.VEHICLE_RESTORE_WINDOW if vehicle.isRestoreAvailable( ) else VIEW_ALIAS.VEHICLE_BUY_WINDOW g_eventBus.handleEvent( events.LoadViewEvent(alias, ctx={ 'nationID': vehicle.nationID, 'itemID': vehicle.innationID, 'isTradeIn': isTradeIn }), EVENT_BUS_SCOPE.LOBBY)
def showResearchView(vehTypeCompDescr): if constants.IS_BOOTCAMP_ENABLED: if g_bootcamp.isRunning(): exitEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_HANGAR) loadEvent = events.LoadViewEvent( VIEW_ALIAS.BOOTCAMP_LOBBY_RESEARCH, ctx={ 'rootCD': vehTypeCompDescr, 'exit': exitEvent }) g_eventBus.handleEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY) return exitEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_HANGAR) loadEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_RESEARCH, ctx={ 'rootCD': vehTypeCompDescr, 'exit': exitEvent }) g_eventBus.handleEvent(loadEvent, scope=EVENT_BUS_SCOPE.LOBBY)
def processSwitchNotifications(self): if g_bootcamp.isRunning(): return serverSettings = self._lobbyContext.getServerSettings() isWotPlusEnabled = serverSettings.isRenewableSubEnabled() isEntryPointsEnabled = serverSettings.isWotPlusNewSubscriptionEnabled() isGoldReserveEnabled = serverSettings.isRenewableSubGoldReserveEnabled( ) isPassiveXpEnabled = serverSettings.isRenewableSubPassiveCrewXPEnabled( ) isTankRentalEnabled = serverSettings.isWotPlusTankRentalEnabled() isFreeDirectivesEnabled = serverSettings.isRenewableSubFreeDirectivesEnabled( ) with settings.wotPlusSettings() as dt: dt.setEntryPointsEnabledState(isEntryPointsEnabled) dt.setWotPlusEnabledState(isWotPlusEnabled) hasSubscription = BigWorld.player( ).renewableSubscription.isEnabled() if not isWotPlusEnabled or not hasSubscription: return strategy = self._getStrategy() strategy.notifyClient( dt.isGoldReserveEnabled, isGoldReserveEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_GOLDRESERVE_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_GOLDRESERVE_DISABLED) strategy.notifyClient( dt.isPassiveXpEnabled, isPassiveXpEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_PASSIVEXP_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_PASSIVEXP_DISABLED) strategy.notifyClient( dt.isTankRentalEnabled, isTankRentalEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_TANKRENTAL_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_TANKRENTAL_DISABLED) strategy.notifyClient( dt.isFreeDirectivesEnabled, isFreeDirectivesEnabled, SCH_CLIENT_MSG_TYPE.WOTPLUS_FREEDIRECTIVES_ENABLED, SCH_CLIENT_MSG_TYPE.WOTPLUS_FREEDIRECTIVES_DISABLED) dt.setGoldReserveEnabledState(isGoldReserveEnabled) dt.setPassiveXpState(isPassiveXpEnabled) dt.setTankRentalState(isTankRentalEnabled) dt.setFreeDirectivesState(isFreeDirectivesEnabled)
def onLobbyStarted(self, ctx): self._lobbyContext.getServerSettings( ).onServerSettingsChange += self._onServerSettingsChange self.processSwitchNotifications() self._validSessionStarted = False if g_bootcamp.isRunning() else True
def load(self, url=None, title=None, showActionBtn=True, showWaiting=True, browserID=None, isAsync=False, browserSize=None, isDefault=True, callback=None, showCloseBtn=False, useBrowserWindow=True, isModal=False, showCreateWaiting=False, handlers=None, showBrowserCallback=None, isSolidBorder=False): if constants.IS_BOOTCAMP_ENABLED: from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): return if showCreateWaiting: Waiting.show('browser/init') url = yield self.__urlMacros.parse(url or GUI_SETTINGS.browser.url) suffix = yield self.__urlMacros.parse(GUI_SETTINGS.browser.params) concatenator = '&' if '?' in url else '?' if suffix not in url: url = concatenator.join([url, suffix]) size = browserSize or BROWSER.SIZE webBrowserID = browserID if browserID is None: browserID = self.__browserIDGenerator.next() webBrowserID = browserID elif type(browserID) is not int: webBrowserID = self.__browserIDGenerator.next() ctx = { 'url': url, 'title': title, 'showActionBtn': showActionBtn, 'showWaiting': showWaiting, 'browserID': browserID, 'size': size, 'isAsync': isAsync, 'showCloseBtn': showCloseBtn, 'showWindow': useBrowserWindow, 'alias': VIEW_ALIAS.BROWSER_WINDOW_MODAL if isModal else VIEW_ALIAS.BROWSER_WINDOW, 'showCreateWaiting': showCreateWaiting, 'handlers': handlers, 'showBrowserCallback': showBrowserCallback, 'isSolidBorder': isSolidBorder } texture = browserID not in self.__browsers and browserID not in self.__pendingBrowsers and self._BROWSER_TEXTURE app = g_appLoader.getApp() if not app: raise AssertionError('Application can not be None') browser = WebBrowser(webBrowserID, app, texture, size, url, handlers=self.__filters) self.__browsers[browserID] = browser if self.__isCreatingBrowser(): LOG_BROWSER('CTRL: Queueing a browser creation: ', browserID, url) self.__pendingBrowsers[browserID] = ctx else: self.__createBrowser(ctx) elif browserID in self.__pendingBrowsers: LOG_BROWSER('CTRL: Re-queuing a browser creation, overriding: ', browserID, url) self.__pendingBrowsers[browserID] = ctx elif browserID in self.__browsers: LOG_BROWSER('CTRL: Re-navigating an existing browser: ', browserID, url) browser = self.__browsers[browserID] browser.navigate(url) browser.changeTitle(title) callback(browserID) return
def isPromoAutoViewsEnabled(self): if self.isBootcampEnabled(): from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): return False return True
def enqueueBootcamp(self): if g_bootcamp.isRunning(): BigWorld.player().enqueueBootcamp(g_bootcamp.getLessonNum())
def __readCfg(self, dataSec): if dataSec is None: LOG_WARNING( 'Invalid section <arcadeMode/camera> in avatar_input_handler.xml' ) self.__baseCfg = dict() bcfg = self.__baseCfg bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10, 0.01) bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.01) bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0, 10, 0.01) bcfg['angleRange'] = readVec2(dataSec, 'angleRange', (0, 0), (180, 180), (10, 110)) distRangeVec = readVec2(dataSec, 'distRange', (1, 1), (100, 100), (2, 20)) bcfg['distRange'] = MinMax(distRangeVec.x, distRangeVec.y) bcfg['minStartDist'] = readFloat(dataSec, 'minStartDist', bcfg['distRange'][0], bcfg['distRange'][1], bcfg['distRange'][0]) bcfg['optimalStartDist'] = readFloat(dataSec, 'optimalStartDist', bcfg['distRange'][0], bcfg['distRange'][1], bcfg['distRange'][0]) bcfg['angleRange'][0] = math.radians( bcfg['angleRange'][0]) - math.pi * 0.5 bcfg['angleRange'][1] = math.radians( bcfg['angleRange'][1]) - math.pi * 0.5 bcfg['fovMultMinMaxDist'] = MinMax( readFloat(dataSec, 'fovMultMinDist', 0.1, 100, 1.0), readFloat(dataSec, 'fovMultMaxDist', 0.1, 100, 1.0)) ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE] if ds is not None: ds = ds['arcadeMode/camera'] self.__userCfg = dict() ucfg = self.__userCfg ucfg['horzInvert'] = self.settingsCore.getSetting('mouseHorzInvert') ucfg['vertInvert'] = self.settingsCore.getSetting('mouseVertInvert') ucfg['sniperModeByShift'] = self.settingsCore.getSetting( 'sniperModeByShift') ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0, 1.0) ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0) ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0, 10.0, 1.0) ucfg['startDist'] = readFloat(ds, 'startDist', bcfg['distRange'][0], 500, bcfg['optimalStartDist']) if ucfg['startDist'] < bcfg['minStartDist']: ucfg['startDist'] = bcfg['optimalStartDist'] if constants.IS_BOOTCAMP_ENABLED: from bootcamp.Bootcamp import g_bootcamp from bootcamp import START_DISTANCE if g_bootcamp.isRunning(): ucfg['startDist'] = START_DISTANCE ucfg['startAngle'] = readFloat(ds, 'startAngle', 5, 180, 60) ucfg['startAngle'] = math.radians(ucfg['startAngle']) - math.pi * 0.5 ucfg['fovMultMinMaxDist'] = MinMax( readFloat(ds, 'fovMultMinDist', 0.1, 100, bcfg['fovMultMinMaxDist'].min), readFloat(ds, 'fovMultMaxDist', 0.1, 100, bcfg['fovMultMinMaxDist'].max)) self.__cfg = dict() cfg = self.__cfg cfg['keySensitivity'] = bcfg['keySensitivity'] cfg['sensitivity'] = bcfg['sensitivity'] cfg['scrollSensitivity'] = bcfg['scrollSensitivity'] cfg['angleRange'] = bcfg['angleRange'] cfg['distRange'] = bcfg['distRange'] cfg['minStartDist'] = bcfg['minStartDist'] cfg['horzInvert'] = ucfg['horzInvert'] cfg['vertInvert'] = ucfg['vertInvert'] cfg['keySensitivity'] *= ucfg['keySensitivity'] cfg['sensitivity'] *= ucfg['sensitivity'] cfg['scrollSensitivity'] *= ucfg['scrollSensitivity'] cfg['startDist'] = ucfg['startDist'] cfg['startAngle'] = ucfg['startAngle'] cfg['fovMultMinMaxDist'] = ucfg['fovMultMinMaxDist'] cfg['sniperModeByShift'] = ucfg['sniperModeByShift'] enableShift = dataSec.readBool('shift', False) if enableShift: movementMappings = dict() movementMappings[Keys.KEY_A] = Math.Vector3(-1, 0, 0) movementMappings[Keys.KEY_D] = Math.Vector3(1, 0, 0) movementMappings[Keys.KEY_Q] = Math.Vector3(0, 1, 0) movementMappings[Keys.KEY_E] = Math.Vector3(0, -1, 0) movementMappings[Keys.KEY_W] = Math.Vector3(0, 0, 1) movementMappings[Keys.KEY_S] = Math.Vector3(0, 0, -1) shiftSensitivity = dataSec.readFloat('shiftSensitivity', 0.5) self.__shiftKeySensor = KeySensor(movementMappings, shiftSensitivity) self.__shiftKeySensor.reset(Math.Vector3()) dynamicsSection = dataSec['dynamics'] self.__impulseOscillator = createOscillatorFromSection( dynamicsSection['impulseOscillator'], False) self.__movementOscillator = createOscillatorFromSection( dynamicsSection['movementOscillator'], False) self.__movementOscillator = Math.PyCompoundOscillator( self.__movementOscillator, Math.PyOscillator(1.0, Vector3(50), Vector3(20), Vector3(0.01, 0.0, 0.01))) self.__noiseOscillator = createOscillatorFromSection( dynamicsSection['randomNoiseOscillatorSpherical']) self.__dynamicCfg.readImpulsesConfig(dynamicsSection) self.__dynamicCfg['accelerationSensitivity'] = readFloat( dynamicsSection, 'accelerationSensitivity', -1000, 1000, 0.1) self.__dynamicCfg['frontImpulseToPitchRatio'] = math.radians( readFloat(dynamicsSection, 'frontImpulseToPitchRatio', -1000, 1000, 0.1)) self.__dynamicCfg['sideImpulseToRollRatio'] = math.radians( readFloat(dynamicsSection, 'sideImpulseToRollRatio', -1000, 1000, 0.1)) self.__dynamicCfg['sideImpulseToYawRatio'] = math.radians( readFloat(dynamicsSection, 'sideImpulseToYawRatio', -1000, 1000, 0.1)) accelerationThreshold = readFloat(dynamicsSection, 'accelerationThreshold', 0.0, 1000.0, 0.1) self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold self.__dynamicCfg['accelerationMax'] = readFloat( dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1) self.__dynamicCfg['maxShotImpulseDistance'] = readFloat( dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0) self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat( dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0) self.__dynamicCfg['zoomExposure'] = readFloat(dynamicsSection, 'zoomExposure', 0.0, 1000.0, 0.25) accelerationFilter = mathUtils.RangeFilter( self.__dynamicCfg['accelerationThreshold'], self.__dynamicCfg['accelerationMax'], 100, mathUtils.SMAFilter(ArcadeCamera._FILTER_LENGTH)) maxAccelerationDuration = readFloat( dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0, ArcadeCamera._DEFAULT_MAX_ACCELERATION_DURATION) self.__accelerationSmoother = AccelerationSmoother( accelerationFilter, maxAccelerationDuration) self.__inputInertia = _InputInertia(self.__cfg['fovMultMinMaxDist'], 0.0) advancedCollider = dataSec['advancedCollider'] self.__adCfg = dict() cfg = self.__adCfg if advancedCollider is None: LOG_ERROR('<advancedCollider> dataSection is not found!') cfg['enable'] = False else: cfg['enable'] = advancedCollider.readBool('enable', False) cfg['fovRatio'] = advancedCollider.readFloat('fovRatio', 2.0) cfg['rollbackSpeed'] = advancedCollider.readFloat( 'rollbackSpeed', 1.0) cfg['minimalCameraDistance'] = self.__cfg['distRange'][0] cfg['speedThreshold'] = advancedCollider.readFloat( 'speedThreshold', 0.1) cfg['minimalVolume'] = advancedCollider.readFloat( 'minimalVolume', 200.0) cfg['volumeGroups'] = dict() for group in VOLUME_GROUPS_NAMES: groups = advancedCollider['volumeGroups'] cfg['volumeGroups'][group] = CollisionVolumeGroup.fromSection( groups[group]) return
def _sendOptionsToFlash(self, options): from bootcamp.Bootcamp import g_bootcamp if g_bootcamp.isRunning(): g_bootcamp.disableContextMenuItems(options) self.as_setOptionsS({'options': options})