def _start(self, isColored, width, height): LOG_DEBUG('Starting monitor', isColored, width, height) self.__isColored = isColored self.__width = width self.__height = height self.__navigator.start(weakref.proxy(self)) g_keyEventHandlers.add(self.__handleKeyEvent)
def create(self, isPremium, onSpaceLoadedCallback = None): global _EVENT_HANGAR_PATHS global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = self.getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath)) if game_control.g_instance.igr.getRoomType() == constants.IGR_TYPE.PREMIUM: if _CFG.get(self.__igrHangarPathKey) is not None: spacePath = _CFG[self.__igrHangarPathKey] if _EVENT_HANGAR_PATHS.has_key(isPremium): spacePath = _EVENT_HANGAR_PATHS[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if _HANGAR_CFGS.has_key(spacePathLC): self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity('HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId, self) self.__yawCameraFilter = HangarCameraYawFilter(math.radians(_CFG['cam_yaw_constr'][0]), math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens']) self.__setupCamera() distConstrs = _CFG['cam_dist_constr'] previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs) if distConstrs is not None: if previewConstr is not None: self.__camDistConstr = (distConstrs, previewConstr) else: self.__camDistConstr = (distConstrs, distConstrs) else: self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0)) self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) self.__destroyFunc = None MapActivities.g_mapActivities.generateOfflineActivities(spacePath) g_keyEventHandlers.add(self.handleKeyEvent) g_mouseEventHandlers.add(self.handleMouseEventGlobal) g_postProcessing.enable('hangar') BigWorld.pauseDRRAutoscaling(True) return
def activate(self): self.setEnabled( self.settingsCore.getSetting(GAME.HANGAR_CAM_PARALLAX_ENABLED)) self.settingsCore.onSettingsChanged += self.__onSettingsChanged g_eventBus.addListener(CameraRelatedEvents.IDLE_CAMERA, self.__handleIdleCameraActivation) g_keyEventHandlers.add(self.__handleKeyEvent) g_eventBus.addListener( CameraRelatedEvents.FORCE_DISABLE_IDLE_PARALAX_MOVEMENT, self.__onForceDisable, EVENT_BUS_SCOPE.LOBBY) Windowing.addWindowAccessibilitynHandler( self.onWindowAccessibilityChanged)
def addHandler(self): if self.__isSetHandler: return self.__isSetHandler = True arena = BigWorld.player().arena arena.onPeriodChange += self.onArenaPeriodChange session = dependency.instance(IBattleSessionProvider) ctl = session.shared.vehicleState ctl.onVehicleStateUpdated += self.onVehicleStateUpdated ctl = session.shared.crosshair ctl.onCrosshairViewChanged += self.onCrosshairViewChanged ctl.onCrosshairPositionChanged += self.onCrosshairPositionChanged self.__crosshairPosition = list(ctl.getScaledPosition()) g_guiResetters.add(self.onScreenResolutionChanged) g_keyEventHandlers.add(self.__handleKeyEvent)
def start(self): super(ShotResultIndicatorPluginModified, self).start() ctrl = self.sessionProvider.shared.crosshair if ctrl is not None: ctrl.onGunMarkerStateChanged -= self._ShotResultIndicatorPlugin__onGunMarkerStateChanged ctrl.onGunMarkerStateChanged += self.__onGunMarkerStateChanged ctrlAnmo = self.sessionProvider.shared.ammo if ctrlAnmo is not None: ctrlAnmo.onGunReloadTimeSet += self.__onGunReloadTimeSet if BattleReplay.isPlaying() or avatar_getter.getArena( ).guiType == ARENA_GUI_TYPE.TRAINING: self.indicator = IndicatorPanel() self.indicator.start() try: g_keyEventHandlers.add(self.handleKeyEvent) except: LOG_CURRENT_EXCEPTION() return
def init(self, isPremium): if self.__space is None: self.__space = ClientHangarSpace(BoundMethodWeakref(self._changeDone)) self.statsCollector.noteHangarLoadingState(HANGAR_LOADING_STATE.START_LOADING_SPACE) self.__videoCameraController.init() self.__spaceDestroyedDuringLoad = False if not self.__spaceInited: LOG_DEBUG('HangarSpace::init') Waiting.show('loadHangarSpace', overlapsUI=False) self.__inited = True self.__isSpacePremium = isPremium self.__igrSpaceType = self.igrCtrl.getRoomType() self.__space.create(isPremium, self.__spaceDone) if self.__lastUpdatedVehicle is not None: self.startToUpdateVehicle(self.__lastUpdatedVehicle) self.gameSession.onPremiumNotify += self.onPremiumChanged g_keyEventHandlers.add(self.__handleKeyEvent) g_eventBus.addListener(events.LobbySimpleEvent.NOTIFY_CURSOR_OVER_3DSCENE, self.__onNotifyCursorOver3dScene) return
def __onSpaceCreated(self): g_mouseEventHandlers.add(self.__handleMouseEvent) g_keyEventHandlers.add(self.__handleKeyEvent) g_eventBus.addListener(CameraRelatedEvents.LOBBY_VIEW_MOUSE_MOVE, self.__handleLobbyViewMouseEvent)
def create(self, isPremium, onSpaceLoadedCallback = None): global _EVENT_HANGAR_PATHS global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath)) visibilityMask = 4294967295L if game_control.g_instance.igr.getRoomType() == constants.IGR_TYPE.PREMIUM: if _CFG.get(self.__igrHangarPathKey) is not None: spacePath = _CFG[self.__igrHangarPathKey] if _EVENT_HANGAR_PATHS.has_key(isPremium): spacePath = _EVENT_HANGAR_PATHS[isPremium] if _EVENT_HANGAR_VISIBILITY_MASK.has_key(isPremium): visibilityMask = _EVENT_HANGAR_VISIBILITY_MASK[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath visibilityMask = 4294967295L BigWorld.wg_setSpaceItemsVisibilityMask(self.__spaceId, visibilityMask) try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if _HANGAR_CFGS.has_key(spacePathLC): loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity('HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId, self) self.__yawCameraFilter = HangarCameraYawFilter(math.radians(_CFG['cam_yaw_constr'][0]), math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens']) self.__setupCamera() distConstrs = _CFG['cam_dist_constr'] previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs) if distConstrs is not None: if previewConstr is not None: self.__camDistConstr = (distConstrs, previewConstr) else: self.__camDistConstr = (distConstrs, distConstrs) else: self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0)) self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) self.__destroyFunc = None MapActivities.g_mapActivities.generateOfflineActivities(spacePath) g_keyEventHandlers.add(self.handleKeyEvent) g_mouseEventHandlers.add(self.handleMouseEventGlobal) g_postProcessing.enable('hangar') BigWorld.pauseDRRAutoscaling(True) return
def init(): g_keyEventHandlers.add(mod_handleKeyEvents) g_mouseEventHandlers.add(mod_handleMouseEvent) g_playerEvents.onAvatarReady += mod_AvatarReady # in game
def __onAvatarBecomePlayer(self): _logger.info('PlayerEvents: onAvatarBecomePlayer') g_keyEventHandlers.add(self.keyHandler.handleKeyEvent)
def __onSpaceCreated(self): self.__cam.isMovementEnabled = True self.__cameraParallax.activate() g_mouseEventHandlers.add(self.__handleMouseEvent) g_keyEventHandlers.add(self.__handleKeyEvent) g_eventBus.addListener(CameraRelatedEvents.LOBBY_VIEW_MOUSE_MOVE, self.__handleLobbyViewMouseEvent)