def playReady(item): if item.requiresSoundNotification: equipment = vehicles.g_cache.equipments()[item.getEquipmentID()] if equipment is not None: if equipment.soundNotification is not None: avatar_getter.getSoundNotifications().play( equipment.soundNotification) return avatar_getter.getSoundNotifications().play('combat_reserve') return
def action(self, repairPointIndex, action, nextActionTime): if self.__ui is None: return else: timeLeft = max(0, nextActionTime - BigWorld.serverTime()) if action in (REPAIR_POINT_ACTION.START_REPAIR, REPAIR_POINT_ACTION.RESTART_REPAIR): self.__ui.showTimer(timeLeft, _REPAIR_STATE.PROGRESS, INGAME_GUI.REPAIRPOINT_TITLE, None) elif action == REPAIR_POINT_ACTION.COMPLETE_REPAIR: self.__ui.showTimer(timeLeft, _REPAIR_STATE.COOLDOWN, INGAME_GUI.REPAIRPOINT_TITLE, INGAME_GUI.REPAIRPOINT_UNAVAILABLE) getSoundNotifications().play(self.__repairSndName) elif action == REPAIR_POINT_ACTION.ENTER_WHILE_CD: self.__ui.showTimer(timeLeft, _REPAIR_STATE.COOLDOWN, INGAME_GUI.REPAIRPOINT_TITLE, INGAME_GUI.REPAIRPOINT_UNAVAILABLE) elif action in (REPAIR_POINT_ACTION.LEAVE_WHILE_CD, REPAIR_POINT_ACTION.CANCEL_REPAIR, REPAIR_POINT_ACTION.BECOME_DISABLED): self.__ui.hideTimer() self.onRepairPointStateChanged(repairPointIndex, action, timeLeft) return
def setEquipment(self, intCD, quantity, stage, timeRemaining): if not intCD: self.onEquipmentAdded(intCD, None) return else: if intCD in self._equipments: item = self._equipments[intCD] item.update(quantity, stage, timeRemaining) self.onEquipmentUpdated(intCD, item) if item.getPrevStage() in (EQUIPMENT_STAGES.DEPLOYING, EQUIPMENT_STAGES.UNAVAILABLE, EQUIPMENT_STAGES.COOLDOWN) and item.getStage() == EQUIPMENT_STAGES.READY: avatar_getter.getSoundNotifications().play(self.__readySndName) else: descriptor = vehicles.getDictDescr(intCD) item = self.createItem(descriptor, quantity, stage, timeRemaining) self._equipments[intCD] = item self.onEquipmentAdded(intCD, item) return
def __playSound(self, sound): app = self.app if app is not None and app.soundManager is not None: app.soundManager.playEffectSound(SoundEffectsId.DYN_SQUAD_STARTING_DYNAMIC_PLATOON) notifications = avatar_getter.getSoundNotifications() if notifications is not None and hasattr(notifications, 'play'): notifications.play(sound) return
def __playSound(self, eventName): if not EPIC_SOUND.EPIC_MSG_SOUNDS_ENABLED or eventName is None: return else: soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(eventName) return
def __playSound(self, eventName): if not self.__isVisible or not _RIBBON_SOUNDS_ENABLED: return soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play') and hasattr(soundNotifications, 'isPlaying'): for soundName in _SOUNDS: if soundNotifications.isPlaying(soundName): break else: soundNotifications.play(eventName)
def startControl(self): nots = avatar_getter.getSoundNotifications() if nots is not None: self.__soundNotifications = weakref.proxy(nots) self.__setPlayerFlagBearerIfNeed() g_ctfManager.onFlagCapturedByVehicle += self.__onFlagCapturedByVehicle g_ctfManager.onFlagAbsorbed += self.__onFlagAbsorbed g_ctfManager.onFlagDroppedToGround += self.__onFlagDroppedToGround g_ctfManager.onFlagRemoved += self.__onFlagRemoved return
def __playSound(self, eventName): if not self.__isVisible or not _RIBBON_SOUNDS_ENABLED: return soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play') and hasattr(soundNotifications, 'isPlaying'): for eventName in _SOUNDS: if soundNotifications.isPlaying(eventName): break else: soundNotifications.play(eventName)
def _playSoundNotification(self, winnerTeam, reason): playerTeam = avatar_getter.getPlayerTeam() notification = _EPIC_SOUND_NOTIFICATIONS.get(reason, None) if notification is None: return else: victory = True if winnerTeam == playerTeam else False notification = notification.get(victory, None) soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(notification) return
def _setup(self, vehicle): self.__updater = self.__updater.switch(vehicle.isPlayer) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if not vehicle.isAlive(): self.onVehicleStateUpdated(VEHICLE_VIEW_STATE.DESTROYED, None) else: self.__updateTI.start()
def __playSound(self, cmd): soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(cmd.getSoundEventName()) if cmd is None: return else: if cmd.isEpicGlobalMessage: if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(EPIC_SOUND.BF_EB_GLOBAL_MESSAGE) elif soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(cmd.getSoundEventName()) return
def _setup(self, vehicle): if self.__updater is not None: self.__updater = self.__updater.switch(self.__vehicleID) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications is not None: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if self.__updater is not None: self.__updater.start() return
def setEquipment(self, intCD, quantity, stage, timeRemaining): if not intCD: self.onEquipmentAdded(intCD, None) return else: if intCD in self._equipments: item = self._equipments[intCD] item.update(quantity, stage, timeRemaining) self.onEquipmentUpdated(intCD, item) if item.getPrevStage() in ( EQUIPMENT_STAGES.DEPLOYING, EQUIPMENT_STAGES.UNAVAILABLE, EQUIPMENT_STAGES.COOLDOWN ) and item.getStage() == EQUIPMENT_STAGES.READY: avatar_getter.getSoundNotifications().play( self.__readySndName) else: descriptor = vehicles.getDictDescr(intCD) item = self.createItem(descriptor, quantity, stage, timeRemaining) self._equipments[intCD] = item self._order.append(intCD) self.onEquipmentAdded(intCD, item) return
def _setup(self, vehicle): self.__updater = self.__updater.switch(vehicle.isPlayer) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation( nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if not vehicle.isAlive(): self.onVehicleStateUpdated(VEHICLE_VIEW_STATE.DESTROYED, None) else: self.__updateTI.start()
def _setup(self, vehicle): if self.__updater is not None: self.__updater = self.__updater.switch(self.__vehicleID) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications is not None: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if VEHICLE_VIEW_STATE.DUAL_GUN_STATE_UPDATED in self.__cachedStateValues.keys(): self.onVehicleStateUpdated(VEHICLE_VIEW_STATE.DUAL_GUN_STATE_UPDATED, self.getStateValue(VEHICLE_VIEW_STATE.DUAL_GUN_STATE_UPDATED)) if self.__updater is not None: self.__updater.start() return
def start(self, ui): self.__ui = weakref.proxy(ui) player = BigWorld.player() self.__playerVehicleID = player.playerVehicleID self.__playerTeam = player.team self.__soundNotifications = weakref.proxy(getSoundNotifications()) arena = player.arena arenaType = arena.arenaType self.__isTeamPlayer = self.__playerTeam in arenaType.squadTeamNumbers if isFalloutMultiTeam() else True g_ctfManager.onFlagCapturedByVehicle += self.__onFlagCapturedByVehicle g_ctfManager.onFlagAbsorbed += self.__onFlagAbsorbed g_ctfManager.onFlagDroppedToGround += self.__onFlagDroppedToGround g_ctfManager.onFlagRemoved += self.__onFlagRemoved if g_ctfManager.isFlagBearer(self.__playerVehicleID): self.__ui.showFlagCaptured()
def _playSoundNotification(self, winnerTeam, reason): if self.__notificationDelayCB is not None: self.__notificationDelayCB = None playerTeam = avatar_getter.getPlayerTeam() notification = _EPIC_SOUND_NOTIFICATIONS.get(reason, None) if notification is None: return else: victory = True if winnerTeam == playerTeam else False notification = notification.get(victory, None) soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(notification) EPIC_SOUND.EPIC_MSG_SOUNDS_ENABLED = False return
def _setup(self, vehicle): """ Set up the updater and other properties :param vehicle: Vehicle entity. """ if self.__updater is not None: self.__updater = self.__updater.switch(self.__vehicleID) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications is not None: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if self.__updater is not None: self.__updater.start() return
def start(self, ui): self.__ui = weakref.proxy(ui) player = BigWorld.player() self.__playerVehicleID = player.playerVehicleID self.__playerTeam = player.team self.__soundNotifications = weakref.proxy(getSoundNotifications()) arena = player.arena arenaType = arena.arenaType self.__isTeamPlayer = self.__playerTeam in arenaType.squadTeamNumbers if isFalloutMultiTeam( ) else True g_ctfManager.onFlagCapturedByVehicle += self.__onFlagCapturedByVehicle g_ctfManager.onFlagAbsorbed += self.__onFlagAbsorbed g_ctfManager.onFlagDroppedToGround += self.__onFlagDroppedToGround g_ctfManager.onFlagRemoved += self.__onFlagRemoved if g_ctfManager.getVehicleCarriedFlagID( self.__playerVehicleID) is not None: self.__ui.showFlagCaptured() return
def __onCombatEquipmentUsed(self, shooterID, eqID): battleCxt = self.sessionProvider.getCtx() if not battleCxt.isCurrentPlayer(shooterID): equipment = vehicles.g_cache.equipments().get(eqID) getFullName = battleCxt.getPlayerFullName if equipment is not None: postfix = equipment.name.split('_')[0].upper() self.showMessage('COMBAT_EQUIPMENT_USED', {'player': getFullName(shooterID, showClan=False)}, extra=(('player', shooterID),), postfix=postfix) else: equipment = vehicles.g_cache.equipments().get(eqID) if equipment is None: return postfix = equipment.name.split('_')[0].upper() if postfix in EPIC_SOUND.BF_EB_ABILITY_LIST: soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications is not None: notification = EPIC_SOUND.BF_EB_ABILITY_USED.get(postfix, None) if notification is not None: soundNotifications.play(notification) return
def _setup(self, vehicle): """ Set up the updater and other properties :param vehicle: Vehicle entity. """ if self.__updater is not None: self.__updater = self.__updater.switch(self.__vehicleID) if self.__isRqToSwitch: nationID = vehicle.typeDescriptor.type.id[0] notifications = avatar_getter.getSoundNotifications() if notifications is not None: notifications.clear() SoundGroups.g_instance.soundModes.setCurrentNation( nations.NAMES[nationID]) self.onVehicleControlling(vehicle) if not vehicle.isAlive(): self.notifyStateChanged(VEHICLE_VIEW_STATE.DESTROYED, None) elif self.__updater is not None: self.__updater.start() return
def __onCombatEquipmentUsed(self, shooterID, eqID): battleCxt = self.sessionProvider.getCtx() if not battleCxt.isCurrentPlayer(shooterID): equipment = vehicles.g_cache.equipments().get(eqID) getFullName = battleCxt.getPlayerFullName if equipment is not None: messageKey = _EQUIPMENT_NAME_TO_MESSAGE_KEY.get(equipment.name) if messageKey is None: postfix = equipment.name.split('_')[0].upper() messageKey = 'COMBAT_EQUIPMENT_USED' else: postfix = '' self.showMessage( messageKey, {'player': getFullName(shooterID, showClan=False)}, extra=(('player', shooterID), ), postfix=postfix) else: equipment = vehicles.g_cache.equipments().get(eqID) if equipment is None: return postfix = equipment.name.split('_')[0].upper() if postfix in EPIC_SOUND.BF_EB_ABILITY_LIST: soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications is not None: notification = EPIC_SOUND.BF_EB_ABILITY_USED.get( postfix, None) if notification is not None: soundNotifications.play(notification) elif postfix in EPIC_SOUND.BF_EB_EQUIPMENT_SOUND_LIST: if equipment.wwsoundEquipmentUsed: if SoundGroups.g_instance: SoundGroups.g_instance.playSound2D( equipment.wwsoundEquipmentUsed) else: _logger.warning( 'Can not play "%s" ability. SoundGroups.g_instance is None', postfix) return
def __playSpottedSound(entry): nots = avatar_getter.getSoundNotifications() if nots is not None: nots.play('enemy_sighted_for_team', None, None, Math.Matrix(entry.getMatrix()).translation) return
def playSoundByAction(action): if action in _ACTIONS_SOUND_IDS: nots = getSoundNotifications() if nots is not None: nots.play(_ACTIONS_SOUND_IDS[action]) return
def movingToRespawn(self): self.__respawnInfo = None self.__stopTimer() self.__cancelDelayedShow() getSoundNotifications().play(_RESPAWN_SOUND_ID) return
def playReady(): avatar_getter.getSoundNotifications().play('combat_reserve')
def __playSound(self, cmd): soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(cmd.getSoundEventName())
def _triggerSoundNotification(self, notificationName): if not EPIC_SOUND.EPIC_MSG_SOUNDS_ENABLED: return soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(notificationName)
def movingToRespawn(self): self.__respawnInfo = None self.__stopTimer() getSoundNotifications().play(self.__respawnSndName) return
def __playSound(self, eventName): if not EPIC_SOUND.EPIC_MSG_SOUNDS_ENABLED: return soundNotifications = getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(eventName)
def playSoundNotification(cls, eventName): if not EPIC_SOUND.EPIC_MSG_SOUNDS_ENABLED: return soundNotifications = getSoundNotifications() if soundNotifications: soundNotifications.play(eventName)
def __playSound(self, sound): self.__soundManager.playSound('effects.%s' % SoundEffectsId.DYN_SQUAD_STARTING_DYNAMIC_PLATOON) soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(sound)
def __playSound(self, eventName): if not _RIBBON_SOUNDS_ENABLED: return soundNotifications = avatar_getter.getSoundNotifications() if soundNotifications and hasattr(soundNotifications, 'play'): soundNotifications.play(eventName)
def _playSoundByAction(self, action): if action in _ACTION_SOUND_IDS: nots = getSoundNotifications() if nots is not None: nots.play(_ACTION_SOUND_IDS[action]) return
def __triggerRespawnSoundNotification(self): getSoundNotifications().play(_RESPAWN_SOUND_ID)
def playReady(item): if item.requiresSoundNotification: avatar_getter.getSoundNotifications().play('combat_reserve')