def inj_hkKeyEvent(event): BattleApp = g_appLoader.getDefBattleApp() try: if BattleApp and _config.data['enabled']: isDown = PYmodsCore.checkKeys(_config.data['mapMenu_key']) if isDown or _config.wasAltMenuPressed: _config.wasAltMenuPressed = isDown CommandMapping.g_instance.onMappingChanged() if event.isKeyDown(): target = BigWorld.target() player = BigWorld.player() commandsData = _config.commands.get( _config.activeConfigs[_config.data['selectedConfig']], {}) state = getCrosshairType(player, target) menuConf, _ = findBestFitConf(commandsData) commandsList = commandsData.get('hotkeyOnly', []) if menuConf is not None: commandsList.extend(menuConf.get(state, [])) for command in commandsList: if command and command.handleKeys(command.hotKeys): BigWorld.callback( _config.data['hotDelay'] / 1000.0, partial(onCustomAction, command, target)) except StandardError: print 'RadialMenu: ERROR at inj_hkKeyEvent' traceback.print_exc()
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayerVehicle: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self._maxHealth = vTypeDesc.maxHealth helthStr, helthProgress = _getHealthParams(vehicle.health, self._maxHealth) self.as_setupS( helthStr, helthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn) if self.__tankIndicator: app = g_appLoader.getDefBattleApp() self.__tankIndicator.setup(app, vehicle, yawLimits) return
def __init__(self, damagePanel): app = g_appLoader.getDefBattleApp() if app is not None: mc = GUI.WGTankIndicatorFlash(app.movie, '_level0.root.{}.main.damagePanel.tankIndicator'.format(APP_CONTAINERS_NAMES.VIEWS)) mc.wg_inputKeyMode = 2 app.component.addChild(mc, 'tankIndicator') return
def inj_hkKeyEvent(event): BattleApp = g_appLoader.getDefBattleApp() try: if BattleApp and _config.data['enabled']: battleKeyControl(event) except StandardError: print '%s: ERROR at inj_hkKeyEvent' % _config.ID traceback.print_exc()
def __init__(self, damagePanel): app = g_appLoader.getDefBattleApp() if app is not None: mc = GUI.WGTankIndicatorFlash( app.movie, '_level0.root.{}.main.damagePanel.tankIndicator'.format( APP_CONTAINERS_NAMES.VIEWS)) mc.wg_inputKeyMode = 2 app.component.addChild(mc, 'tankIndicator') return
def inj_hkKeyEvent(event): BattleApp = g_appLoader.getDefBattleApp() try: if BattleApp and _config.data['enabled']: if not (len(_config.data['hotkey']) == 1 and BigWorld.player()._PlayerAvatar__forcedGuiCtrlModeFlags): if avatar_getter.isVehicleAlive() and event.isKeyDown( ) and PYmodsCore.checkKeys(_config.data['hotkey']): SoundLoop(True) if _config.data['chatEnable']: calltext() else: SoundLoop(False) except StandardError: print 'Horns: ERROR at inj_hkKeyEvent' traceback.print_exc()
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayerVehicle: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self._maxHealth = vTypeDesc.maxHealth helthStr, helthProgress = _getHealthParams(vehicle.health, self._maxHealth) self.as_setupS(helthStr, helthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn) if self.__tankIndicator: app = g_appLoader.getDefBattleApp() self.__tankIndicator.setup(app, vehicle, yawLimits) return
def __get__(self, obj, objType=None): return g_appLoader.getDefBattleApp()
def getBattleApp(): return g_appLoader.getDefBattleApp()
def __get__(self, obj, objType = None): return g_appLoader.getDefBattleApp()