def _initialize(self, *args, **kwargs): super(LootBoxRewardView, self)._initialize() self.catchGiftEventHub() self.viewModel.onCloseBtnClick += self.__onWindowClose self.viewModel.onNextBtnClick += self.__onOpenNextBox self.viewModel.onVideoChangeClick += self.__onVideoSettingsChanged self.viewModel.onDestroyEvent += self.__onDestroy self.viewModel.showSpecialReward += self.__showSpecialReward self.viewModel.onBuyBoxBtnClick += self.__onBuyBoxBtnClick self.viewModel.onSpecialActionBtnClick += self.__onSpecialActionButtonClick self.viewModel.guaranteedReward.onInfoClick += self.__onGuaranteedRewardsInfo self.festivityController.onStateChanged += self.__onStateChange self.itemsCache.onSyncCompleted += self.__onCacheResync self.settingsCore.onSettingsChanged += self.__onSettingsChanged self.lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged if not self._isMemoryRiskySystem: g_eventBus.addListener(LootboxesEvent.ON_SHOW_SPECIAL_REWARDS_CLOSED, self.__onSpecialRewardsClosed, scope=EVENT_BUS_SCOPE.LOBBY) if self._isMemoryRiskySystem: g_eventBus.addListener(LootboxesEvent.ON_VIDEO_OFF_MOVIE_LOADED, self.__onVideoOffMovieLoaded, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(LootboxesEvent.ON_OPENING_START, self.__onOpeningStart, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(LootboxesEvent.NEED_SHOW_REWARDS, self.__needShowRewards, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.LootboxesEvent.ON_STATISTICS_RESET, self.__onStatisticsReset, scope=EVENT_BUS_SCOPE.LOBBY) self.__updateAvailability() self.__updateBoxInfo() self.__updateRewards() g_eventBus.handleEvent(events.LootboxesEvent(events.LootboxesEvent.ON_OPEN_LOOTBOX, ctx={'boxItem': self.__boxItem, 'specialRewardType': self.viewModel.getSpecialRewardType(), 'withReload': False, 'isForcedToEnd': self.__isBackward}), EVENT_BUS_SCOPE.LOBBY) with self.viewModel.transaction() as model: model.setIsForcedRendering(self.__isBackward) model.setIsVideoOff(self.isVideoOff) model.setIsMemoryRiskySystem(self._isMemoryRiskySystem) model.setRealm(CURRENT_REALM)
def _initialize(self, *args, **kwargs): super(LootBoxPremiumMultiOpenView, self)._initialize() self.__showHideCloseHandler.startListen(self.getParentWindow()) playSound(LootBoxViewEvents.PREMIUM_MULTI_ENTER) setOverlayHangarGeneral(True) if args and len(args) == 3: self.__boxItem, rewards, self.__needToOpen = args self.__currentRewardsPage = 1 self.viewModel.onOpenBox += self.__onOpenBox self.viewModel.openNextBoxes += self.__openNextBoxes self.viewModel.onClose += self.__onWindowClose self.viewModel.showSpecialReward += self.__showSpecialReward self.viewModel.onViewShowed += self.__onViewShowed self.viewModel.guaranteedReward.onInfoClick += self.__onGuaranteedRewardsInfo self.itemsCache.onSyncCompleted += self.__onCacheResync self._festivityController.onStateChanged += self.__onStateChange self.lobbyContext.getServerSettings( ).onServerSettingsChange += self.__onServerSettingChanged g_eventBus.addListener( LootboxesEvent.ON_SHOW_SPECIAL_REWARDS_CLOSED, self.__onSpecialRewardsClosed, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.LootboxesEvent.ON_STATISTICS_RESET, self.__onStatisticsReset, scope=EVENT_BUS_SCOPE.LOBBY) with self.viewModel.transaction() as model: model.setIsMemoryRiskySystem(self._isMemoryRiskySystem) self.__update() self.__updateBoxesAvailability() self.__appendRewards(rewards[0], forceClearPage=True)
def start(self): super(GlobalSettingsPlugin, self).start() if GUI_SETTINGS.minimapSize: g_eventBus.addListener(events.GameEvent.MINIMAP_CMD, self.__handleMinimapCmd, scope=EVENT_BUS_SCOPE.BATTLE) g_repeatKeyHandlers.add(self.__handleRepeatKeyEvent)
def onSlideOpened(self, switchType=None): g_eventBus.addListener(events.LootboxesEvent.ON_MAIN_VIEW_CLOSED, self.__onViewClosed, scope=EVENT_BUS_SCOPE.LOBBY) if switchType: self.__switchType = switchType self.startAction(LogActions.CLOSE)
def start(self): arenaDP = self.sessionProvider.getArenaDP() g_eventBus.addListener(GameEvent.SHOW_BTN_HINT, self.__handleShowBtnHint, scope=EVENT_BUS_SCOPE.GLOBAL) g_eventBus.addListener(GameEvent.FULL_STATS_QUEST_PROGRESS, self.__handlePressHintBtn, scope=EVENT_BUS_SCOPE.BATTLE) vInfo = arenaDP.getVehicleInfo() self.__isActive = vInfo.vehicleType.level >= 4 self.__hintsLeft = AccountSettings.getSettings(QUEST_PROGRESS_SHOWS_COUNT)
def __onBuyBPCallback(self, result): if not result: self.__battlePassController.onLevelUp += self.__onLevelUp else: g_eventBus.addListener(events.BattlePassEvent.AWARD_VIEW_CLOSE, self.__onAwardViewClose, EVENT_BUS_SCOPE.LOBBY)
def _addListeners(self): g_eventBus.addListener( events.ReferralProgramEvent.SHOW_REFERRAL_PROGRAM_WINDOW, self.__onReferralProgramButtonClicked, scope=EVENT_BUS_SCOPE.LOBBY) self.lobbyContext.getServerSettings( ).onServerSettingsChange += self.__onServerSettingsChange
def start(self, model): super(ProgressiveRewardListener, self).start(model) self.__isEnabled = self.__lobbyContext.getServerSettings().getProgressiveRewardConfig().isEnabled self.__lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingsChange g_eventBus.addListener(events.ProgressiveRewardEvent.WIDGET_WAS_SHOWN, self.__widgetWasShown) self.__update() return True
def _populate(self): super(CamoSelectorMainView, self)._populate() self.soundManager.playInstantSound(SOUNDS.ENTER) self.__viewLifecycleWatcher.start(self.app.containerManager, [_C11nWindowsLifecycleHandler()]) self._isDeferredRenderer = self.settingsCore.getSetting(GRAPHICS.RENDER_PIPELINE) == 0 g_clientUpdateManager.addMoneyCallback(self.__setBuyingPanelData) self.lobbyContext.addHeaderNavigationConfirmator(self.__confirmHeaderNavigation) self.lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged self.service.onCarouselFilter += self.__onCarouselFilter self.service.onRemoveItems += self.removeItems self.service.onOutfitChanged += self.__onOutfitChanged g_eventBus.addListener(CameraRelatedEvents.IDLE_CAMERA, self.__onNotifyHangarCameraIdleStateChanged) g_hangarSpace.onSpaceCreate += self.__onSpaceCreateHandler g_hangarSpace.onSpaceDestroy += self.__onSpaceDestroyHandler g_hangarSpace.onSpaceRefresh += self.__onSpaceRefreshHandler self.service.onRegionHighlighted += self.__onRegionHighlighted self.itemsCache.onSyncCompleted += self.__onCacheResync self.__carveUpOutfits() self._carouselDP = CustomizationCarouselDataProvider(g_currentVehicle, self._carouseItemWrapper, self) self._carouselDP.setFlashObject(self.as_getDataProviderS()) self._carouselDP.setEnvironment(self.app) self.__setHeaderInitData() self.__setFooterInitData() self.__setBuyingPanelData() self.__setSeasonData() self._vehicleCustomizationAnchorsUpdater = _VehicleCustomizationAnchorsUpdater(self.service) self._vehicleCustomizationAnchorsUpdater.startUpdater(self.settingsCore.interfaceScale.get()) self.refreshOutfit() self.settingsCore.interfaceScale.onScaleExactlyChanged += self.__onInterfaceScaleChanged self.settingsCore.onSettingsChanged += self.__onSettingsChanged self.__updateCameraParalaxFlag() self.service.startHighlighter(chooseMode(tabToItem(self._tabIndex), g_currentVehicle.item))
def start(self, loader): if not super(SfBattleDispatcher, self).start(loader): return False g_eventBus.addListener(TutorialEvent.STOP_TRAINING, self.__handleStopTraining, scope=EVENT_BUS_SCOPE.GLOBAL) return True
def _start(e=None): g_eventBus.removeListener(XVM_EVENT.XVM_SERVICES_INITIALIZED, _start) if not g_xvm.xvmServicesInitialized: g_eventBus.addListener(XVM_EVENT.XVM_SERVICES_INITIALIZED, _start) return if config.networkServicesSettings.xmqp or (isReplay() and XMQP_DEVELOPMENT): token = config.token.token if token: players = [] player = BigWorld.player() for (vehicleID, vData) in player.arena.vehicles.iteritems(): # ally team only if vData['team'] == player.team: players.append(vData['accountDBID']) if XMQP_DEVELOPMENT: accountDBID = utils.getAccountDBID() if accountDBID not in players: players.append(accountDBID) #players.append(42) #players.append(43) # start stop() global _xmqp_thread, _xmqp _xmqp = _XMQP(players) _xmqp_thread = threading.Thread(target=_xmqp.start, name='xmqp') _xmqp_thread.setDaemon(True) _xmqp_thread.start() debug('[XMQP] Thread started')
def injectNewFuncs(): #tab BattleArenaController._makeHash = Statistics.new_makeHash #player panels + powerbar _StatsForm.getFormattedStrings = Statistics.new__getFormattedStrings #marker MarkersManager.addVehicleMarker = Statistics.new_addVehicleMarker #chat _BattleMessageBuilder.setName= Statistics.new__setName CommonMessageBuilder.setName= Statistics.new__setNameCommon #battleloading BattleLoading._makeItem = Statistics.new_makeItem BattleLoading._setTipsInfo = Statistics.new_setTipsInfo g_appLoader.onGUISpaceChanged += Statistics.onGUISpaceChanged g_eventBus.addListener(events.AppLifeCycleEvent.DESTROYED, Statistics.stopBattle)#, scope=EVENT_BUS_SCOPE.BATTLE) #fixing panel actions BattleEntry._BattleEntry__onAddToIgnored = Statistics.new__onAddToIgnored BattleEntry._BattleEntry__onAddToFriends = Statistics.new__onAddToFriends
def _onEntityCheckoutEnqueued(self, cancelCallback): g_eventBus.addListener(BootcampEvent.QUEUE_DIALOG_CANCEL, self._onEntityCheckoutCanceled, EVENT_BUS_SCOPE.LOBBY) g_eventBus.handleEvent(BootcampEvent(BootcampEvent.QUEUE_DIALOG_SHOW), EVENT_BUS_SCOPE.LOBBY) self._entityEnqueueCancelCallback = cancelCallback
def __init__(self): self.controller = None self.config = Config() self.thread = None g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, self.setup_chat)
def __addListeners(self): vehicleCtrl = self.sessionProvider.shared.vehicleState if vehicleCtrl is not None: vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving vehicleCtrl.onVehicleStateUpdated += self.__onVehicleStateUpdated ammoCtrl = self.sessionProvider.shared.ammo if ammoCtrl is not None: self.__fillShells(ammoCtrl) ammoCtrl.onShellsAdded += self.__onShellsAdded ammoCtrl.onShellsUpdated += self.__onShellsUpdated ammoCtrl.onNextShellChanged += self.__onNextShellChanged ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet ammoCtrl.onGunSettingsSet += self.__onGunSettingsSet eqCtrl = self.sessionProvider.shared.equipments if eqCtrl is not None: self.__fillEquipments(eqCtrl) eqCtrl.onEquipmentAdded += self.__onEquipmentAdded eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated eqCtrl.onEquipmentCooldownInPercent += self.__onEquipmentCooldownInPercent eqCtrl.onEquipmentCooldownTime += self.__onEquipmentCooldownTime optDevicesCtrl = self.sessionProvider.shared.optionalDevices if optDevicesCtrl is not None: self.__fillOptionalDevices(optDevicesCtrl) optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated CommandMapping.g_instance.onMappingChanged += self.__onMappingChanged g_eventBus.addListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE) return
def _start(e=None): g_eventBus.removeListener(XVM_EVENT.XVM_SERVICES_INITIALIZED, _start) if not g_xvm.xvmServicesInitialized: g_eventBus.addListener(XVM_EVENT.XVM_SERVICES_INITIALIZED, _start) return if (config.networkServicesSettings.xmqp and not isReplay()) or XMQP_DEVELOPMENT: token = config.token.token if token: players = [] player = BigWorld.player() for (vehicleID, vData) in player.arena.vehicles.iteritems(): # ally team only if vData['team'] == player.team: players.append(vData['accountDBID']) if XMQP_DEVELOPMENT: accountDBID = utils.getAccountDBID() if accountDBID not in players: players.append(accountDBID) #players.append(42) #players.append(43) # start stop() global _xmqp_thread, _xmqp _xmqp = _XMQP(players) _xmqp_thread = threading.Thread(target=_xmqp.start, name='xmqp') _xmqp_thread.setDaemon(True) _xmqp_thread.start() debug('[XMQP] Thread started')
def _populate(self): g_eventBus.addListener(events.GameEvent.SHOW_CURSOR, self.__handleShowCursor, EVENT_BUS_SCOPE.GLOBAL) g_eventBus.addListener(events.GameEvent.HIDE_CURSOR, self.__handleHideCursor, EVENT_BUS_SCOPE.GLOBAL) g_eventBus.addListener(events.GameEvent.RADIAL_MENU_CMD, self.__toggleRadialMenu, scope=EVENT_BUS_SCOPE.BATTLE) g_eventBus.addListener(events.GameEvent.FULL_STATS, self.__toggleFullStats, scope=EVENT_BUS_SCOPE.BATTLE) g_eventBus.addListener(events.GameEvent.FULL_STATS_QUEST_PROGRESS, self.__toggleFullStatsQuestProgress, scope=EVENT_BUS_SCOPE.BATTLE) g_guiResetters.add(self.__onResizeStage) ctrl = self.sessionProvider.dynamic.maps if ctrl is not None and hasattr(ctrl, 'onVisibilityChanged'): ctrl.onVisibilityChanged += self.__onMapVisibilityChanged ctrl = self.sessionProvider.dynamic.respawn if ctrl is not None and hasattr(ctrl, 'onRespawnVisibilityChanged'): ctrl.onRespawnVisibilityChanged += self.__onRespawnVisibilityChanged spawnCtrl = self.sessionProvider.dynamic.spawn if spawnCtrl is not None: if hasattr(BattleRoyalePage, 'showSpawnPoints'): global hooked_showSpawnPoints if hooked_showSpawnPoints is None: hooked_showSpawnPoints = BattleRoyalePage.showSpawnPoints BattleRoyalePage.showSpawnPoints = newBattleRoyalePageShowSpawnPoints if hasattr(BattleRoyalePage, 'closeSpawnPoints'): global hooked_closeSpawnPoints if hooked_closeSpawnPoints is None: hooked_closeSpawnPoints = BattleRoyalePage.closeSpawnPoints BattleRoyalePage.closeSpawnPoints = newBattleRoyalePageCloseSpawnPoints
def _subscribe(self): g_clientUpdateManager.addCallbacks(dict(self._getCallbacks())) for eventBusArgs in self._getListeners(): g_eventBus.addListener(*eventBusArgs) for event, handler in self._getEvents(): event += handler
def init(self): self.ID = '%(mod_ID)s' self.version = '1.1.0 (%(file_compile_date)s)' # noinspection LongLine self.data = { 'enabled': True, 'removeNicknames': 0, 'iconFormat': "<img src='img://gui/maps/icons/vehicleTypes/%(colour)s/%(classTag)s.png' width='17' height='21' vspace='-5'/>"} self.i18n = { 'name': 'Ingame GUI text tweaks', 'UI_setting_removeNicknames_text': 'Remove nicknames', 'UI_setting_removeNicknames_tooltip': 'Nicknames in battle chat, fading messages and other places are cut off. Modes:\n' '<b>None</b>: nicknames are not cut off.\n' '<b>Smart</b>: nicknames for friends, squad mates and non-random allies are preserved.\n' '<b>All</b>: all nicknames are cut off.', 'UI_setting_removeNicknames_none': 'None', 'UI_setting_removeNicknames_smart': 'Smart', 'UI_setting_removeNicknames_all': 'All', 'UI_setting_iconFormat_text': 'Icon format', 'UI_setting_iconFormat_tooltip': 'Format of vehicle class icon that gets put before vehicle names.\n' '%(colour)s: "green" if vehicle is ally else "red".\n' '%(classTag)s: gets replaced by vehicle class tag. ' 'Variants: "lightTank", "mediumTank", "heavyTank", "SPG", "AT-SPG" (case insensitive).'} g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, self.onAppInitialized) super(ConfigInterface, self).init()
def __init__(self, spaceId, vEntity): ComponentSystem.__init__(self) self.__loadState = _LoadStateNotifier() self.__curBuildInd = 0 self.__vDesc = None self.__vState = None self.__fashions = VehiclePartsTuple(None, None, None, None) self.__repaintHandlers = [None, None, None, None] self.__camoHandlers = [None, None, None, None] self.__spaceId = spaceId self.__vEntity = weakref.proxy(vEntity) self.__onLoadedCallback = None self.__onLoadedAfterRefreshCallback = None self.__vehicleStickers = None self.__isVehicleDestroyed = False self.__outfit = None self.shadowManager = None cfg = hangarCFG() self.__currentEmblemsAlpha = cfg['emblems_alpha_undamaged'] self.__showMarksOnGun = self.settingsCore.getSetting('showMarksOnGun') self.settingsCore.onSettingsChanged += self.__onSettingsChanged self.itemsCache.onSyncCompleted += self.__onItemsCacheSyncCompleted g_eventBus.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.__handleEntityUpdated) return
def _onSpaceCreated(self): super(HangarCameraIdleController, self)._onSpaceCreated() g_eventBus.addListener( CameraRelatedEvents.FORCE_DISABLE_IDLE_PARALAX_MOVEMENT, self.__onCameraForceDisable, EVENT_BUS_SCOPE.LOBBY) self.__camPeriod = self.__getHangarCamPeriodSetting() self._setStartDelay(self.__camPeriod)
def prepareToOpenPreview(self): self.reset() self.wasOpenChoiceView = True g_eventBus.addListener( events.BattlePassEvent.ON_PREVIEW_PROGRESSION_STYLE_CLOSE, self.__onPreviewProgressionStyleClose, scope=EVENT_BUS_SCOPE.LOBBY)
def __addListeners(self): with self.viewModel.transaction() as model: model.btnInviteFriends.onClick += self._onInviteFriends model.btnSwitchReady.onClick += self._onSwitchReady model.btnFindPlayers.onClick += self._onFindPlayers model.header.btnMuteAll.onClick += self._onToggleMuteAll model.header.btnLeavePlatoon.onClick += self._onLeavePlatoon model.onClosed += self._onLeavePlatoon model.onMinimized += self.__onMinimized model.onFocusChange += self.__onFocusChange self.__platoonCtrl.onMembersUpdate += self._updateMembers g_messengerEvents.voip.onPlayerSpeaking += self.__onPlayerSpeaking g_messengerEvents.voip.onChannelEntered += self.__updateVoiceChatToggleState g_messengerEvents.voip.onChannelLeft += self.__updateVoiceChatToggleState g_messengerEvents.voip.onChannelAvailable += self.__updateVoiceChatToggleState g_messengerEvents.voip.onChannelLost += self.__updateVoiceChatToggleState g_currentVehicle.onChanged += self.__updateReadyButton usersEvents = g_messengerEvents.users usersEvents.onUsersListReceived += self.__onUsersReceived usersEvents.onUserActionReceived += self.__onUserActionReceived unitMgr = prb_getters.getClientUnitMgr() if unitMgr and unitMgr.unit: unitMgr.unit.onUnitEstimateInQueueChanged += self._updateMembers g_eventBus.addListener(events.CoolDownEvent.PREBATTLE, self.__handleSetPrebattleCoolDown, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__updateReadyButton, scope=EVENT_BUS_SCOPE.LOBBY) self.__lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingsChange self.__platoonCtrl.onAvailableTiersForSearchChanged += self.__onAvailableTiersForSearchChanged self.__platoonCtrl.onAutoSearchCooldownChanged += self._updateFindPlayersButton
def startControl(self): arena = avatar_getter.getArena() if arena: arena.onTeamHealthPercentUpdate += self.__onTeamHealthPercentUpdate g_eventBus.addListener(events.GameEvent.BATTLE_LOADING, self.__handleBattleLoading, EVENT_BUS_SCOPE.BATTLE)
def start(self): self.active(True) self.__ownUI = GUI.WGVehicleMarkersCanvasFlash(self.movie) self.__ownUI.wg_inputKeyMode = 2 self.__ownUI.scaleProperties = GUI_SETTINGS.markerScaleSettings self.__ownUI.alphaProperties = GUI_SETTINGS.markerBgSettings self.__ownUIProxy = weakref.ref(self.__ownUI) self.__ownUIProxy().markerSetScale(g_settingsCore.interfaceScale.get()) g_settingsCore.interfaceScale.onScaleChanged += self.updateMarkersScale self.__parentUI.component.addChild(self.__ownUI, 'vehicleMarkersManager') self.__markersCanvasUI = self.getMember('vehicleMarkersCanvas') self.__plugins.init() ctrl = g_sessionProvider.getFeedback() if ctrl is not None: ctrl.onVehicleMarkerAdded += self.__onVehicleMarkerAdded ctrl.onVehicleMarkerRemoved += self.__onVehicleMarkerRemoved ctrl.onVehicleFeedbackReceived += self.__onVehicleFeedbackReceived functional = g_sessionProvider.getDynSquadFunctional() if functional is not None: functional.onPlayerBecomeSquadman += self.__onPlayerBecomeSquadman self.__plugins.start() g_eventBus.addListener(GameEvent.SHOW_EXTENDED_INFO, self.__handleShowExtendedInfo, scope=_SCOPE) g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__handleGUIVisibility, scope=_SCOPE) return
def __init__(self, cmProxy, ctx=None): self.__denunciator = BattleDenunciator() g_eventBus.addListener(events.GameEvent.HIDE_CURSOR, self.__handleHideCursor, EVENT_BUS_SCOPE.GLOBAL) super(PlayerMenuHandler, self).__init__(cmProxy, ctx=ctx, handlers=_OPTIONS_HANDLERS)
def __init__(self, spaceId, vEntity): ScriptGameObject.__init__(self, vEntity.spaceID) self.__loadState = _LoadStateNotifier() self.__curBuildInd = 0 self.__vDesc = None self.__vState = None size = len(TankPartNames.ALL) self.__fashions = VehiclePartsTuple(*([None] * size)) self.__repaintHandlers = [None] * size self.__camoHandlers = [None] * size self.__projectionDecalsHandlers = [None] * size self.__projectionDecalsUpdater = None self.__spaceId = spaceId self.__vEntity = weakref.proxy(vEntity) self.__onLoadedCallback = None self.__onLoadedAfterRefreshCallback = None self.__vehicleStickers = None self.__isVehicleDestroyed = False self.__outfit = None self.__staticTurretYaw = 0.0 self.__staticGunPitch = 0.0 self.__anchorsHelpers = None self.__anchorsParams = None self.__attachments = [] self.__modelAnimators = [] self.shadowManager = None cfg = hangarCFG() self.__currentEmblemsAlpha = cfg['emblems_alpha_undamaged'] self.__showMarksOnGun = self.settingsCore.getSetting('showMarksOnGun') self.settingsCore.onSettingsChanged += self.__onSettingsChanged self.itemsCache.onSyncCompleted += self.__onItemsCacheSyncCompleted g_eventBus.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.__handleEntityUpdated) g_currentVehicle.onChanged += self.__onVehicleChanged return
def startControl(self): g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__handleGUIVisibility, scope=EVENT_BUS_SCOPE.BATTLE) self.__damageIndicatorPreset = self.settingsCore.getSetting( DAMAGE_INDICATOR.PRESETS) self.settingsCore.onSettingsChanged += self.__onSettingsChanged
def _populate(self): super(BattleRibbonsPanel, self)._populate() self.__enabled = bool( g_settingsCore.getSetting( BATTLE_EVENTS.SHOW_IN_BATTLE)) and self.__arenaDP is not None self.__isWithRibbonName = bool( g_settingsCore.getSetting(BATTLE_EVENTS.EVENT_NAME)) self.__isWithVehName = bool( g_settingsCore.getSetting(BATTLE_EVENTS.VEHICLE_INFO)) self.__isExtendedAnim = g_settingsCore.getSetting( GRAPHICS.RENDER_PIPELINE) == _EXTENDED_RENDER_PIPELINE for settingName in _BATTLE_EVENTS_SETTINGS_TO_BATTLE_EFFICIENCY_TYPES: key = _BATTLE_EVENTS_SETTINGS_TO_BATTLE_EFFICIENCY_TYPES[ settingName] self.__userPreferences[key] = bool( g_settingsCore.getSetting(settingName)) self.__setupView() g_settingsCore.onSettingsChanged += self.__onSettingsChanged g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__onGUIVisibilityChanged, scope=EVENT_BUS_SCOPE.BATTLE) if self.__enabled: self.__ribbonsAggregator.start() return
def changeState(self, state): stateID = state.getStateID() if not self.isStarted(): LOG_WARNING('Fort provider is not started') return if self.__state and stateID == self.__state.getStateID(): LOG_DEBUG('Fort state is already set. It is ignored', state) return self.__state = state LOG_DEBUG('Fort state has been changed', state) controller = controls.createByState( state, self.__controller.getPermissions().canCreate(), self.__controller.__class__) if controller: controller.init(self.__clan, self.__listeners, self.__controller) self.__controller.fini(self.__state.getStateID() not in CLIENT_FORT_STATE.NOT_AVAILABLE_FORT) self.__controller = controller LOG_DEBUG('Fort controller has been changed', controller) self.__listeners.notify('onClientStateChanged', state) self.__resolveSubscription() g_eventBus.removeListener(events.FortEvent.SHOW_DISABLED_POPUP, self.__showPopupDlgIfDisabled, EVENT_BUS_SCOPE.FORT) if stateID not in CLIENT_FORT_STATE.NO_NEED_DISABLED_DLG: g_eventBus.addListener(events.FortEvent.SHOW_DISABLED_POPUP, self.__showPopupDlgIfDisabled, EVENT_BUS_SCOPE.FORT)
def __addListeners(self): vehicleCtrl = g_sessionProvider.shared.vehicleState if vehicleCtrl is not None: vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving ammoCtrl = g_sessionProvider.shared.ammo if ammoCtrl is not None: self.__fillShells(ammoCtrl) ammoCtrl.onShellsAdded += self.__onShellsAdded ammoCtrl.onShellsUpdated += self.__onShellsUpdated ammoCtrl.onNextShellChanged += self.__onNextShellChanged ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet eqCtrl = g_sessionProvider.shared.equipments if eqCtrl is not None: self.__fillEquipments(eqCtrl) eqCtrl.onEquipmentAdded += self.__onEquipmentAdded eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated eqCtrl.onEquipmentCooldownInPercent += self.__onEquipmentCooldownInPercent optDevicesCtrl = g_sessionProvider.shared.optionalDevices if optDevicesCtrl is not None: self.__fillOptionalDevices(optDevicesCtrl) optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated CommandMapping.g_instance.onMappingChanged += self.__onMappingChanged g_eventBus.addListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE) return
def _populate(self): self.addListener(CameraRelatedEvents.VEHICLE_LOADING, self.__onVehicleLoading, EVENT_BUS_SCOPE.DEFAULT) self.setBottomPanel() if g_currentPreviewVehicle.intCD == self._vehicleCD: self.__fullUpdate() if self.__hangarVehicleCD and self.__isHeroTank and self.__vehAppearanceChanged: g_currentPreviewVehicle.resetAppearance() g_currentPreviewVehicle.selectVehicle(self.__hangarVehicleCD, None) g_currentPreviewVehicle.resetAppearance(self.__previewAppearance) g_currentPreviewVehicle.selectVehicle(self._vehicleCD, self.__vehicleStrCD) super(VehiclePreview, self)._populate() g_currentPreviewVehicle.onChanged += self.__onVehicleChanged g_currentPreviewVehicle.onVehicleInventoryChanged += self.__onInventoryChanged self.__comparisonBasket.onChange += self.__onCompareBasketChanged self.__comparisonBasket.onSwitchChange += self.__updateHeaderData self.__hangarSpace.onSpaceCreate += self.__onHangarCreateOrRefresh self.__hangarSpace.setVehicleSelectable(True) if not g_currentPreviewVehicle.isPresent(): event_dispatcher.showHangar() if not self._heroInteractive: self.__heroTanksControl.setInteractive(False) self.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.handleSelectedEntityUpdated) specialData = getHeroTankPreviewParams() if self.__isHeroTank else None if specialData is not None and specialData.enterEvent: SoundGroups.g_instance.playSound2D(specialData.enterEvent) g_eventBus.addListener(OFFER_CHANGED_EVENT, self.__onOfferChanged) _updateCollectorHintParameters() _updatePostProgressionParameters() return
def injectNewFuncs(): #tab BattleArenaController._makeHash = Statistics.new_makeHash #player panels + powerbar _StatsForm.getFormattedStrings = Statistics.new__getFormattedStrings #marker MarkersManager.addVehicleMarker = Statistics.new_addVehicleMarker #chat _BattleMessageBuilder.setName = Statistics.new__setName CommonMessageBuilder.setName = Statistics.new__setNameCommon #battleloading BattleLoading._makeItem = Statistics.new_makeItem BattleLoading._setTipsInfo = Statistics.new_setTipsInfo g_appLoader.onGUISpaceChanged += Statistics.onGUISpaceChanged g_eventBus.addListener( events.AppLifeCycleEvent.DESTROYED, Statistics.stopBattle) #, scope=EVENT_BUS_SCOPE.BATTLE) #fixing panel actions BattleEntry._BattleEntry__onAddToIgnored = Statistics.new__onAddToIgnored BattleEntry._BattleEntry__onAddToFriends = Statistics.new__onAddToFriends
def _populate(self): super(GlobalScopeController, self)._populate() g_eventBus.addListener( ComponentEvent.COMPONENT_REGISTERED, self.__componentRegisteringHandler, EVENT_BUS_SCOPE.GLOBAL ) g_eventBus.addListener( ComponentEvent.COMPONENT_UNREGISTERED, self.__componentUnRegisteringHandler, EVENT_BUS_SCOPE.GLOBAL )
def init(self, ctx = None): result = super(HistoricalQueueFunctional, self).init(ctx=ctx) g_eventDispatcher.loadHistoryBattles() g_eventsCache.onSyncCompleted += self.onEventsCacheResync g_eventBus.addListener(events.ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW) return result
def init(self, clientPrb = None, ctx = None): result = super(BattleSessionFunctional, self).init(clientPrb=clientPrb) g_eventDispatcher.loadHangar() g_eventDispatcher.loadBattleSessionWindow(self.getEntityType()) result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_WINDOW) result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_PAGE) g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) g_eventDispatcher.updateUI() return result
def __init__(self, eventsCache): self.__eventsCache = weakref.proxy(eventsCache) self.onCompanyStateChanged = Event() super(CompanyBattleController, self).__init__() g_eventBus.addListener(GUICommonEvent.LOBBY_VIEW_LOADED, self.__onLobbyInited) g_playerEvents.onAvatarBecomePlayer += self.__onAvatarBecomePlayer g_connectionManager.onDisconnected += self.__onDisconnected self.__isLobbyLoaded = False self.__delayedCompanyState = []
def populateUI(self, proxy): UIInterface.populateUI(self, proxy) self.GUICtrl = self.uiHolder.getMember('_level0.radialMenu') self.GUICtrl.script = self for state in self.ALL_SHORTCUTS: self.GUICtrl.setState(state) list = self.__getDataForFlash(state) self.GUICtrl.buildData(list) g_eventBus.addListener(GameEvent.RADIAL_MENU_CMD, self.__handleRadialMenuCmd, scope=EVENT_BUS_SCOPE.BATTLE)
def __init__(self): self.isLobby = False self.flash = None loginPopulate = LoginView._populate lobbyPopulate = LobbyView._populate LoginView._populate = lambda baseClass: self.__hooked_loginPopulate(baseClass, loginPopulate) LobbyView._populate = lambda baseClass: self.__hooked_lobbyPopulate(baseClass, lobbyPopulate) g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, self.__onAppInitialized)
def _Hangar_as_setCarouselS(base, self, linkage, alias): if not isInBootcamp(): if xfw_mods_info.loaded_swfs.get(XVM_LOBBY_UI_SWF, 0): if linkage == HANGAR_ALIASES.TANK_CAROUSEL_UI: linkage = 'com.xvm.lobby.ui.tankcarousel::UI_TankCarousel' else: log('WARNING: as_setCarouselS: ({}) {} is not loaded'.format(linkage, XVM_LOBBY_UI_SWF)) g_eventBus.removeListener(XFW_EVENT.SWF_LOADED, onSwfLoaded) g_eventBus.addListener(XFW_EVENT.SWF_LOADED, onSwfLoaded) base(self, linkage, alias)
def show(self): g_messengerEvents.channels.onMessageReceived += self.__me_onMessageReceived g_messengerEvents.channels.onCommandReceived += self.__me_onCommandReceived g_messengerEvents.users.onUserRosterChanged += self.__me_onUsersRosterChanged g_messengerEvents.onServerErrorReceived += self.__me_onServerErrorReceived g_settings.onUserPreferencesUpdated += self.__ms_onUserPreferencesUpdated g_settings.onColorsSchemesUpdated += self.__ms_onColorsSchemesUpdated self.__initialized = 0 self.__focused = False g_eventBus.addListener(MessengerEvent.BATTLE_CHANNEL_CTRL_INITED, self.__handleChannelControllerInited, scope=EVENT_BUS_SCOPE.BATTLE) self.__channelsCtrl = channels.BattleControllers() self.__channelsCtrl.init()
def _addGameListeners(self): super(VehicleMessages, self)._addGameListeners() g_eventBus.addListener(GameEvent.SCREEN_SHOT_MADE, self.__handleScreenShotMade) for message in g_critMemHandler.messages: self.__handleMemoryCriticalMessage(message) g_critMemHandler.onMemCrit += self.__handleMemoryCriticalMessage ctrl = g_sessionProvider.getBattleMessagesCtrl() if ctrl: ctrl.onShowVehicleMessageByCode += self.__onShowVehicleMessageByCode ctrl.onShowVehicleMessageByKey += self.__onShowVehicleMessageByKey ctrl.onUIPopulated()
def init(self, clientPrb = None, ctx = None): super(SquadFunctional, self).init(clientPrb=clientPrb) isInvitesOpen = False if ctx is not None: isInvitesOpen = ctx.getRequestType() is REQUEST_TYPE.CREATE if self.getPlayerInfo().isReady() and self.getTeamState(team=1).isInQueue(): events_dispatcher.loadBattleQueue() else: events_dispatcher.loadHangar() events_dispatcher.loadSquad(isInvitesOpen=isInvitesOpen) g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) return
def init(self, clientPrb = None, ctx = None): result = super(CompanyFunctional, self).init(clientPrb=clientPrb) playerInfo = self.getPlayerInfo() if self.getTeamState(team=1).isInQueue() and playerInfo.isReady() and playerInfo.roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1: g_eventDispatcher.loadBattleQueue() else: g_eventDispatcher.loadHangar() g_eventDispatcher.loadCompany() result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW) result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE) g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) g_eventDispatcher.updateUI() return result
def run(self): self.isRunning = True if not self.isSubscribed: self.isSubscribed = True self.startGlobalListening() g_eventBus.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY) g_currentVehicle.onChanged += self.__onVehicleChanged falloutCtrl = getFalloutCtrl() falloutCtrl.onVehiclesChanged += self.__updateFalloutSettings falloutCtrl.onSettingsChanged += self.__updateFalloutSettings g_eventsCache.onSyncCompleted += self.__onEventsCacheResync game_control.g_instance.igr.onIgrTypeChanged -= self.__onIGRChanged self.toggle(isOn=self.isOn())
def start(self): super(ArenaVehiclesPlugin, self).start() vInfo = self._arenaDP.getVehicleInfo() self.__playerVehicleID = self._arenaDP.getPlayerVehicleID() self.__isObserver = vInfo.isObserver() g_eventBus.addListener(events.GameEvent.SHOW_EXTENDED_INFO, self.__handleShowExtendedInfo, scope=EVENT_BUS_SCOPE.BATTLE) ctrl = g_sessionProvider.shared.feedback if ctrl is not None: ctrl.onMinimapVehicleAdded += self.__onMinimapVehicleAdded ctrl.onMinimapVehicleRemoved += self.__onMinimapVehicleRemoved ctrl.onMinimapFeedbackReceived += self.__onMinimapFeedbackReceived g_sessionProvider.addArenaCtrl(self) return
def init(self, clientPrb = None, ctx = None): super(CompanyFunctional, self).init(clientPrb=clientPrb) isInvitesOpen = False if ctx is not None: isInvitesOpen = ctx.getRequestType() is REQUEST_TYPE.CREATE playerInfo = self.getPlayerInfo() if self.getTeamState(team=1).isInQueue() and playerInfo.isReady() and playerInfo.roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1: events_dispatcher.loadBattleQueue() else: events_dispatcher.loadHangar() events_dispatcher.loadCompany(isInvitesOpen=isInvitesOpen) g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) return
def show(self): g_messengerEvents.channels.onMessageReceived += self.__me_onMessageReceived g_messengerEvents.channels.onCommandReceived += self.__me_onCommandReceived g_messengerEvents.users.onUserActionReceived += self.__me_onUserActionReceived g_messengerEvents.onErrorReceived += self.__me_onErrorReceived g_settings.onUserPreferencesUpdated += self.__ms_onUserPreferencesUpdated g_settings.onColorsSchemesUpdated += self.__ms_onColorsSchemesUpdated self.__initialized = 0 self.__focused = False g_eventBus.addListener(MessengerEvent.BATTLE_CHANNEL_CTRL_INITED, self.__handleChannelControllerInited, scope=EVENT_BUS_SCOPE.BATTLE) self.__channelsCtrl = channels.BattleControllers() self.__channelsCtrl.init() self.__dynSquadMsgController = DynSquadMessagesController(self.__onDynSquadMsgReceivedCallback) g_sessionProvider.addArenaCtrl(self.__dynSquadMsgController)
def populateUI(self, proxy): UIInterface.populateUI(self, proxy) self.GUICtrl = self.uiHolder.getMember('_level0.radialMenu') self.GUICtrl.script = self for state in self.ALL_SHORTCUTS: self.GUICtrl.setState(state) list = self.__getDataForFlash(state) self.GUICtrl.buildData(list) g_eventBus.addListener(GameEvent.RADIAL_MENU_CMD, self.__handleRadialMenuCmd, scope=EVENT_BUS_SCOPE.BATTLE) ctrl = g_sessionProvider.dynamic.respawn if ctrl is not None: ctrl.onRespawnVisibilityChanged += self.__onRespawnVisibilityChanged return
def _populate(self): super(BattleRibbonsPanel, self)._populate() self.__enabled = bool(g_settingsCore.getSetting(BATTLE_EVENTS.SHOW_IN_BATTLE)) and self.__arenaDP is not None self.__isWithRibbonName = bool(g_settingsCore.getSetting(BATTLE_EVENTS.EVENT_NAME)) self.__isWithVehName = bool(g_settingsCore.getSetting(BATTLE_EVENTS.VEHICLE_INFO)) self.__isExtendedAnim = g_settingsCore.getSetting(GRAPHICS.RENDER_PIPELINE) == _EXTENDED_RENDER_PIPELINE for settingName in _BATTLE_EVENTS_SETTINGS_TO_BATTLE_EFFICIENCY_TYPES: key = _BATTLE_EVENTS_SETTINGS_TO_BATTLE_EFFICIENCY_TYPES[settingName] self.__userPreferences[key] = bool(g_settingsCore.getSetting(settingName)) self.__setupView() g_settingsCore.onSettingsChanged += self.__onSettingsChanged g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__onGUIVisibilityChanged, scope=EVENT_BUS_SCOPE.BATTLE) if self.__enabled: self.__ribbonsAggregator.start() return
def init(self, browserID): self.__browserID = browserID self.__browser = game_control.getBrowserCtrl().getBrowser(self.__browserID) if not self.__browser is not None: raise AssertionError('Cannot find browser') self.__browser.hasBrowser or g_eventBus.addListener(BrowserEvent.BROWSER_CREATED, self.__handleBrowserCreated) else: self.__prepareBrowser() 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)
def init(self, clientPrb = None, ctx = None): result = super(EventSquadFunctional, self).init(clientPrb=clientPrb) (isCreationCtx, accountsToInvite,) = (False, []) if ctx is not None: isCreationCtx = ctx.getRequestType() is REQUEST_TYPE.CREATE if isCreationCtx: accountsToInvite = ctx.getAccountsToInvite() if self.getPlayerInfo().isReady() and self.getTeamState(team=1).isInQueue(): g_eventDispatcher.loadBattleQueue() else: g_eventDispatcher.loadHangar() g_eventDispatcher.loadEventSquad(isInvitesOpen=isCreationCtx and not accountsToInvite, isReady=self.__isTeamRead()) g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY) result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW) result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE) g_eventDispatcher.updateUI() if accountsToInvite: self.request(SendInvitesCtx(accountsToInvite, '')) return result
def start(self): self.active(True) self.__ownUI = GUI.WGVehicleMarkersCanvasFlash(self.movie) self.__ownUI.wg_inputKeyMode = 2 self.__ownUI.scaleProperties = GUI_SETTINGS.markerScaleSettings self.__ownUI.alphaProperties = GUI_SETTINGS.markerBgSettings self.__ownUIProxy = weakref.ref(self.__ownUI) self.__ownUIProxy().markerSetScale(g_settingsCore.interfaceScale.get()) g_settingsCore.interfaceScale.onScaleChanged += self.updateMarkersScale self.__parentUI.component.addChild(self.__ownUI, 'vehicleMarkersManager') self.__markersCanvasUI = self.getMember('vehicleMarkersCanvas') self.__plugins.init() ctrl = g_sessionProvider.getFeedback() if ctrl: ctrl.onVehicleMarkerAdded += self.__onVehicleMarkerAdded ctrl.onVehicleMarkerRemoved += self.__onVehicleMarkerRemoved ctrl.onVehicleFeedbackReceived += self.__onVehicleFeedbackReceived self.__plugins.start() g_eventBus.addListener(GameEvent.SHOW_EXTENDED_INFO, self.__handleShowExtendedInfo, scope=_SCOPE) g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__handleGUIVisibility, scope=_SCOPE)
def changeState(self, state): stateID = state.getStateID() if not self.isStarted(): LOG_WARNING('Fort provider is not started') return if self.__state and stateID == self.__state.getStateID(): LOG_DEBUG('Fort state is already set. It is ignored', state) return self.__state = state LOG_DEBUG('Fort state has been changed', state) controller = controls.createByState(state, self.__controller.getPermissions().canCreate(), self.__controller.__class__) if controller: controller.init(self.__clan, self.__listeners, self.__controller) self.__controller.fini(self.__state.getStateID() not in CLIENT_FORT_STATE.NOT_AVAILABLE_FORT) self.__controller = controller LOG_DEBUG('Fort controller has been changed', controller) self.__listeners.notify('onClientStateChanged', state) self.__resolveSubscription() g_eventBus.removeListener(events.FortEvent.SHOW_DISABLED_POPUP, self.__showPopupDlgIfDisabled, EVENT_BUS_SCOPE.FORT) if stateID not in CLIENT_FORT_STATE.NO_NEED_DISABLED_DLG: g_eventBus.addListener(events.FortEvent.SHOW_DISABLED_POPUP, self.__showPopupDlgIfDisabled, EVENT_BUS_SCOPE.FORT)
def start(): debug('start') import appstart from gui.shared import g_eventBus g_eventBus.addListener(events.GUICommonEvent.APP_STARTED, appstart.AppStarted) g_eventBus.addListener(events.ShowViewEvent.SHOW_LOBBY, g_xvm.onShowLobby) g_eventBus.addListener(events.ShowViewEvent.SHOW_LOGIN, g_xvm.onShowLogin) g_websock.start()
def start(): debug('start') g_appLoader.onGUISpaceChanged += g_xvm.onGUISpaceChanged g_eventBus.addListener(XFWCOMMAND.XFW_CMD, g_xvm.onXfwCommand) g_eventBus.addListener(XVM_EVENT.RELOAD_CONFIG, config.load) g_eventBus.addListener(XVM_EVENT.CONFIG_LOADED, g_xvm.onConfigLoaded) g_eventBus.addListener(XVM_EVENT.SYSTEM_MESSAGE, g_xvm.onSystemMessage) g_websock.start() g_websock.on_message += g_xvm.on_websock_message g_websock.on_error += g_xvm.on_websock_error # reload config g_eventBus.handleEvent(events.HasCtxEvent(XVM_EVENT.RELOAD_CONFIG, {'filename':XVM.CONFIG_FILE}))
def start(): g_eventBus.addListener(XFW_COMMAND.XFW_CMD, g_battle.onXfwCommand) g_eventBus.addListener(XFW_EVENT.APP_INITIALIZED, g_battle.onAppInitialized) g_eventBus.addListener(XFW_EVENT.APP_DESTROYED, g_battle.onAppDestroyed)
import xmqp_events NOT_SUPPORT_BATTLE_TYPE = [constants.ARENA_GUI_TYPE.EPIC_BATTLE, constants.ARENA_GUI_TYPE.EVENT_BATTLES] ##################################################################### # initialization/finalization def start(): g_eventBus.addListener(XFW_COMMAND.XFW_CMD, g_battle.onXfwCommand) g_eventBus.addListener(XFW_EVENT.APP_INITIALIZED, g_battle.onAppInitialized) g_eventBus.addListener(XFW_EVENT.APP_DESTROYED, g_battle.onAppDestroyed) BigWorld.callback(0, start) g_eventBus.addListener(XVM_BATTLE_EVENT.XMQP_CONNECTED, xmqp_events.onXmqpConnected) g_eventBus.addListener(XVM_BATTLE_EVENT.XMQP_MESSAGE, xmqp_events.onXmqpMessage) @registerEvent(game, 'fini') def fini(): g_eventBus.removeListener(XFW_COMMAND.XFW_CMD, g_battle.onXfwCommand) g_eventBus.removeListener(XFW_EVENT.APP_INITIALIZED, g_battle.onAppInitialized) g_eventBus.removeListener(XFW_EVENT.APP_DESTROYED, g_battle.onAppDestroyed) g_eventBus.removeListener(XVM_BATTLE_EVENT.XMQP_CONNECTED, xmqp_events.onXmqpConnected) g_eventBus.removeListener(XVM_BATTLE_EVENT.XMQP_MESSAGE, xmqp_events.onXmqpMessage) ##################################################################### # handlers # PRE-BATTLE
def __init__(self): g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, self.__openDescriptionInBrowser)