Beispiel #1
0
 def onPostmortemVehicleChanged(self, id):
     if self.__cameraVehicleID == id:
         return
     self.__cameraVehicleID = id
     self.__arenaCtrl.invalidateGUI(not g_sessionProvider.getCtx().isPlayerObserver())
     g_sessionProvider.getVehicleStateCtrl().switchToAnother(id)
     self._hideVehicleTimer('ALL')
     self.__vErrorsPanel.clear()
     self.__vMsgsPanel.clear()
     aim = BigWorld.player().inputHandler.aim
     if aim is not None:
         aim.updateAmmoState(True)
Beispiel #2
0
 def onPostmortemVehicleChanged(self, id):
     if self.__cameraVehicleID == id:
         return
     else:
         self.__cameraVehicleID = id
         self.__arenaCtrl.invalidateGUI(not g_sessionProvider.getCtx().isPlayerObserver())
         g_sessionProvider.getVehicleStateCtrl().switchToAnother(id)
         self._hideVehicleTimer('ALL')
         self.__vErrorsPanel.clear()
         self.__vMsgsPanel.clear()
         aim = BigWorld.player().inputHandler.aim
         if aim is not None:
             aim.updateAmmoState(True)
         return
 def __removeListeners(self):
     g_eventBus.removeListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE)
     vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
     if vehicleCtrl is not None:
         vehicleCtrl.onPostMortemSwitched -= self.__onPostMortemSwitched
         vehicleCtrl.onRespawnBaseMoving -= self.__onRespawnBaseMoving
         vehicleCtrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     if ammoCtrl is not None:
         ammoCtrl.onShellsAdded -= self.__onShellsAdded
         ammoCtrl.onShellsUpdated -= self.__onShellsUpdated
         ammoCtrl.onNextShellChanged -= self.__onNextShellChanged
         ammoCtrl.onCurrentShellChanged -= self.__onCurrentShellChanged
         ammoCtrl.onGunReloadTimeSet -= self.__onGunReloadTimeSet
         ammoCtrl.onGunReloadTimeSetInPercent -= self.__onGunReloadTimeSetInPercent
     eqCtrl = g_sessionProvider.getEquipmentsCtrl()
     if eqCtrl is not None:
         eqCtrl.onEquipmentAdded -= self.__onEquipmentAdded
         eqCtrl.onEquipmentUpdated -= self.__onEquipmentUpdated
         eqCtrl.onEquipmentCooldownInPercent -= self.__onEquipmentCooldownInPercent
     optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
     if optDevicesCtrl is not None:
         optDevicesCtrl.onOptionalDeviceAdded -= self.__onOptionalDeviceAdded
         optDevicesCtrl.onOptionalDeviceUpdated -= self.__onOptionalDeviceUpdated
     return
Beispiel #4
0
    def __handleEquipmentExpanded(self, intCD):
        if not self.__flashObject.getVisibility():
            return
        result, error = g_sessionProvider.getEquipmentsCtrl().changeSetting(intCD)
        if not result and error:
            self.__ui.vErrorsPanel.showMessage(error.key, error.ctx)
            return
        if intCD not in self.__cds:
            LOG_ERROR('Equipment is not found in panel', intCD, self.__cds)
            return
        item = g_sessionProvider.getEquipmentsCtrl().getEquipment(intCD)
        if not item:
            LOG_ERROR('Equipment is not found in control', intCD)
            return
        slots = []
        keys = {}
        for entityIdx, (itemName, entityName, entityState) in enumerate(item.getGuiIterator()):
            bwKey, sfKey = self.__genKey(entityIdx)
            keys[bwKey] = partial(self.__handleEquipmentPressed, intCD, entityName)
            slots.append({'bwKeyCode': bwKey,
             'sfKeyCode': sfKey,
             'entityName': itemName,
             'entityState': entityState})

        self.__flashObject.expandEquipmentSlot(self.__cds.index(intCD), slots)
        self.__keys.clear()
        self.__keys = keys
        ctrl = g_sessionProvider.getVehicleStateCtrl()
        ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
Beispiel #5
0
 def __removeListeners(self):
     g_eventBus.removeListener(GameEvent.CHOICE_CONSUMABLE,
                               self.__handleConsumableChoice,
                               scope=EVENT_BUS_SCOPE.BATTLE)
     vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
     if vehicleCtrl is not None:
         vehicleCtrl.onPostMortemSwitched -= self.__onPostMortemSwitched
         vehicleCtrl.onRespawnBaseMoving -= self.__onRespawnBaseMoving
         vehicleCtrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     if ammoCtrl is not None:
         ammoCtrl.onShellsAdded -= self.__onShellsAdded
         ammoCtrl.onShellsUpdated -= self.__onShellsUpdated
         ammoCtrl.onNextShellChanged -= self.__onNextShellChanged
         ammoCtrl.onCurrentShellChanged -= self.__onCurrentShellChanged
         ammoCtrl.onGunReloadTimeSet -= self.__onGunReloadTimeSet
         ammoCtrl.onGunReloadTimeSetInPercent -= self.__onGunReloadTimeSetInPercent
     eqCtrl = g_sessionProvider.getEquipmentsCtrl()
     if eqCtrl is not None:
         eqCtrl.onEquipmentAdded -= self.__onEquipmentAdded
         eqCtrl.onEquipmentUpdated -= self.__onEquipmentUpdated
         eqCtrl.onEquipmentCooldownInPercent -= self.__onEquipmentCooldownInPercent
     optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
     if optDevicesCtrl is not None:
         optDevicesCtrl.onOptionalDeviceAdded -= self.__onOptionalDeviceAdded
         optDevicesCtrl.onOptionalDeviceUpdated -= self.__onOptionalDeviceUpdated
     return
    def __handleEquipmentExpanded(self, intCD):
        if not self.__flashObject.getVisibility():
            return
        result, error = g_sessionProvider.getEquipmentsCtrl().changeSetting(
            intCD)
        if not result and error:
            self.__ui.vErrorsPanel.showMessage(error.key, error.ctx)
            return
        if intCD not in self.__cds:
            LOG_ERROR('Equipment is not found in panel', intCD, self.__cds)
            return
        item = g_sessionProvider.getEquipmentsCtrl().getEquipment(intCD)
        if not item:
            LOG_ERROR('Equipment is not found in control', intCD)
            return
        slots = []
        keys = {}
        for entityIdx, (itemName, entityName,
                        entityState) in enumerate(item.getGuiIterator()):
            bwKey, sfKey = self.__genKey(entityIdx)
            keys[bwKey] = partial(self.__handleEquipmentPressed, intCD,
                                  entityName)
            slots.append({
                'bwKeyCode': bwKey,
                'sfKeyCode': sfKey,
                'entityName': itemName,
                'entityState': entityState
            })

        self.__flashObject.expandEquipmentSlot(self.__cds.index(intCD), slots)
        self.__keys.clear()
        self.__keys = keys
        ctrl = g_sessionProvider.getVehicleStateCtrl()
        ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
Beispiel #7
0
    def onPopUpClosed(self):
        keys = {}
        for idx, bwKey, _, handler in self.__getKeysGenerator():
            if handler:
                keys[bwKey] = handler

        self.__keys.clear()
        self.__keys = keys
        ctrl = g_sessionProvider.getVehicleStateCtrl()
        ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
Beispiel #8
0
 def start(self):
     if self._populate(self.__ui.getMember(DAMAGE_PANEL_PATH)):
         self.__tankIndicator = _TankIndicatorCtrl(self.__ui)
         ctrl = g_sessionProvider.getVehicleStateCtrl()
         ctrl.onVehicleControlling += self.__onVehicleControlling
         ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
         vehicle = ctrl.getControllingVehicle()
         if vehicle:
             self._updatePlayerInfo(vehicle.id)
             self.__onVehicleControlling(vehicle)
    def onPopUpClosed(self):
        keys = {}
        for idx, bwKey, _, handler in self.__getKeysGenerator():
            if handler:
                keys[bwKey] = handler

        self.__keys.clear()
        self.__keys = keys
        ctrl = g_sessionProvider.getVehicleStateCtrl()
        ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
Beispiel #10
0
 def destroy(self):
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleControlling -= self.__onVehicleControlling
     ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     if self._flashObject:
         self.as_destroyS()
     self._dispose()
     if self.__tankIndicator:
         self.__tankIndicator.clear(self.__ui)
         self.__tankIndicator = None
     self.__ui = None
     self.__isShow = False
Beispiel #11
0
 def _onUnloaded(self):
     self.__debugCtrl.stop()
     self.__debugCtrl.clearViewComponents()
     self.__timerPresenter.stop()
     self.__fragsPresenter.stop()
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     if ctrl is not None:
         ctrl.onPostMortemSwitched -= self.__onPostMortemSwitched
     CommandMapping.g_instance.onMappingChanged -= self.setCommands
     self._colorManager.dispossessUI()
     self.__messenger.close(MESSENGER_SCOPE.UNKNOWN)
     self.__messenger.dispossessUI()
     return
Beispiel #12
0
 def start(self):
     """
     Routine invokes when battle interface is created - player joined to arena.
     """
     self.__isHasGasAttack = hasGasAttack()
     if self._populate(self.__ui.getMember(DAMAGE_PANEL_PATH)):
         self.__tankIndicator = _TankIndicatorCtrl(self.__ui)
         ctrl = g_sessionProvider.getVehicleStateCtrl()
         ctrl.onVehicleControlling += self.__onVehicleControlling
         ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
         g_sessionProvider.addArenaCtrl(self)
         vehicle = ctrl.getControllingVehicle()
         if vehicle:
             self.__vehicleID = vehicle.id
             self._updatePlayerInfo(vehicle.id)
             self.__onVehicleControlling(vehicle)
Beispiel #13
0
 def start(self):
     """
     Routine invokes when battle interface is created - player joined to arena.
     """
     self.__isHasGasAttack = hasGasAttack()
     if self._populate(self.__ui.getMember(DAMAGE_PANEL_PATH)):
         self.__tankIndicator = _TankIndicatorCtrl(self.__ui)
         ctrl = g_sessionProvider.getVehicleStateCtrl()
         ctrl.onVehicleControlling += self.__onVehicleControlling
         ctrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
         g_sessionProvider.addArenaCtrl(self)
         vehicle = ctrl.getControllingVehicle()
         if vehicle:
             self.__vehicleID = vehicle.id
             self._updatePlayerInfo(vehicle.id)
             self.__onVehicleControlling(vehicle)
 def __addListeners(self):
     vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
     vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
     vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     ammoCtrl.onShellsAdded += self.__onShellsAdded
     ammoCtrl.onShellsUpdated += self.__onShellsUpdated
     ammoCtrl.onNextShellChanged += self.__onNextShellChanged
     ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged
     ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet
     ammoCtrl.onGunReloadTimeSetInPercent += self.__onGunReloadTimeSetInPercent
     eqCtrl = g_sessionProvider.getEquipmentsCtrl()
     eqCtrl.onEquipmentAdded += self.__onEquipmentAdded
     eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated
     optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
     optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded
     optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated
Beispiel #15
0
 def destroy(self):
     """
     Routine invokes when player leave arena.
     """
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleControlling -= self.__onVehicleControlling
     ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     g_sessionProvider.removeArenaCtrl(self)
     if self._flashObject:
         self.as_destroyS()
     self._dispose()
     if self.__tankIndicator:
         self.__tankIndicator.clear(self.__ui)
         self.__tankIndicator = None
     self.__ui = None
     self.__isShow = False
     self.__isHasGasAttack = False
     return
Beispiel #16
0
 def _onLoaded(self):
     self.__debugCtrl.setViewComponents(weakref.proxy(self))
     self.__debugCtrl.start()
     self._colorManager.populateUI(weakref.proxy(self._flashObject))
     self.__timerPresenter.start()
     self.__fragsPresenter.start()
     vehStateCtrl = g_sessionProvider.getVehicleStateCtrl()
     self.__isPostmortem = vehStateCtrl and vehStateCtrl.isInPostmortem
     if self.__isPostmortem:
         self.__onPostMortemSwitched()
     if vehStateCtrl is not None:
         vehStateCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
     CommandMapping.g_instance.onMappingChanged += self.setCommands
     self.setCommands()
     self.__messenger.show()
     self.__messenger.enableRecord(False)
     self.__messenger.populateUI(weakref.proxy(self._flashObject))
     return
 def __addListeners(self):
     vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
     vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
     vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     ammoCtrl.onShellsAdded += self.__onShellsAdded
     ammoCtrl.onShellsUpdated += self.__onShellsUpdated
     ammoCtrl.onNextShellChanged += self.__onNextShellChanged
     ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged
     ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet
     ammoCtrl.onGunReloadTimeSetInPercent += self.__onGunReloadTimeSetInPercent
     eqCtrl = g_sessionProvider.getEquipmentsCtrl()
     eqCtrl.onEquipmentAdded += self.__onEquipmentAdded
     eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated
     optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
     optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded
     optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated
     g_eventBus.addListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE)
Beispiel #18
0
 def destroy(self):
     """
     Routine invokes when player leave arena.
     """
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleControlling -= self.__onVehicleControlling
     ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     g_sessionProvider.removeArenaCtrl(self)
     if self._flashObject:
         self.as_destroyS()
     self._dispose()
     if self.__tankIndicator:
         self.__tankIndicator.clear(self.__ui)
         self.__tankIndicator = None
     self.__ui = None
     self.__isShow = False
     self.__isHasGasAttack = False
     return
 def __addListeners(self):
     vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
     vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
     vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     ammoCtrl.onShellsAdded += self.__onShellsAdded
     ammoCtrl.onShellsUpdated += self.__onShellsUpdated
     ammoCtrl.onNextShellChanged += self.__onNextShellChanged
     ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged
     ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet
     ammoCtrl.onGunReloadTimeSetInPercent += self.__onGunReloadTimeSetInPercent
     eqCtrl = g_sessionProvider.getEquipmentsCtrl()
     eqCtrl.onEquipmentAdded += self.__onEquipmentAdded
     eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated
     optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
     optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded
     optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated
     g_eventBus.addListener(GameEvent.CHOICE_CONSUMABLE,
                            self.__handleConsumableChoice,
                            scope=EVENT_BUS_SCOPE.BATTLE)
Beispiel #20
0
 def beforeDelete(self):
     LOG_DEBUG('[Battle] beforeDelete')
     removeListener = g_eventBus.removeListener
     removeListener(events.GameEvent.HELP, self.toggleHelpWindow, scope=_SCOPE)
     removeListener(events.GameEvent.GUI_VISIBILITY, self.showAll, scope=_SCOPE)
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     ctrl.onPostMortemSwitched -= self.__onPostMortemSwitched
     player = BigWorld.player()
     if player and player.inputHandler:
         player.inputHandler.onPostmortemVehicleChanged -= self.onPostmortemVehicleChanged
         player.inputHandler.onCameraChanged -= self.onCameraChanged
     if self.colorManager:
         self.colorManager.dispossessUI()
     voice = VoiceChatInterface.g_instance
     if voice:
         voice.dispossessUI(self.proxy)
         voice.onPlayerSpeaking -= self.setPlayerSpeaking
         voice.onVoiceChatInitFailed -= self.onVoiceChatInitFailed
     if self.__plugins is not None:
         self.__plugins.stop()
         self.__plugins.fini()
         self.__plugins = None
     if self.movingText is not None:
         self.movingText.dispossessUI()
         self.movingText = None
     if self.__timerSound is not None:
         self.__timerSound.stop()
         self.__timerSound = None
     if self.__soundManager is not None:
         self.__soundManager.dispossessUI()
         self.__soundManager = None
     if self.colorManager is not None:
         self.colorManager.dispossessUI()
         self.colorManager = None
     if self.component:
         g_repeatKeyHandlers.discard(self.component.handleKeyEvent)
     g_settingsCore.onSettingsChanged -= self.__accs_onSettingsChanged
     g_settingsCore.interfaceScale.onScaleChanged -= self.__onRecreateDevice
     self.__timersBar.destroy()
     self.__teamBasesPanel.destroy()
     self.__debugPanel.destroy()
     self.__consumablesPanel.destroy()
     self.__damagePanel.destroy()
     self.__markersManager.destroy()
     self.__ingameHelp.destroy()
     self.__vErrorsPanel.destroy()
     self.__vMsgsPanel.destroy()
     self.__pMsgsPanel.destroy()
     self.__radialMenu.destroy()
     self.__minimap.destroy()
     self.__ribbonsPanel.destroy()
     self.__fragCorrelation.destroy()
     self.__statsForm.destroy()
     g_sessionProvider.clearBattleUI()
     if self.__arenaCtrl is not None:
         g_sessionProvider.removeArenaCtrl(self.__arenaCtrl)
         self.__arenaCtrl.clear()
         self.__arenaCtrl = None
     self.__ppSwitcher.destroy()
     self.__leftPlayersPanel.dispossessUI()
     self.__rightPlayersPanel.dispossessUI()
     MessengerEntry.g_instance.gui.invoke('dispossessUI')
     self.__arena = None
     g_guiResetters.discard(self.__onRecreateDevice)
     self.__settingsInterface.dispossessUI()
     self.__settingsInterface = None
     VoiceChatInterface.g_instance.onVoiceChatInitFailed -= self.onVoiceChatInitFailed
     if self.__dynSquadListener:
         self.__dynSquadListener.destroy()
         self.__dynSquadListener = None
     BattleWindow.beforeDelete(self)
     event = events.AppLifeCycleEvent
     g_eventBus.handleEvent(event(self.__ns, event.DESTROYED))
     return
Beispiel #21
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))
Beispiel #22
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())
     if self.__arena.period == constants.ARENA_PERIOD.BATTLE:
         self.call('players_panel.setState', [g_settingsCore.getSetting('ppState')])
     else:
         self.call('players_panel.setState', ['large'])
     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))
Beispiel #23
0
 def beforeDelete(self):
     LOG_DEBUG('[Battle] beforeDelete')
     removeListener = g_eventBus.removeListener
     removeListener(events.GameEvent.HELP, self.toggleHelpWindow, scope=_SCOPE)
     removeListener(events.GameEvent.GUI_VISIBILITY, self.showAll, scope=_SCOPE)
     ctrl = g_sessionProvider.getVehicleStateCtrl()
     ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
     ctrl.onPostMortemSwitched -= self.__onPostMortemSwitched
     if self.colorManager:
         self.colorManager.dispossessUI()
     voice = VoiceChatInterface.g_instance
     if voice:
         voice.dispossessUI(self.proxy)
         voice.onPlayerSpeaking -= self.setPlayerSpeaking
         voice.onVoiceChatInitFailed -= self.onVoiceChatInitFailed
     if self.__plugins is not None:
         self.__plugins.stop()
         self.__plugins.fini()
         self.__plugins = None
     if self.movingText is not None:
         self.movingText.dispossessUI()
         self.movingText = None
     if self.__soundManager is not None:
         self.__soundManager.dispossessUI()
         self.__soundManager = None
     if self.colorManager is not None:
         self.colorManager.dispossessUI()
         self.colorManager = None
     if self.component:
         g_repeatKeyHandlers.discard(self.component.handleKeyEvent)
     g_settingsCore.onSettingsChanged -= self.__accs_onSettingsChanged
     g_settingsCore.interfaceScale.onScaleChanged -= self.__onRecreateDevice
     self.__timersBar.destroy()
     self.__teamBasesPanel.destroy()
     self.__debugPanel.destroy()
     self.__consumablesPanel.destroy()
     self.__damagePanel.destroy()
     self.__markersManager.destroy()
     self.__ingameHelp.destroy()
     self.__vErrorsPanel.destroy()
     self.__vMsgsPanel.destroy()
     self.__pMsgsPanel.destroy()
     self.__radialMenu.destroy()
     self.__minimap.destroy()
     self.__ribbonsPanel.destroy()
     self.__fragCorrelation.destroy()
     self.__statsForm.destroy()
     g_sessionProvider.clearBattleUI()
     if self.__arenaCtrl is not None:
         g_sessionProvider.removeArenaCtrl(self.__arenaCtrl)
         self.__arenaCtrl.clear()
         self.__arenaCtrl = None
     self.__ppSwitcher.destroy()
     self.__leftPlayersPanel.dispossessUI()
     self.__rightPlayersPanel.dispossessUI()
     MessengerEntry.g_instance.gui.invoke('dispossessUI')
     self.__arena = None
     g_guiResetters.discard(self.__onRecreateDevice)
     self.__settingsInterface.dispossessUI()
     self.__settingsInterface = None
     VoiceChatInterface.g_instance.onVoiceChatInitFailed -= self.onVoiceChatInitFailed
     if self.__dynSquadListener:
         self.__dynSquadListener.destroy()
         self.__dynSquadListener = None
     BattleWindow.beforeDelete(self)
     event = events.AppLifeCycleEvent
     g_eventBus.handleEvent(event(self.__ns, event.DESTROYED))