def __syncAircraftsData(self, aircraftID, onSyncedCallback, sendASCallbacks = True): if aircraftID < 0: self.queryRefresh3DModel(None) return else: carouselAirplane = self.getCarouselAirplane(aircraftID) if self.__lobby is not None: if carouselAirplane: airplane = self.inventory.getCarouselAircraft(aircraftID) self.__updateCarouselAirplane(carouselAirplane, airplane) if self.inventory.isAircraftBought(aircraftID): if carouselAirplane.blockType & BLOCK_TYPE.IN_BATTLE: GameSound().ui.onPlaneBlocked(aircraftID) elif carouselAirplane.blockType == BLOCK_TYPE.UNLOCKED: GameSound().ui.onPlaneUnlocked(aircraftID) if sendASCallbacks: self.__lobby.call_1('hangar.updateCarouselSlot', aircraftID, carouselAirplane.getCarouselAirplaneObject()) else: self.inventory.addAircrafttoBoughtList(aircraftID) if sendASCallbacks: LOG_TRACE('Added new plane to carousel: planeID {0}'.format(carouselAirplane.planeID)) self.__lobby.call_1('hangar.addPlaneCarousel', carouselAirplane.getCarouselAirplaneObject(), self.airplanesCount()) self.__lobby.call_1('hangar.setSelectedAircraftID', aircraftID) self.queryRefresh3DModel(carouselAirplane) SyncOperationKeeper.stop(FLAGS_CODE.BUY_PLANE) if self.__lobby.mode == HANGAR_MODE.RESEARCH: if self.__lobby.researchTreeHelper.enteredInAircraftID: pass else: self.__lobby.researchTreeHelper.reloadCurrentBranch() if onSyncedCallback is not None: onSyncedCallback(aircraftID) if self.__lobby is not None and self.__lobby.mode == HANGAR_MODE.AMMUNITION: self.updateSpecs() return
def __destroy(self): self.__vsePlansStarted = False BigWorld.stopArenaScripts() if self.__hangarVehicleScenarioController: self.__hangarVehicleScenarioController.destroy() self.__hangarVehicleScenarioController = None self.__hangarCamera.destroy() self.__loadingStatus = 0.0 if self.__modelManipulator: self.__modelManipulator.destroy() self.__modelManipulator = None self.__onLoadedCallback = None if self.__isKeyEventSubsribed: GlobalEvents.onKeyEvent -= self.handleKeyEvent self.__isKeyEventSubsribed = False if BigWorld.clentSpaceExists(self.__spaceId): if self.__spaceId is not None and self.__spaceMappingId is not None: BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId) if self.__spaceId is not None: BigWorld.clearSpace(self.__spaceId) BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None GameSound().stopHangar() self.__scriptsObj.onHangarUnloaded() getHangarScriptsByName('planeBirthday').onHangarUnloaded() BigWorld.resetGraphicsDevice() LOG_DEBUG('Hangar successfully destroyed.') return
def setMasterVolumeMultiplier(self, volumeMul): """ Request change of game-wide sound master volume. Volume is set to global game setting multiplied by specified value. @param volumeMul: volume multiplier (0.0 to 1.0) """ from audio import GameSound GameSound().setVolumeAmplifier(volumeMul)
def updatePartsFlags(self, partsFlags): partsBitFlags = 0 for partID, partFlags in partsFlags: partsBitFlags |= partFlags if self.__boolCombiner.setCondition( ObjectDataReader.fire(), bool(partsBitFlags & consts.PART_FLAGS.FIRE)): GameSound().onBurning(self.__context.entityId, self.__context.isPlayer, bool(partsBitFlags & consts.PART_FLAGS.FIRE))
def __linkPreWorldEvents(self): audio = GameSound() clientArena = self.__services['ClientArena'] input = self.__services['Input'] cam = self.__services['Camera'] economics = self.__services['ClientEconomics'] hints = self.__services['BattleHints'] replay = BattleReplay.g_replay self.__linkPreWorldEvent(clientArena.onEconomicEvents, economics.onEconomicEvents) self.__linkPreWorldEvent(clientArena.onCombatEvents, economics.onCombatEvents) self.__linkPreWorldEvent(clientArena.onNewAvatarsInfo, self.eAvatarInfo) self.__linkPreWorldEvent(clientArena.onReceiveMarkerMessage, audio.ui.onReceiveMarkerMessage) self.__linkPreWorldEvent( clientArena.onTeamObjectDestruction, self.__playerAvatar.reportTeamObjectDestruction) self.__linkPreWorldEvent(clientArena.onReportBattleResult, self.__playerAvatar.onReportBattleResult) self.__linkPreWorldEvent( clientArena.onReceiveVOIPChannelCredentials, self.__playerAvatar.onReceiveVOIPChannelCredentials) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, self.__onEnterWorld) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, clientArena.initArenaData) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, clientArena.createGameMode) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, economics.initConfiguration) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, audio.onPlayerEnterWorld) self.__linkPreWorldEvent(self.__playerAvatar.eEnterWorldEvent, replay.onEnterWorld) self.__linkPreWorldEvent(self.__playerAvatar.eLeaveWorldEvent, audio.onPlayerLeaveWorld) self.__linkPreWorldEvent(self.__playerAvatar.eLeaveWorldEvent, self.__onLeaveWorld) self.__linkPreWorldEvent(self.__playerAvatar.eLeaveWorldEvent, replay.onLeaveWorld) self.__linkPreWorldEvent(self.__playerAvatar.onStateChanged, cam.onPlayerAvatarStateChanged) self.__linkPreWorldEvent(self.__playerAvatar.eReportDestruction, cam.onReportPlayerDestruction) self.__linkPreWorldEvent(clientArena.onGameModeCreate, hints.onGameModeCreate) self.__linkPreWorldEvent(input.eAddProcessorListeners, cam.addInputListeners) self.__linkPreWorldEvent(input.eAddProcessorListeners, self.__playerAvatarProxy.addInputListeners) self.__linkPreworldHudEvents(clientArena, input, cam)
def create(self, hangarConfig, onSpaceLoadedCallback = None, overrideSpace = None): import db.DBLogic LOG_TRACE('ClientHangarSpace:: create', hangarConfig, onSpaceLoadedCallback, overrideSpace) self.__vsePlansStarted = False self.__needCameraReset = True self.__spaceId = BigWorld.createSpace() self.__hangarCamera.createCamera(self.__spaceId) self.__hangarConfig = hangarConfig self.__selectHangarType(self.__settings.airplane.visualSettings.hangarConfig if self.__settings else ClientHangarSpace.AMPTY_HANGAR_SIZE) self.__spaceName = self.__hangarCfg.space_name if overrideSpace: self.__spaceName = overrideSpace hSettings = db.DBLogic.g_instance.userHangarSpaces.get(self.__spaceName, None) if hSettings: self.__spaceName = hSettings.get('overrideSpaceID', overrideSpace) self.__spaceName = self.__spaceName[self.__spaceName.rfind('/') + 1:] self.__scriptsObj = getHangarScriptsByName(self.__spaceName) import BWPersonality if not BWPersonality.g_settings.hangarSpaceSettings['spaceID']: BWPersonality.g_settings.hangarSpaceSettings['spaceID'] = self.__spaceName self.__onLoadedCallback = onSpaceLoadedCallback try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'db/spaces/{0}.settings'.format(self.__spaceName)) except: LOG_CURRENT_EXCEPTION() self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) if self.__hangarCfg.static_rotor: self.__initialAngleL = 0 self.__initialAngleR = 0 else: seed() self.__initialAngleL = randrange(0, 360) / 180.0 * math.pi self.__initialAngleR = randrange(0, 360) / 180.0 * math.pi isPremium = hangarConfig != 'basic' LOG_DEBUG_DEV('play music', overrideSpace if overrideSpace else self.__hangarCfg.space_name) GameSound().music.playHangar(isPremium, overrideSpace if overrideSpace else self.__hangarCfg.space_name) return
def GS(): from audio import GameSound return GameSound()
def _soundMute(self, mute): from audio import GameSound GameSound().replayMute(mute)
def togglePauseMenu(self, visble): GameSound().ui.toggleInGameMenu(visble)
def setHoverButtonRadius(self, r): GameSound().ui.setHoverButtonRadius(r)
def playSFX(self, name): GameSound().ui.play(name)
def __linkEvents(self): clientArena = self.__services['ClientArena'] input = self.__services['Input'] cam = self.__services['Camera'] stats = self.__services['ClientStatsCollector'] replay = BattleReplay.g_replay timerService = self.getTimer() audio = GameSound() DebugHUD = self.__services.get('DebugHUD') self.__linkEvent(GlobalEvents.onHideModalScreen, input.onHideModalScreen) self.__linkEvent(self.__playerAvatar.onUpdateArena, clientArena.doUpdateArena) self.__linkEvent(self.__playerAvatar.eArenaLoaded, replay.onArenaLoaded) self.__linkEvent(self.__playerAvatar.eArenaLoaded, audio.onArenaLoaded) self.__linkEvent(self.__playerAvatar.eFlyKeyBoardInputAllowed, input.onFlyKeyBoardInputAllowed) self.__linkEvent(self.__playerAvatar.onReceiveServerData, cam.update) self.__linkEvent(self.__playerAvatar.eUpdateSpectator, cam.updateSpectator) self.__linkEvent(self.__playerAvatar.eFlyKeyBoardInputAllowed, cam.onFlyKeyBoardInputAllowed) self.__linkEvent(self.__playerAvatar.eFlyKeyBoardInputAllowed, replay.onFlyKeyBoardInputAllowed) self.__linkEvent(self.__playerAvatar.eStartCollectClientStats, stats.startCollectClientStats) self.__linkEvent(self.__playerAvatar.eStopCollectClientStats, stats.stopCollectClientStats) self.__linkEvent(self.__playerAvatar.onStateChanged, input.onPlayerAvatarStateChanged) self.__linkEvent(GlobalEvents.onKeyEvent, input.handleKeyEvent) self.__linkEvent(GlobalEvents.onMouseEvent, input.processMouseEvent) self.__linkEvent(GlobalEvents.onAxisEvent, input.processJoystickEvent) self.__linkEvent(GlobalEvents.onSetFocus, input.onSetFocus) if not BattleReplay.isPlaying(): self.__linkEvent(Settings.g_instance.eSetSniperMode, replay.notifySniperModeType) self.__linkEvent(Settings.g_instance.eSetSniperMode, cam.setSniperModeType) self.__linkEvent(Settings.g_instance.eCameraEffectsSetEnabled, cam.setEffectsEnabled) self.__linkEvent(Settings.g_instance.eMaxMouseCombatFovChanged, cam.setMaxMouseCombatFov) self.__linkEvent(input.eSideViewPressed, cam.onEnterSideView) self.__linkEvent(input.eSideViewReleased, cam.onLeaveSideView) self.__linkEvent(input.eInputProfileChange, cam.onInputProfileChange) self.__linkEvent(input.eBattleModeChange, cam.onBattleModeChange) self.__linkEvent(input.eBattleModeChange, audio.camera.onBattleModeChange) self.__linkEvent(clientArena.onReportBattleResult, replay.onBattleResultsReceived) self.__linkEvent(self.__playerAvatar.onStateChanged, audio.onPlayerStateChanged) self.__linkEvent(self.__playerAvatar.eVictimInformAboutCrit, audio.ui.onVictimInformAboutCrit) self.__linkEvent(self.__playerAvatar.ePartStateChanged, audio.ui.onPartStateChanging) if DebugHUD and SkillsDebugEnabled: self.__linkEvent(self.__playerAvatar.eUniqueSkillStateChanged, DebugHUD.updateAvaibleSkills) self.__linkEvent(self.__playerAvatar.eRestartInput, DebugHUD.clearSkills) self.__linkHudEvents(clientArena, input)
def updatePlaneAfterBattle(self, aircraftID): LOG_TRACE('hangar.updatePlaneAfterBattle', aircraftID) if self.__isInventoryReady: GameSound().ui.onPLaneReturnFromBattle(aircraftID) else: self.__queue.add(partial(self.updatePlaneAfterBattle, aircraftID))
def onTurretTargetChanged(self, turretId, turretTargetID): turretSound = self.getWwiseGameObject( SOUND_OBJECT_TYPES.TURRET(turretId)) if turretSound: GameSound().interactiveMix.mixFocus.onTurretTargetChanged( self.__entityID, turretId, turretTargetID)