/// <summary> /// Load the KeyBoardModule and set all the approperiate settings /// </summary> internal void LoadKeyBoardModule() { _applicationModule?.AddData("DeviceLog is currently loading the keyboard module..."); try { bool special = Properties.Settings.Default.Keyboard_SpecialKeys; bool control = Properties.Settings.Default.KeyBoard_ControlCharacters; bool enterNewLine = Properties.Settings.Default.KeyBoard_EnterNewLine; bool windowTitle = Properties.Settings.Default.KeyBoard_WindowTitle; if (_keyboardModule != null) { _keyboardModule.SetLogSpecialCharacters(special); _keyboardModule.SetLogControlCharacters(control); _keyboardModule.SetLogEnterKeyNewLines(enterNewLine); _keyboardModule.SetLogWindowTitle(windowTitle); } else { _keyboardModule = new KeyboardModule(special, control, enterNewLine, false, true, windowTitle, _logController); } } catch (Exception ex) { MessageBox.Show(ex.Message, "DeviceLog", MessageBoxButton.OK, MessageBoxImage.Error); _applicationModule?.AddData("Error occured while loading keyboard module: " + ex.Message); } _applicationModule?.AddData("DeviceLog is done loading the keyboard module."); }
public void AfterTest() { // null everything! keyboardModule = null; keyboardInteractEventProducer = null; container.Dispose(); container = null; hookNativeMethodsMock = null; }
public void LoadModule() { InstantiateUIMethods.instantiateUI = InstantiateUI; var moduleLoaderCore = ModuleLoaderCore.instance; m_ModuleParent = moduleLoaderCore.GetModuleParent().transform; m_KeyboardModule = moduleLoaderCore.GetModule <KeyboardModule>(); }
public void BeforeTest() { //initialize module, producers and configuration keyboardModule = new KeyboardModule(); keyboardInteractEventProducer = new KeyboardInteractEventProducer(); // initialize the container and fulfill the MEF inports exports container = new CompositionContainer(); container.ComposeExportedValue(keyboardInteractEventProducer); container.ComposeParts(keyboardModule); //initialzie the hookNativeMethodsMock hookNativeMethodsMock = new HookNativeMethodsMock(); hookNativeMethodsMock.Initialize(); }
void Awake() { Nested.evr = this; // Set this once for the convenience of all nested classes ClearDeveloperConsoleIfNecessary(); m_DirectSelection = new DirectSelection(); m_Interfaces = new Interfaces(); m_Menus = new Menus(); m_MiniWorlds = new MiniWorlds(); m_Rays = new Rays(); m_Tools = new Tools(); m_UI = new UI(); m_Viewer = new Viewer(); m_Vacuumables = new Vacuumables(); m_HierarchyModule = AddModule <HierarchyModule>(); m_ProjectFolderModule = AddModule <ProjectFolderModule>(); VRView.cameraRig.parent = transform; // Parent the camera rig under EditorVR VRView.cameraRig.hideFlags = defaultHideFlags; if (VRSettings.loadedDeviceName == "OpenVR") { // Steam's reference position should be at the feet and not at the head as we do with Oculus VRView.cameraRig.localPosition = Vector3.zero; } var hmdOnlyLayerMask = 0; if (m_PreviewCameraPrefab) { var go = ObjectUtils.Instantiate(m_PreviewCameraPrefab); m_CustomPreviewCamera = go.GetComponentInChildren <IPreviewCamera>(); if (m_CustomPreviewCamera != null) { VRView.customPreviewCamera = m_CustomPreviewCamera.previewCamera; m_CustomPreviewCamera.vrCamera = VRView.viewerCamera; hmdOnlyLayerMask = m_CustomPreviewCamera.hmdOnlyLayerMask; m_Interfaces.ConnectInterfaces(m_CustomPreviewCamera); } } VRView.cullingMask = UnityEditor.Tools.visibleLayers | hmdOnlyLayerMask; m_DeviceInputModule = AddModule <DeviceInputModule>(); m_DeviceInputModule.InitializePlayerHandle(); m_DeviceInputModule.CreateDefaultActionMapInputs(); m_DeviceInputModule.processInput = ProcessInput; m_DeviceInputModule.updatePlayerHandleMaps = m_Tools.UpdatePlayerHandleMaps; m_UI.Initialize(); m_KeyboardModule = AddModule <KeyboardModule>(); m_DragAndDropModule = AddModule <DragAndDropModule>(); m_InputModule.rayEntered += m_DragAndDropModule.OnRayEntered; m_InputModule.rayExited += m_DragAndDropModule.OnRayExited; m_InputModule.dragStarted += m_DragAndDropModule.OnDragStarted; m_InputModule.dragEnded += m_DragAndDropModule.OnDragEnded; m_TooltipModule = AddModule <TooltipModule>(); m_Interfaces.ConnectInterfaces(m_TooltipModule); m_InputModule.rayEntered += m_TooltipModule.OnRayEntered; m_InputModule.rayExited += m_TooltipModule.OnRayExited; m_PixelRaycastModule = AddModule <PixelRaycastModule>(); m_PixelRaycastModule.ignoreRoot = transform; m_PixelRaycastModule.raycastCamera = m_UI.eventCamera; m_HighlightModule = AddModule <HighlightModule>(); m_ActionsModule = AddModule <ActionsModule>(); m_LockModule = AddModule <LockModule>(); m_LockModule.updateAlternateMenu = (rayOrigin, o) => m_Menus.SetAlternateMenuVisibility(rayOrigin, o != null); m_SelectionModule = AddModule <SelectionModule>(); m_SelectionModule.selected += m_Rays.SetLastSelectionRayOrigin; // when a selection occurs in the selection tool, call show in the alternate menu, allowing it to show/hide itself. m_SelectionModule.getGroupRoot = GetGroupRoot; m_SpatialHashModule = AddModule <SpatialHashModule>(); m_SpatialHashModule.shouldExcludeObject = go => go.GetComponentInParent <EditorVR>(); m_SpatialHashModule.Setup(); m_IntersectionModule = AddModule <IntersectionModule>(); m_Interfaces.ConnectInterfaces(m_IntersectionModule); m_IntersectionModule.Setup(m_SpatialHashModule.spatialHash); m_Menus.mainMenuTools = m_Tools.allTools.Where(t => !m_Tools.IsPermanentTool(t)).ToList(); // Don't show tools that can't be selected/toggled m_WorkspaceModule = AddModule <WorkspaceModule>(); m_WorkspaceModule.workspaceCreated += m_Vacuumables.OnWorkspaceCreated; m_WorkspaceModule.workspaceCreated += m_MiniWorlds.OnWorkspaceCreated; m_WorkspaceModule.workspaceCreated += (workspace) => { m_DeviceInputModule.UpdatePlayerHandleMaps(); }; m_WorkspaceModule.workspaceDestroyed += m_Vacuumables.OnWorkspaceDestroyed; m_WorkspaceModule.workspaceDestroyed += (workspace) => { m_Interfaces.DisconnectInterfaces(workspace); }; m_WorkspaceModule.workspaceDestroyed += m_MiniWorlds.OnWorkspaceDestroyed; UnityBrandColorScheme.sessionGradient = UnityBrandColorScheme.GetRandomGradient(); m_SceneObjectModule = AddModule <SceneObjectModule>(); m_SceneObjectModule.shouldPlaceObject = (obj, targetScale) => { foreach (var miniWorld in m_MiniWorlds.worlds) { if (!miniWorld.Contains(obj.position)) { continue; } var referenceTransform = miniWorld.referenceTransform; obj.transform.parent = null; obj.position = referenceTransform.position + Vector3.Scale(miniWorld.miniWorldTransform.InverseTransformPoint(obj.position), miniWorld.referenceTransform.localScale); obj.rotation = referenceTransform.rotation * Quaternion.Inverse(miniWorld.miniWorldTransform.rotation) * obj.rotation; obj.localScale = Vector3.Scale(Vector3.Scale(obj.localScale, referenceTransform.localScale), miniWorld.miniWorldTransform.lossyScale); return(false); } return(true); }; m_Viewer.AddPlayerModel(); m_Rays.CreateAllProxies(); // In case we have anything selected at start, set up manipulators, inspector, etc. EditorApplication.delayCall += OnSelectionChanged; }