def handle_key(self):
     if _config.arty_ball['show_alt_mode']:
         if self.model_ball:
             if BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT):
                 self.model_ball_pressed_key = True
             else:
                 self.model_ball_pressed_key = False
Example #2
0
 def _handleMouseEvent(self, event):
     if BigWorld.isKeyDown(Keys.KEY_LSHIFT, 0) or BigWorld.isKeyDown(
             Keys.KEY_RSHIFT, 0):
         if event.dz != 0:
             self.speedInc() if event.dz > 0 else self.speedDec()
             return True
     return False
    def handleKeyEvent(self, key, isDown):
        if key is None:
            return False
        else:
            if isDown:
                if self._keySwitches['keySwitchInertia'] == key:
                    self._inertiaEnabled = not self._inertiaEnabled
                    return True
                if self._keySwitches['keySwitchRotateAroundPoint'] == key:
                    self.__rotateAroundPointEnabled = not self.__rotateAroundPointEnabled
                    return True
                if self._keySwitches['keySwitchLandCamera'] == key:
                    if self._alignerToLand.enabled or self.__basisMProv.isBound:
                        self._alignerToLand.disable()
                    else:
                        self._alignerToLand.enable(
                            self.__position,
                            BigWorld.isKeyDown(Keys.KEY_LALT)
                            or BigWorld.isKeyDown(Keys.KEY_RALT))
                    return True
                if self._keySwitches['keySetDefaultFov'] == key:
                    BigWorld.projection().fov = self.__defaultFov
                    return True
                if self._keySwitches['keySetDefaultRoll'] == key:
                    self.__ypr.z = 0.0
                    return True
                if self._keySwitches['keyRevertVerticalVelocity'] == key:
                    self.__isVerticalVelocitySeparated = False
                    return True
                if self._keySwitches['keyBindToVehicle'] == key:
                    self.__processBindToVehicleKey()
                    return True
                if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(
                        Keys.KEY_RSHIFT):
                    if self._verticalMovementSensor.handleKeyEvent(
                            key, isDown
                    ) and key not in self._verticalMovementSensor.keyMappings:
                        self.__isVerticalVelocitySeparated = True
                        return True
                    for velocityKey, velocity in self.__predefinedVerticalVelocities.iteritems(
                    ):
                        if velocityKey == key:
                            self._verticalMovementSensor.sensitivity = velocity
                            self.__isVerticalVelocitySeparated = True
                            return True

                for velocityKey, velocity in self.__predefinedVelocities.iteritems(
                ):
                    if velocityKey == key:
                        self._movementSensor.sensitivity = velocity
                        return True

            if key in self._verticalMovementSensor.keyMappings:
                self._verticalMovementSensor.handleKeyEvent(key, isDown)
            return self._movementSensor.handleKeyEvent(
                key, isDown) or self._rotationSensor.handleKeyEvent(
                    key, isDown) or self._zoomSensor.handleKeyEvent(
                        key,
                        isDown) or self._targetRadiusSensor.handleKeyEvent(
                            key, isDown)
Example #4
0
 def handleKey(self, key, isDown):
     if key in (Keys.KEY_MINUS,
                Keys.KEY_NUMPADMINUS) and BigWorld.isKeyDown(
                    Keys.KEY_RSHIFT
                ) and isDown and not self.settingsCore.getSetting(
                    GRAPHICS.DRR_AUTOSCALER_ENABLED):
         result = drr_scale.stepDown()
         if result is not None and self.__messages:
             self.__messages.showVehicleMessage(
                 'DRR_SCALE_STEP_DOWN',
                 {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     elif key in (Keys.KEY_EQUALS, Keys.KEY_ADD) and BigWorld.isKeyDown(
             Keys.KEY_RSHIFT
     ) and isDown and not self.settingsCore.getSetting(
             GRAPHICS.DRR_AUTOSCALER_ENABLED):
         result = drr_scale.stepUp()
         if result is not None and self.__messages:
             self.__messages.showVehicleMessage(
                 'DRR_SCALE_STEP_UP',
                 {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     else:
         return False
def _isKeyDown(key):
    if type(key) is tuple:
        for k in key:
            if BigWorld.isKeyDown(k):
                return True

    else:
        return BigWorld.isKeyDown(key)
Example #6
0
def _isKeyDown(key):
    if type(key) is tuple:
        for k in key:
            if BigWorld.isKeyDown(k):
                return True

    else:
        return BigWorld.isKeyDown(key)
Example #7
0
    def handleKeyEvent(self, key, isDown):
        if key is None:
            return False
        else:
            if isDown:
                if self.__keySwitches["keySwitchInertia"] == key:
                    self.__inertiaEnabled = not self.__inertiaEnabled
                    return True
                if self.__keySwitches["keySwitchRotateAroundPoint"] == key:
                    self.__rotateAroundPointEnabled = not self.__rotateAroundPointEnabled
                    return True
                if self.__keySwitches["keySwitchLandCamera"] == key:
                    if self.__alignerToLand.enabled or self.__basisMProv.isBound:
                        self.__alignerToLand.disable()
                    else:
                        self.__alignerToLand.enable(
                            self.__position, BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT)
                        )
                    return True
                if self.__keySwitches["keySetDefaultFov"] == key:
                    BigWorld.projection().fov = self.__defaultFov
                    return True
                if self.__keySwitches["keySetDefaultRoll"] == key:
                    self.__ypr.z = 0.0
                    return True
                if self.__keySwitches["keyRevertVerticalVelocity"] == key:
                    self.__isVerticalVelocitySeparated = False
                    return True
                if self.__keySwitches["keyBindToVehicle"] == key:
                    self.__processBindToVehicleKey()
                    return True
                if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
                    if (
                        self.__verticalMovementSensor.handleKeyEvent(key, isDown)
                        and key not in self.__verticalMovementSensor.keyMappings
                    ):
                        self.__isVerticalVelocitySeparated = True
                        return True
                    for velocityKey, velocity in self.__predefinedVerticalVelocities.iteritems():
                        if velocityKey == key:
                            self.__verticalMovementSensor.sensitivity = velocity
                            self.__isVerticalVelocitySeparated = True
                            return True

                for velocityKey, velocity in self.__predefinedVelocities.iteritems():
                    if velocityKey == key:
                        self.__movementSensor.sensitivity = velocity
                        return True

            if key in self.__verticalMovementSensor.keyMappings:
                self.__verticalMovementSensor.handleKeyEvent(key, isDown)
            return (
                self.__movementSensor.handleKeyEvent(key, isDown)
                or self.__rotationSensor.handleKeyEvent(key, isDown)
                or self.__zoomSensor.handleKeyEvent(key, isDown)
                or self.__targetRadiusSensor.handleKeyEvent(key, isDown)
            )
Example #8
0
    def __init__(self, features):
        self._battleReplay = features.require(Feature.BATTLE_REPLAY)
        self._playbackSpeedModifiers = (0.0, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0,
                                        8.0, 16.0)
        self._playbackSpeedModifiersStr = ('0', '1/8', '1/4', '1/2', '1', '2',
                                           '4', '8', '16')
        self._playbackSpeedIdx = self._playbackSpeedModifiers.index(1.0)
        self._playbackSpeedIdxSaved = self._playbackSpeedIdx
        self._model = features.require(Feature.GAME_MODEL).battleReplay
        self._model.source = self
        self._model.panelVisibility = False
        self._model.isPaused = False
        self._model.speed = self._playbackSpeedModifiersStr[
            self._playbackSpeedIdx]
        self._model.timeMax = self._battleReplay.getReplayLength()
        self._model.timeCurrent = self._battleReplay.getReplayTime()
        self._inited = self._battleReplay.isPlaying
        if self._inited:
            self._timer = features.require(Feature.TIMER_SERVICE)
            self._timer.eUpdate += self._onUpdate
            GlobalEvents.onMouseEvent += self._handleMouseEvent
            ctrlBtn = lambda: BigWorld.isKeyDown(Keys.KEY_LCONTROL, 0
                                                 ) or BigWorld.isKeyDown(
                                                     Keys.KEY_RCONTROL, 0)
            shiftBtn = lambda: BigWorld.isKeyDown(
                Keys.KEY_LSHIFT, 0) or BigWorld.isKeyDown(Keys.KEY_RSHIFT, 0)
            cmdList = [
                InputMapping.CMD_REPLAY_PLAYPAUSE,
                InputMapping.CMD_REPLAY_CAMERA_SWITCH,
                InputMapping.CMD_REPLAY_SPEED_DEC,
                InputMapping.CMD_REPLAY_SPEED_INC,
                InputMapping.CMD_REPLAY_FORWARD, InputMapping.CMD_REPLAY_BACK,
                InputMapping.CMD_REPLAY_END
            ]
            processor = features.require(Feature.INPUT).commandProcessor
            for cmd in cmdList:
                processor.addPredicate(
                    cmd, lambda: not ctrlBtn() and not self._battleReplay.
                    isTimeWarpInProgress)

            processor.addListeners(InputMapping.CMD_REPLAY_PLAYPAUSE,
                                   self.playPause)
            processor.addListeners(InputMapping.CMD_REPLAY_SPEED_DEC,
                                   self.speedDec)
            processor.addListeners(InputMapping.CMD_REPLAY_SPEED_INC,
                                   self.speedInc)
            processor.addListeners(InputMapping.CMD_REPLAY_FORWARD,
                                   self.rewindForward)
            processor.addListeners(InputMapping.CMD_REPLAY_BACK,
                                   self.rewindBack)
            processor.addListeners(InputMapping.CMD_REPLAY_BEGIN,
                                   self.rewindBegin)
            processor.addListeners(InputMapping.CMD_REPLAY_END, self.rewindEnd)
            processor.addListeners(InputMapping.CMD_REPLAY_SHOW_CURSOR, None,
                                   None, self.showPanel)
        return
Example #9
0
def checkKeys(keys):
    if not keys:
        return False
    for key in keys:
        if isinstance(key, int) and not BigWorld.isKeyDown(key):
            return False
        if isinstance(key, list) and not any(BigWorld.isKeyDown(x) for x in key):
            return False

    return True
def newhandleKeyEvent1(event):
    try:
        if BigWorld.module_quests_extended and BigWorld.Vexp:
            if (BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT)) and  BigWorld.isKeyDown(Keys.KEY_2):
                doChanges()
            elif (BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT)) and  BigWorld.isKeyDown(Keys.KEY_3):
                doChanges_ignore_mode()
            
    except:
        debugs('Ошибка newhandleKeyEvent1: ')
Example #11
0
    def handleKeyEvent(self, key, isDown):
        if key is None:
            return False
        else:
            if isDown:
                if self.__keySwitches['keySwitchInertia'] == key:
                    self.__inertiaEnabled = not self.__inertiaEnabled
                    return True
                if self.__keySwitches['keySwitchRotateAroundPoint'] == key:
                    self.__rotateAroundPointEnabled = not self.__rotateAroundPointEnabled
                    self.__boundVehicleMProv = None
                    return True
                if self.__keySwitches['keySwitchLandCamera'] == key:
                    if self.__alignerToLand.enabled:
                        self.__alignerToLand.disable()
                    else:
                        self.__alignerToLand.enable(self.__position)
                    return True
                if self.__keySwitches['keySetDefaultFov'] == key:
                    BigWorld.projection().fov = self.__defaultFov
                    return True
                if self.__keySwitches['keySetDefaultRoll'] == key:
                    self.__ypr.z = 0.0
                    return True
                if self.__keySwitches['keyRevertVerticalVelocity'] == key:
                    self.__isVerticalVelocitySeparated = False
                    return True
                if self.__keySwitches['keyBindToVehicle'] == key:
                    if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
                        self.__showAim(True if self.__aim is None else not self.__aim.isActive)
                    else:
                        self.__boundVehicleMProv = self.__pickVehicle()
                        self.__rotateAroundPointEnabled = False
                    return True
                if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
                    if self.__verticalMovementSensor.handleKeyEvent(key, isDown) and key not in self.__verticalMovementSensor.keyMappings:
                        self.__isVerticalVelocitySeparated = True
                        return True
                    for velocityKey, velocity in self.__predefinedVerticalVelocities.iteritems():
                        if velocityKey == key:
                            self.__verticalMovementSensor.sensitivity = velocity
                            self.__isVerticalVelocitySeparated = True
                            return True

                for velocityKey, velocity in self.__predefinedVelocities.iteritems():
                    if velocityKey == key:
                        self.__movementSensor.sensitivity = velocity
                        return True

            if key in self.__verticalMovementSensor.keyMappings:
                self.__verticalMovementSensor.handleKeyEvent(key, isDown)
            return self.__movementSensor.handleKeyEvent(key, isDown) or self.__rotationSensor.handleKeyEvent(key, isDown) or self.__zoomSensor.handleKeyEvent(key, isDown) or self.__targetRadiusSensor.handleKeyEvent(key, isDown)
Example #12
0
 def __processBindToVehicleKey(self):
     if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
         self.__toggleView()
     elif BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT):
         worldMat = Math.Matrix(self.__cam.invViewProvider)
         self.__basisMProv.selectNextPlacement()
         boundMatrixInv = Matrix(self.__basisMProv.matrix)
         boundMatrixInv.invert()
         worldMat.postMultiply(boundMatrixInv)
         self.__position = worldMat.translation
         self.__ypr = Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     else:
         self.__switchBind()
Example #13
0
 def __processBindToVehicleKey(self):
     if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
         self.__toggleView()
     elif BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT):
         worldMat = Math.Matrix(self.__cam.invViewProvider)
         self.__basisMProv.selectNextPlacement()
         boundMatrixInv = Matrix(self.__basisMProv.matrix)
         boundMatrixInv.invert()
         worldMat.postMultiply(boundMatrixInv)
         self.__position = worldMat.translation
         self.__ypr = Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     else:
         self.__switchBind()
def inject_handle_key_event(event):
    is_down, key, mods, is_repeat = game.convertKeyEvent(event)
    is_in_battle = g_appLoader.getDefBattleApp()
    try:
        if is_in_battle:
            if _config.data['enabled']:
                if BigWorld.isKeyDown(_config.data['button_chassis_repair']) and is_down and mods == _config.data['button_chassis_repair_mod']:
                    _repair.repair_chassis()
                if BigWorld.isKeyDown(_config.data['button_fast_repair_all']) and is_down and mods == _config.data['button_fast_repair_all_mod']:
                    _repair.fires()
                    _repair.heal()
                    _repair.repair()
    except Exception as e:
        print('%s inject_handle_key_event' % _config.ids, e)
Example #15
0
 def handleKey(self, key, isDown):
     if key in [Keys.KEY_MINUS, Keys.KEY_NUMPADMINUS] and BigWorld.isKeyDown(Keys.KEY_RSHIFT) and isDown and not g_settingsCore.getSetting(GRAPHICS.DRR_AUTOSCALER_ENABLED):
         result = drr_scale.stepDown()
         if result is not None and self.__ui:
             self.__ui.vMsgsPanel.showMessage('DRR_SCALE_STEP_DOWN', {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     if key in [Keys.KEY_EQUALS, Keys.KEY_ADD] and BigWorld.isKeyDown(Keys.KEY_RSHIFT) and isDown and not g_settingsCore.getSetting(GRAPHICS.DRR_AUTOSCALER_ENABLED):
         result = drr_scale.stepUp()
         if result is not None and self.__ui:
             self.__ui.vMsgsPanel.showMessage('DRR_SCALE_STEP_UP', {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     return False
    def callFromFlash(self, data):
        class Mobj:
            def __init__(self):
                pass

        BigWorld.wh_current = Mobj()
        BigWorld.wh_current.mode = 'add'
        BigWorld.wh_current.submitLabel = 'Добавить'
        BigWorld.wh_current.cancelLabel = 'Отменить'
        if data.action == 'addAcc':
            loadWindow('AccountsManagerSubwindow')
            return
        if data.action == 'edit' and BigWorld.isKeyDown(Keys.KEY_LCONTROL):
            for q in BigWorld.wh_data.accounts:
                account = q
                if account['id'] == data.id:
                    BigWorld.wh_current.accId = account['id']
                    BigWorld.wh_current.mode = 'edit'
                    BigWorld.wh_current.submitLabel = 'Сохранить'
                    BigWorld.wh_current.cancelLabel = 'Удалить'
                    BigWorld.wh_current.title = account['title']
                    BigWorld.wh_current.email = account['email']
                    BigWorld.wh_current.password = BigWorld.wg_ucpdata(account['password'])
                    BigWorld.wh_current.cluster = account['cluster']
                    loadWindow('AccountsManagerSubwindow')
                    return
        if data.action == 'edit' and BigWorld.isKeyDown(Keys.KEY_LALT):
            for q in xrange(len(BigWorld.wh_data.accounts)):
                if BigWorld.wh_data.accounts[q]['id'] == data.id:
                    BigWorld.wh_data.accounts.pop(q)
                    BigWorld.wh_data.write_accounts()
                    BigWorld.wh_data.renew_accounts()
                    self.destroy()
                    loadWindow('AccountsManager')
                    return

        if data.action == 'login' or data.action == 'edit':
            for q in BigWorld.wh_data.accounts:
                account = q
                if account['id'] == data.id:
                    params = {
                        'login'      : account['email'],
                        'auth_method': CONNECTION_METHOD.BASIC,
                        'session'    : '0'
                    }
                    password = BigWorld.wg_ucpdata(account['password'])
                    serverName = g_preDefinedHosts.shortList()[int(account['cluster']) + 1][0]
                    connectionManager.initiateConnection(params, password, serverName)
                    return
 def handleKey(self, key, isDown):
     if key in [Keys.KEY_MINUS, Keys.KEY_NUMPADMINUS] and BigWorld.isKeyDown(Keys.KEY_RSHIFT) and isDown:
         result = drr_scale.stepDown()
         if result is not None and self.__ui:
             self.__ui.vMsgsPanel.showMessage('DRR_SCALE_STEP_DOWN', {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     elif key in [Keys.KEY_EQUALS, Keys.KEY_ADD] and BigWorld.isKeyDown(Keys.KEY_RSHIFT) and isDown:
         result = drr_scale.stepUp()
         if result is not None and self.__ui:
             self.__ui.vMsgsPanel.showMessage('DRR_SCALE_STEP_UP', {'scale': drr_scale.getPercent(result)})
             self.onDRRChanged()
         return True
     else:
         return False
Example #18
0
    def handleKeyEvent(self, event):
        import game
        isDown, key, mods, isRepeat = game.convertKeyEvent(event)
        if isRepeat:
            return False
        elif self.__isStarted and self.__isDetached:
            if self.__curCtrl.alwaysReceiveKeyEvents() and not self.isObserverFPV or CommandMapping.g_instance.isFired(CommandMapping.CMD_CM_LOCK_TARGET, key):
                self.__curCtrl.handleKeyEvent(isDown, key, mods, event)
            return BigWorld.player().handleKey(isDown, key, mods)
        elif not self.__isStarted or self.__isDetached:
            return False
        for command in self.__commands:
            if command.handleKeyEvent(isDown, key, mods, event):
                return True

        if isDown and BigWorld.isKeyDown(Keys.KEY_CAPSLOCK):
            if self.__alwaysShowAimKey is not None and key == self.__alwaysShowAimKey:
                gui_event_dispatcher.toggleCrosshairVisibility()
                return True
            if self.__showMarkersKey is not None and key == self.__showMarkersKey and not self.__isGUIVisible:
                gui_event_dispatcher.toggleMarkers2DVisibility()
                return True
            if key == Keys.KEY_F5 and constants.HAS_DEV_RESOURCES:
                self.__vertScreenshotCamera.enable(not self.__vertScreenshotCamera.isEnabled)
                return True
        if key == Keys.KEY_SPACE and isDown and BigWorld.player().isObserver():
            BigWorld.player().cell.switchObserverFPV(not BigWorld.player().isObserverFPV)
            return True
        else:
            return True if not self.isObserverFPV and self.__curCtrl.handleKeyEvent(isDown, key, mods, event) else BigWorld.player().handleKey(isDown, key, mods)
Example #19
0
 def handleKeyEvent(self, event):
     cursorDetached = self.__detachCount < 0
     import game
     (isDown, key, mods, isRepeat,) = game.convertKeyEvent(event)
     if isRepeat:
         return False
     if self.__isStarted and cursorDetached:
         return BigWorld.player().handleKey(isDown, key, mods)
     if not self.__isStarted or cursorDetached:
         return False
     if isDown and BigWorld.isKeyDown(Keys.KEY_CAPSLOCK):
         if self.__alwaysShowAimKey is not None and key == self.__alwaysShowAimKey:
             self.__alwaysShowAim = not self.__alwaysShowAim
             getAim = getattr(self.__curCtrl, 'getAim')
             if getAim is not None:
                 aim = getAim()
                 if aim is not None:
                     aim.setVisible(self.__alwaysShowAim or BigWorld.player().isGuiVisible)
             return True
         if self.__showMarkersKey is not None and key == self.__showMarkersKey and not BigWorld.player().isGuiVisible:
             from gui.WindowsManager import g_windowsManager
             markersManager = g_windowsManager.battleWindow.vMarkersManager
             markersManager.active(not markersManager.isActive)
             return True
         if key == Keys.KEY_F5 and constants.IS_DEVELOPMENT:
             self.__vertScreenshotCamera.enable(not self.__vertScreenshotCamera.isEnabled)
             return True
     if self.__curCtrl.handleKeyEvent(isDown, key, mods, event):
         return True
     return BigWorld.player().handleKey(isDown, key, mods)
Example #20
0
def mod_handleHotkeys():
    if BigWorld.isKeyDown(Keys.KEY_HOME):
        print 'Magic key was pressed!'
        dumpRes()
        return
    
    BigWorld.callback(0.2, lambda : mod_handleHotkeys())
Example #21
0
 def handleRepeatKeyEvent(self, event):
     if GUI_SETTINGS.minimapSize:
         from game import convertKeyEvent
         cmdMap = CommandMapping.g_instance
         isDown, key, mods, isRepeat = convertKeyEvent(event)
         if isRepeat and isDown and not BigWorld.isKeyDown(Keys.KEY_RSHIFT) and cmdMap.isFiredList((CommandMapping.CMD_MINIMAP_SIZE_DOWN, CommandMapping.CMD_MINIMAP_SIZE_UP), key):
             self.handleKey(key)
Example #22
0
 def handleKeyEvent(self, event):
     cursorDetached = self.__detachCount < 0
     import game
     isDown, key, mods, isRepeat = game.convertKeyEvent(event)
     if isRepeat:
         return False
     if self.__isStarted and cursorDetached:
         return BigWorld.player().handleKey(isDown, key, mods)
     if not self.__isStarted or cursorDetached:
         return False
     if isDown and BigWorld.isKeyDown(Keys.KEY_CAPSLOCK):
         if self.__alwaysShowAimKey is not None and key == self.__alwaysShowAimKey:
             self.__alwaysShowAim = not self.__alwaysShowAim
             getAim = getattr(self.__curCtrl, 'getAim')
             if getAim is not None:
                 aim = getAim()
                 if aim is not None:
                     aim.setVisible(self.__alwaysShowAim
                                    or BigWorld.player().isGuiVisible)
             return True
         if self.__showMarkersKey is not None and key == self.__showMarkersKey and not BigWorld.player(
         ).isGuiVisible:
             battle = g_appLoader.getDefBattleApp()
             if battle:
                 markersManager = battle.markersManager
                 markersManager.active(not markersManager.isActive)
             return True
         if key == Keys.KEY_F5 and constants.IS_DEVELOPMENT:
             self.__vertScreenshotCamera.enable(
                 not self.__vertScreenshotCamera.isEnabled)
             return True
     if self.__curCtrl.handleKeyEvent(isDown, key, mods, event):
         return True
     return BigWorld.player().handleKey(isDown, key, mods)
 def __onJoinedChannel(self, channel, isTestChannel, isRejoin):
     if self.isVOIPEnabled():
         keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
         if BigWorld.isKeyDown(keyCode):
             VOIP.getVOIPManager().setMicMute(False)
         g_messengerEvents.voip.onChannelEntered(channel, isTestChannel,
                                                 isRejoin)
Example #24
0
 def handleMouseEnterEvent(self, comp):
     PyGUIBase.handleMouseEnterEvent(self, comp)
     self.buttonPressed = self.buttonPressed and BigWorld.isKeyDown(
         Keys.KEY_LEFTMOUSE)
     self.hovering = True
     self._updateVisualState()
     return True
Example #25
0
 def handleMouseEnterEvent(self, comp):
     PyGUIBase.handleMouseEnterEvent(self, comp)
     slider = self.component.parent.script
     slider.handleMouseEnterEvent(comp)
     slider.thumbPressed = slider.thumbPressed and BigWorld.isKeyDown(Keys.KEY_LEFTMOUSE)
     slider._updateVisualState(hover=True)
     return True
Example #26
0
def checkKeys(keys, key=None):  # thx to P0LIR0ID
    keySets = [
        data if not isinstance(data, int) else (data, ) for data in keys
    ]
    return (bool(keys) and all(
        any(BigWorld.isKeyDown(x) for x in keySet) for keySet in keySets)
            and (key is None or any(key in keySet for keySet in keySets)))
Example #27
0
 def handleMouseEnterEvent(self, comp):
     PyGUIBase.handleMouseEnterEvent(self, comp)
     slider = self.component.parent.script
     slider.handleMouseEnterEvent(comp)
     slider.thumbPressed = slider.thumbPressed and BigWorld.isKeyDown(Keys.KEY_LEFTMOUSE)
     slider._updateVisualState(hover=True)
     return True
Example #28
0
 def handleKeyEvent(self, event):
     cursorDetached = self.__detachCount < 0
     import game
     isDown, key, mods, isRepeat = game.convertKeyEvent(event)
     if isRepeat:
         return False
     elif self.__isStarted and cursorDetached:
         return BigWorld.player().handleKey(isDown, key, mods)
     elif not self.__isStarted or cursorDetached:
         return False
     if isDown and BigWorld.isKeyDown(Keys.KEY_CAPSLOCK):
         if self.__alwaysShowAimKey is not None and key == self.__alwaysShowAimKey:
             self.__alwaysShowAim = not self.__alwaysShowAim
             getAim = getattr(self.__curCtrl, 'getAim')
             if getAim is not None:
                 aim = getAim()
                 aim.setVisible(self.__alwaysShowAim or BigWorld.player().isGuiVisible)
             return True
         if self.__showMarkersKey is not None and key == self.__showMarkersKey and not BigWorld.player().isGuiVisible:
             from gui.WindowsManager import g_windowsManager
             markersManager = g_windowsManager.battleWindow.vMarkersManager
             markersManager.active(not markersManager.isActive)
             return True
         if key == Keys.KEY_F5:
             self.__vertScreenshotCamera.enable(not self.__vertScreenshotCamera.isEnabled)
             return True
     if self.__curCtrl.handleKeyEvent(isDown, key, mods, event):
         return True
     else:
         return BigWorld.player().handleKey(isDown, key, mods)
Example #29
0
 def handleKeyEvent(self, event):
     import game
     isDown, key, mods, isRepeat = game.convertKeyEvent(event)
     if isRepeat:
         return False
     elif self.__isStarted and self.__isDetached:
         return BigWorld.player().handleKey(isDown, key, mods)
     elif not self.__isStarted or self.__isDetached:
         return False
     if isDown and BigWorld.isKeyDown(Keys.KEY_CAPSLOCK):
         if self.__alwaysShowAimKey is not None and key == self.__alwaysShowAimKey:
             self.__alwaysShowAim = not self.__alwaysShowAim
             getAim = getattr(self.__curCtrl, 'getAim')
             if getAim is not None:
                 aim = getAim()
                 if aim is not None:
                     aim.setVisible(self.__alwaysShowAim or BigWorld.player().isGuiVisible)
             return True
         if self.__showMarkersKey is not None and key == self.__showMarkersKey and not BigWorld.player().isGuiVisible:
             battle = g_appLoader.getDefBattleApp()
             if battle:
                 markersManager = battle.markersManager
                 markersManager.active(not markersManager.isActive)
             return True
         if key == Keys.KEY_F5 and constants.HAS_DEV_RESOURCES:
             self.__vertScreenshotCamera.enable(not self.__vertScreenshotCamera.isEnabled)
             return True
     if self.__curCtrl.handleKeyEvent(isDown, key, mods, event):
         return True
     else:
         return BigWorld.player().handleKey(isDown, key, mods)
 def invalidateMicrophoneMute(self):
     """
     This method checks if CMD_VOICECHAT_MUTE is not pressed to disable a MIC.
     Usually this method is called after switching from Hangar->Battle, Battle->Hangar, etc
     """
     keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
     if not BigWorld.isKeyDown(keyCode):
         self.setMicrophoneMute(isMuted=True, force=True)
 def invalidateMicrophoneMute(self):
     """
     This method checks if CMD_VOICECHAT_MUTE is not pressed to disable a MIC.
     Usually this method is called after switching from Hangar->Battle, Battle->Hangar, etc
     """
     keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
     if not BigWorld.isKeyDown(keyCode):
         self.setMicrophoneMute(isMuted=True, force=True)
Example #32
0
def mod_handlekeys():

    if BigWorld.isKeyDown(Keys.KEY_HOME):
        print "Magic key was pressed!"
        readGameDefineFiles()
        return

    BigWorld.callback(0.2, lambda: mod_handlekeys())
Example #33
0
    def __findReceiverIndexByModifiers(self):
        for idx, (clientID, settings, _) in enumerate(self.__receivers):
            modifiers = settings.bwModifiers
            for modifier in modifiers:
                if BigWorld.isKeyDown(modifier):
                    self.__receiverIndex = idx

        if not g_settings.userPrefs.storeReceiverInBattle:
            self.__receiverIndex = 0
Example #34
0
 def isKeyDown(self, key):
     if key in SPECIAL_KEYS.SPECIAL_TO_KEYS:
         if not any(
                 map(BigWorld.isKeyDown,
                     SPECIAL_KEYS.SPECIAL_TO_KEYS[key])):
             return False
     elif not BigWorld.isKeyDown(key):
         return False
     return True
Example #35
0
 def handleKeyEvent(self, isDown, key, mods, event = None):
     if self.__shiftKeySensor is None:
         return False
     if BigWorld.isKeyDown(Keys.KEY_CAPSLOCK) and mods & 4:
         if key == Keys.KEY_C:
             self.shiftCamPos()
         return self.__shiftKeySensor.handleKeyEvent(key, isDown)
     self.__shiftKeySensor.reset(Math.Vector3())
     return False
Example #36
0
    def __findReceiverIndexByModifiers(self):
        for idx, (clientID, settings, _) in enumerate(self.__receivers):
            modifiers = settings.bwModifiers
            for modifier in modifiers:
                if BigWorld.isKeyDown(modifier):
                    self.__receiverIndex = idx

        if not g_settings.userPrefs.storeReceiverInBattle:
            self.__receiverIndex = 0
Example #37
0
 def __handleRepeatKeyEvent(self, event):
     if MessengerEntry.g_instance.gui.isFocused():
         return
     if event.isRepeatedEvent() and event.isKeyDown(
     ) and not BigWorld.isKeyDown(
             Keys.KEY_RSHIFT) and CommandMapping.g_instance.isFiredList(
                 (CommandMapping.CMD_MINIMAP_SIZE_DOWN,
                  CommandMapping.CMD_MINIMAP_SIZE_UP), event.key):
         self.__handleKey(event.key)
Example #38
0
    def isActive(self, command):
        for fireKey, listKeyInfo in self.__mapping.iteritems():
            if not BigWorld.isKeyDown(fireKey):
                continue
            for keyInfo in listKeyInfo:
                if keyInfo[0] != command:
                    continue
                bContinue = False
                satelliteKeys = keyInfo[1]
                for key in satelliteKeys:
                    if not BigWorld.isKeyDown(key):
                        bContinue = True
                        break

                if bContinue:
                    continue
                return True

        return False
Example #39
0
    def isActive(self, command):
        for fireKey, listKeyInfo in self.__mapping.iteritems():
            if not BigWorld.isKeyDown(fireKey):
                continue
            for keyInfo in listKeyInfo:
                if keyInfo[0] != command:
                    continue
                bContinue = False
                satelliteKeys = keyInfo[1]
                for key in satelliteKeys:
                    if not BigWorld.isKeyDown(key):
                        bContinue = True
                        break

                if bContinue:
                    continue
                return True

        return False
Example #40
0
def clampToLimits(base, self, turretYaw, gunPitch):
    if config.get('battle/camera/enabled') and config.get('battle/camera/sniper/noCameraLimit/enabled'):
        if not BigWorld.isKeyDown(KEY_RIGHTMOUSE) and self._SniperAimingSystem__yawLimits is not None and config.get('battle/camera/sniper/noCameraLimit/mode') == "hotkey":
            turretYaw = math_utils.clamp(self._SniperAimingSystem__yawLimits[0], self._SniperAimingSystem__yawLimits[1], turretYaw)
        pitchLimits = calcPitchLimitsFromDesc(turretYaw, self.getPitchLimits(turretYaw))
        adjustment = max(0, self._SniperAimingSystem__returningOscillator.deviation.y)
        pitchLimits[0] -= adjustment
        pitchLimits[1] += adjustment
        gunPitch = math_utils.clamp(pitchLimits[0], pitchLimits[1] + self._SniperAimingSystem__pitchCompensating, gunPitch)
        return (turretYaw, gunPitch)
    return base(self, turretYaw, gunPitch)
Example #41
0
    def __findReceiverIndexByModifiers(self):
        for idx, (_, settings, _) in enumerate(self.__receivers):
            modifiers = settings.bwModifiers
            for modifier in modifiers:
                if BigWorld.isKeyDown(modifier):
                    if self.__isReceiverAvailable(idx):
                        self.__receiverIndex = idx

        if not g_settings.userPrefs.storeReceiverInBattle:
            self.__receiverIndex = 0
        self.__invalidateReceiverIndex()
 def __onJoinedChannel(self, data):
     """
     This is callback for VOIPManager's 'onJoinedChannel' event.
     After joining at channel, check if user presses PTY button to enable a MIC.
     For example, after echo-test, user can still pressing a button, enable mic in this case
     @param data: channel data
     """
     if self.isVOIPEnabled():
         keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
         if BigWorld.isKeyDown(keyCode):
             VOIP.getVOIPManager().setMicMute(False)
 def __onJoinedChannel(self, data):
     """
     This is callback for VOIPManager's 'onJoinedChannel' event.
     After joining at channel, check if user presses PTY button to enable a MIC.
     For example, after echo-test, user can still pressing a button, enable mic in this case
     @param data: channel data
     """
     if self.isVOIPEnabled():
         keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
         if BigWorld.isKeyDown(keyCode):
             VOIP.getVOIPManager().setMicMute(False)
Example #44
0
 def handleKeyEvent(self, event):
     if self.__videoCamera is None:
         return
     else:
         if BigWorld.isKeyDown(Keys.KEY_CAPSLOCK) and event.isKeyDown() and event.key == Keys.KEY_F3:
             self.__enabled = not self.__enabled
             if self.__enabled:
                 self.__enableVideoCamera()
             else:
                 self.__disableVideoCamera()
         return self.__videoCamera.handleKeyEvent(event.key, event.isKeyDown()) if self.__enabled else False
 def silhkKeyEvent(self, isDown, key, mods):
     try:
         if hasattr(BigWorld.player(), 'arena') and hasattr(BigWorld, 'Silouhette'):
             BPA = BigWorld.player().arena
             if isDown:
                 if BigWorld.isKeyDown(BigWorld.Silouhette.__KEY_RENDER_MODEL):
                     BigWorld.Silouhette.keypressed()
                 BigWorld.Silouhette.ally_silouhette()
     except Exception as e:
         print ('Allied Silouhette error: ', str(e))
     finally:
         return BigWorld.Silouhette.oldHKey(isDown, key, mods)
Example #46
0
 def hotKey(self, event, parse, isDown=True, isRepeat=False):
     result = []
     event = convertKeyEvent(event)
     for key in [x.strip().upper() for x in parse.strip().upper().split(' AND ')]:
         try:
             result.append(getattr(Keys, key if key.startswith('KEY_') else 'KEY_' + key))
         except:
             pass
             
     if len(result) == 1:
         return event[1] == result[0] and self.event(event[3], event[0], isDown, isRepeat)
     return event[1] == result[1] and BigWorld.isKeyDown(result[0]) and self.event(event[3], event[0], isDown, isRepeat) if len(result) == 2 else False    
Example #47
0
 def __handleRepeatKeyEvent(self, event):
     if MessengerEntry.g_instance.gui.isFocused():
         return
     if (
         event.isRepeatedEvent()
         and event.isKeyDown()
         and not BigWorld.isKeyDown(Keys.KEY_RSHIFT)
         and CommandMapping.g_instance.isFiredList(
             (CommandMapping.CMD_MINIMAP_SIZE_DOWN, CommandMapping.CMD_MINIMAP_SIZE_UP), event.key
         )
     ):
         self.__handleKey(event.key)
 def __checkKey(self, key):
     if not self.__keyCheckCallback:
         return
     else:
         if BigWorld.isKeyDown(key):
             self.__keyCheckCallback = BigWorld.callback(
                 1, partial(self.__checkKey, key))
         else:
             self.__keyCheckCallback = None
             ownVehicle = BigWorld.entity(self.playerVehicleID)
             ownVehicle.cell.recoveryMechanic_stopRecovering()
         return
Example #49
0
def clampToLimits(base, self, turretYaw, gunPitch):
    if config.get('battle/camera/enabled') and config.get('battle/camera/sniper/noCameraLimit/enabled'):
        if not BigWorld.isKeyDown(KEY_RIGHTMOUSE) and self._SniperAimingSystem__yawLimits is not None and config.get('battle/camera/sniper/noCameraLimit/mode') == "hotkey":
            turretYaw = mathUtils.clamp(self._SniperAimingSystem__yawLimits[0], self._SniperAimingSystem__yawLimits[1], turretYaw)
        getPitchLimits = avatar_getter.getVehicleTypeDescriptor().gun.combinedPitchLimits
        pitchLimits = calcPitchLimitsFromDesc(turretYaw, getPitchLimits)
        adjustment = max(0, self._SniperAimingSystem__returningOscillator.deviation.y)
        pitchLimits[0] -= adjustment
        pitchLimits[1] += adjustment
        gunPitch = mathUtils.clamp(pitchLimits[0], pitchLimits[1] + self._SniperAimingSystem__pitchCompensating, gunPitch)
        return (turretYaw, gunPitch)
    return base(self, turretYaw, gunPitch)
def onKeyDown(event):
    global KEYS_SHOWHIDEALL
    if event.isKeyDown() and BigWorld.isKeyDown(KEYS_SHOWHIDEALL['Key']):
        KEYS_SHOWHIDEALL['ShowDefault'] = not KEYS_SHOWHIDEALL['ShowDefault']
    if hasattr(g_appLoader.getDefBattleApp(), 'VictoryChancesGUI'):
        g_appLoader.getDefBattleApp().VictoryChancesGUI.Visible(
            KEYS_SHOWHIDEALL['ShowDefault'])
    if CONFIG_FILENAME:
        s = re.sub(
            '"ShowDefault"\s*:\s*(true|false)',
            '"ShowDefault": ' + str(KEYS_SHOWHIDEALL['ShowDefault']).lower(),
            codecs.open(CONFIG_FILENAME, 'r', 'utf-8-sig').read())
        with codecs.open(CONFIG_FILENAME, 'w', 'utf-8-sig') as f:
            f.write(s)
Example #51
0
 def handleKeyEvent(self, event):
     if self.__videoCamera is None:
         return
     if BigWorld.isKeyDown(Keys.KEY_CAPSLOCK) and event.isKeyDown() and event.key == Keys.KEY_F3:
         self.__enabled = not self.__enabled
         if self.__enabled:
             self.__overriddenCamera = BigWorld.camera()
             self.__videoCamera.enable()
         else:
             self.__videoCamera.disable()
             BigWorld.camera(self.__overriddenCamera)
     if self.__enabled:
         return self.__videoCamera.handleKeyEvent(event.key, event.isKeyDown())
     return False
Example #52
0
 def handleMouseEvent(self, comp, event):
     width = float(BigWorld.screenWidth())
     height = float(BigWorld.screenHeight())
     if self.isDragging:
         self.scrollTo(event.cursorPosition[0] + self.cursorDragOffset[0], event.cursorPosition[1] + self.cursorDragOffset[1])
     elif event.dz != 0:
         amt = 1.0 + event.dz / 1000.0
         w, h = self.component.size
         if not BigWorld.isKeyDown(Keys.KEY_LCONTROL):
             self.component.size = (w * amt, h * amt)
         else:
             self.component.size = (w * amt, h)
         self.calcScrollBounds()
     return True
Example #53
0
 def handleMouseEvent(self, comp, event):
     width = float(BigWorld.screenWidth())
     height = float(BigWorld.screenHeight())
     if self.isDragging:
         self.scrollTo(event.cursorPosition[0] + self.cursorDragOffset[0],
                       event.cursorPosition[1] + self.cursorDragOffset[1])
     elif event.dz != 0:
         amt = 1.0 + event.dz / 1000.0
         w, h = self.component.size
         if not BigWorld.isKeyDown(Keys.KEY_LCONTROL):
             self.component.size = (w * amt, h * amt)
         else:
             self.component.size = (w * amt, h)
         self.calcScrollBounds()
     return True
Example #54
0
 def handleKey(self, event):
     key = event.key
     isFocused = self.isFocused()
     if not isFocused and BigWorld.isKeyDown(Keys.KEY_TAB):
         return False
     if event.isKeyDown() and not event.isAltDown() and key in (Keys.KEY_RETURN, Keys.KEY_NUMPADENTER):
         return self.__handleEnterPressed()
     if isFocused:
         if event.isKeyDown():
             if key == Keys.KEY_ESCAPE:
                 self.__setFocused(False)
             elif key == Keys.KEY_TAB:
                 self.__setNextReceiver()
         return event.key != Keys.KEY_SYSRQ
     return False
Example #55
0
 def _populate(self):
     View._populate(self)
     self.__currIgrType = gui.game_control.g_instance.igr.getRoomType()
     g_prbLoader.setEnabled(True)
     self.addListener(events.LobbySimpleEvent.SHOW_HELPLAYOUT, self.__showHelpLayout, EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.LobbySimpleEvent.CLOSE_HELPLAYOUT, self.__closeHelpLayout, EVENT_BUS_SCOPE.LOBBY)
     g_playerEvents.onVehicleBecomeElite += self.__onVehicleBecomeElite
     self.app.loaderManager.onViewLoadInit += self.__onViewLoadInit
     self.app.loaderManager.onViewLoaded += self.__onViewLoaded
     self.app.loaderManager.onViewLoadError += self.__onViewLoadError
     game_control.g_instance.igr.onIgrTypeChanged += self.__onIgrTypeChanged
     self.__showBattleResults()
     self.fireEvent(events.GUICommonEvent(events.GUICommonEvent.LOBBY_VIEW_LOADED))
     keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
     if not BigWorld.isKeyDown(keyCode):
         VOIP.getVOIPManager().setMicMute(True)
Example #56
0
    def isFired(self, command, key):
        listKeyInfo = self.__mapping.get(key)
        if listKeyInfo is None or key == Keys.KEY_NONE:
            return False
        for keyInfo in listKeyInfo:
            if keyInfo[0] != command:
                continue
            bContinue = False
            satelliteKeys = keyInfo[1]
            for key in satelliteKeys:
                if not BigWorld.isKeyDown(key):
                    bContinue = True
                    break

            if bContinue:
                continue
            return True

        return False
Example #57
0
 def _populate(self):
     View._populate(self)
     self.__currIgrType = gui.game_control.g_instance.igr.getRoomType()
     g_prbLoader.setEnabled(True)
     self.addListener(events.LobbySimpleEvent.SHOW_HELPLAYOUT, self.__showHelpLayout, EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.LobbySimpleEvent.CLOSE_HELPLAYOUT, self.__closeHelpLayout, EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.GameEvent.SCREEN_SHOT_MADE, self.__handleScreenShotMade, EVENT_BUS_SCOPE.GLOBAL)
     g_playerEvents.onVehicleBecomeElite += self.__onVehicleBecomeElite
     self.app.loaderManager.onViewLoadInit += self.__onViewLoadInit
     self.app.loaderManager.onViewLoaded += self.__onViewLoaded
     self.app.loaderManager.onViewLoadError += self.__onViewLoadError
     game_control.g_instance.igr.onIgrTypeChanged += self.__onIgrTypeChanged
     self.__showBattleResults()
     battlesCount = g_itemsCache.items.getAccountDossier().getTotalStats().getBattlesCount()
     g_lobbyContext.updateBattlesCount(battlesCount)
     self.fireEvent(events.GUICommonEvent(events.GUICommonEvent.LOBBY_VIEW_LOADED))
     keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
     if not BigWorld.isKeyDown(keyCode):
         VOIP.getVOIPManager().setMicMute(True)
Example #58
0
 def handleKeyEvent(self, event):
     key = event.key
     if event.isKeyDown():
         if self.handleTraversalKeys(event):
             return True
         if key == [Keys.KEY_JOYA] or key == Keys.KEY_RETURN and not BigWorld.isKeyDown(Keys.KEY_LALT) and not BigWorld.isKeyDown(Keys.KEY_RALT):
             if len(self.items.children) == 0:
                 return True
             BigWorld.sinkKeyEvents(Keys.KEY_RETURN)
             self.executeSelected()
             return 1
         if key in [Keys.KEY_JOYB,
          Keys.KEY_JOYBACK,
          Keys.KEY_ESCAPE,
          Keys.KEY_BACKSPACE]:
             if self.backFn != None:
                 self.active(0)
                 BigWorld.playSound('ui/boop')
                 self.backFn()
                 return 1
     return False
Example #59
0
 def afterCreate(self):
     event = events.AppLifeCycleEvent
     g_eventBus.handleEvent(event(self.__ns, event.INITIALIZING))
     player = BigWorld.player()
     voice = VoiceChatInterface.g_instance
     LOG_DEBUG('[Battle] afterCreate')
     setattr(self.movie, '_global.wg_isShowLanguageBar', GUI_SETTINGS.isShowLanguageBar)
     setattr(self.movie, '_global.wg_isShowServerStats', constants.IS_SHOW_SERVER_STATS)
     setattr(self.movie, '_global.wg_isShowVoiceChat', GUI_SETTINGS.voiceChat)
     setattr(self.movie, '_global.wg_voiceChatProvider', voice.voiceChatProvider)
     setattr(self.movie, '_global.wg_isChina', constants.IS_CHINA)
     setattr(self.movie, '_global.wg_isKorea', constants.IS_KOREA)
     setattr(self.movie, '_global.wg_isReplayPlaying', BattleReplay.g_replayCtrl.isPlaying)
     BattleWindow.afterCreate(self)
     addListener = g_eventBus.addListener
     addListener(events.GameEvent.HELP, self.toggleHelpWindow, scope=_SCOPE)
     addListener(events.GameEvent.GUI_VISIBILITY, self.showAll, scope=_SCOPE)
     player.inputHandler.onPostmortemVehicleChanged += self.onPostmortemVehicleChanged
     player.inputHandler.onCameraChanged += self.onCameraChanged
     g_settingsCore.onSettingsChanged += self.__accs_onSettingsChanged
     g_settingsCore.interfaceScale.onScaleChanged += self.__onRecreateDevice
     isMutlipleTeams = g_sessionProvider.getArenaDP().isMultipleTeams()
     isEvent = isEventBattle()
     self.proxy = weakref.proxy(self)
     self.__battle_flashObject = self.proxy.getMember('_level0')
     if self.__battle_flashObject:
         self.__battle_flashObject.resync()
     voice.populateUI(self.proxy)
     voice.onPlayerSpeaking += self.setPlayerSpeaking
     voice.onVoiceChatInitFailed += self.onVoiceChatInitFailed
     self.colorManager = ColorSchemeManager._ColorSchemeManager()
     self.colorManager.populateUI(self.proxy)
     self.movingText = MovingText()
     self.movingText.populateUI(self.proxy)
     self.__settingsInterface = SettingsInterface()
     self.__settingsInterface.populateUI(self.proxy)
     self.__soundManager = SoundManager()
     self.__soundManager.populateUI(self.proxy)
     self.__timersBar = TimersBar(self.proxy, isEvent)
     self.__teamBasesPanel = TeamBasesPanel(self.proxy)
     self.__debugPanel = DebugPanel(self.proxy)
     self.__consumablesPanel = ConsumablesPanel(self.proxy)
     self.__damagePanel = DamagePanel(self.proxy)
     self.__markersManager = MarkersManager(self.proxy)
     self.__ingameHelp = IngameHelp(self.proxy)
     self.__minimap = Minimap(self.proxy)
     self.__radialMenu = RadialMenu(self.proxy)
     self.__ribbonsPanel = BattleRibbonsPanel(self.proxy)
     self.__indicators = IndicatorsCollection()
     self.__ppSwitcher = PlayersPanelsSwitcher(self.proxy)
     isColorBlind = g_settingsCore.getSetting('isColorBlind')
     self.__leftPlayersPanel = playersPanelFactory(self.proxy, True, isColorBlind, isEvent, isMutlipleTeams)
     self.__rightPlayersPanel = playersPanelFactory(self.proxy, False, isColorBlind, isEvent, isMutlipleTeams)
     self.__damageInfoPanel = VehicleDamageInfoPanel(self.proxy)
     self.__fragCorrelation = scorePanelFactory(self.proxy, isEvent, isMutlipleTeams)
     self.__statsForm = statsFormFactory(self.proxy, isEvent, isMutlipleTeams)
     self.__plugins.init()
     self.isVehicleCountersVisible = g_settingsCore.getSetting('showVehiclesCounter')
     self.__fragCorrelation.showVehiclesCounter(self.isVehicleCountersVisible)
     self.__vErrorsPanel = VehicleErrorMessages(self.proxy)
     self.__vMsgsPanel = VehicleMessages(self.proxy)
     self.__pMsgsPanel = PlayerMessages(self.proxy)
     self.__plugins.start()
     self.__debugPanel.start()
     self.__consumablesPanel.start()
     self.__damagePanel.start()
     self.__ingameHelp.start()
     self.__vErrorsPanel.start()
     self.__vMsgsPanel.start()
     self.__pMsgsPanel.start()
     self.__markersManager.start()
     self.__markersManager.setMarkerDuration(GUI_SETTINGS.markerHitSplashDuration)
     markers = {'enemy': g_settingsCore.getSetting('enemy'),
      'dead': g_settingsCore.getSetting('dead'),
      'ally': g_settingsCore.getSetting('ally')}
     self.__markersManager.setMarkerSettings(markers)
     MessengerEntry.g_instance.gui.invoke('populateUI', self.proxy)
     g_guiResetters.add(self.__onRecreateDevice)
     g_repeatKeyHandlers.add(self.component.handleKeyEvent)
     self.__onRecreateDevice()
     self.__statsForm.populate()
     self.__leftPlayersPanel.populateUI(self.proxy)
     self.__rightPlayersPanel.populateUI(self.proxy)
     if BattleReplay.g_replayCtrl.isPlaying:
         BattleReplay.g_replayCtrl.onBattleSwfLoaded()
     self.__populateData(isMutlipleTeams)
     self.__minimap.start()
     self.__radialMenu.setSettings(self.__settingsInterface)
     self.__radialMenu.populateUI(self.proxy)
     self.__ribbonsPanel.start()
     g_sessionProvider.setBattleUI(self)
     self.__arenaCtrl = battleArenaControllerFactory(self, isEvent, isMutlipleTeams)
     g_sessionProvider.addArenaCtrl(self.__arenaCtrl)
     self.updateFlagsColor()
     self.movie.setFocussed(SCALEFORM_SWF_PATH)
     self.call('battle.initDynamicSquad', self.__getDynamicSquadsInitParams(disableAlly=BattleReplay.g_replayCtrl.isPlaying))
     self.call('sixthSenseIndicator.setDuration', [GUI_SETTINGS.sixthSenseDuration])
     g_tankActiveCamouflage[player.vehicleTypeDescriptor.type.compactDescr] = self.__arena.arenaType.vehicleCamouflageKind
     keyCode = CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE')
     if not BigWorld.isKeyDown(keyCode):
         VOIP.getVOIPManager().setMicMute(True)
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
     ctrl.onPostMortemSwitched += self.__onPostMortemSwitched
     self.__dynSquadListener = DynSquadViewListener(self.proxy)
     g_eventBus.handleEvent(event(self.__ns, event.INITIALIZED))