void Init() { if (!runtimeInspector) { runtimeInspector = GetComponentInChildren <RuntimeInspector>(true); } if (!runtimeConsole) { runtimeConsole = GetComponentInChildren <RuntimeConsole>(true); } RuntimeConsole.instance = runtimeConsole; if (runtimeInspector && !runtimeInspector.gameObject.activeInHierarchy) { SetActiveDeactive(runtimeInspector.gameObject); } if (runtimeConsole && !runtimeConsole.gameObject.activeInHierarchy) { SetActiveDeactive(runtimeConsole.gameObject); } if (!runtimeConsole && runtimeInspector) { RuntimeConsole.accessLevel = AccessLevel.Admin; } if (runtimeInspector || runtimeConsole) { RuntimeInspector.InitAssemblies(); } }
void Awake() { instance = this; selectionIndicatorGO = transform.GetChild(0).gameObject; SetSelectionSphereRadius(); skin = windowData.skin; texArrowFolded = windowData.texArrowFolded; texArrowUnfolded = windowData.texArrowUnfolded; inspectorWindow = windowData.inspectorWindow; hierarchyWindow = windowData.hierarchyWindow; SetActive(showOnStart); // DontDestroyOnLoad(gameObject); if (enableCameraOnStart) { useNavigationCamera.Value = true; EnableCamControl(); } wrapButton = new GUIStyle(skin.button); wrapButton.wordWrap = true; wrapTextField = new GUIStyle(skin.textField); wrapTextField.wordWrap = true; drawEnum = new DrawEnum(skin); RuntimeConsole.Register(this); refreshHierarchySearch = 1; refreshInspectorSearch = 1; }
void OnDestroy() { RuntimeConsole.Unregister(this); if (instance == this) { instance = null; } }
public static void ResetAllStatic() { RuntimeInspector.ResetStatic(); NavigationCamera.ResetStatic(); GUIChangeBool.ResetStatic(); DrawEnum.ResetStatic(); CullGroup.ResetStatic(); HtmlDebug.ResetStatic(); }
public static bool DoWindowsContainMousePos() { if (instance.runtimeInspector) { WindowSettings hierarchyWindow = instance.runtimeInspector.windowData.hierarchyWindow; WindowSettings inspectorWindow = instance.runtimeInspector.windowData.inspectorWindow; if (RuntimeInspector.show && (hierarchyWindow.ContainsMousePos(EventInput.mousePos) || (RuntimeInspector.ShouldInspectorWindowShow() && inspectorWindow.ContainsMousePos(EventInput.mousePos)))) { return(true); } } if (instance.runtimeConsole) { WindowSettings consoleWindow = instance.runtimeConsole.windowData.consoleWindow; if (RuntimeConsole.show && consoleWindow.ContainsMousePos(EventInput.mousePos)) { return(true); } } return(false); }
void LateUpdate() { if (RuntimeInspector.instance == null) { Destroy(this); return; } deltaMouse = EventInput.mousePos - mousePosOld; mousePosOld = EventInput.mousePos; float speedMulti = GetSpeedMulti(); cam.fieldOfView = fov; deltaTime = Time.realtimeSinceStartup - tStamp; tStamp = Time.realtimeSinceStartup; Vector3 speed = Vector3.zero; if (followTarget) { RuntimeInspector.UpdateSelectedIndicatorTransform(); FollowTarget(); } if (EventInput.isMouseButtonDown1) { Quaternion oldRot = t.rotation; if (followTarget) { t.rotation = rotation; } else { t.rotation = navRotation; } t.Rotate(0, deltaMouse.x * data.mouseSensitity.value * 0.125f, 0, Space.World); t.Rotate(deltaMouse.y * data.mouseSensitity.value * 0.125f, 0, 0, Space.Self); if (followTarget) { followRotation = Quaternion.Inverse(ResetRotZ(selectionIndicatorT.rotation, false)) * ResetRotZ(t.rotation); } else { navRotation = ResetRotZ(t.rotation); } t.rotation = oldRot; if (EventInput.isKeyW) { speed.z = 1; } else if (EventInput.isKeyS) { speed.z = -1; } if (EventInput.isKeyD) { speed.x = 1; } else if (EventInput.isKeyA) { speed.x = -1; } if (EventInput.isKeyE) { speed.y = 1; } else if (EventInput.isKeyQ) { speed.y = -1; } speed *= speedMulti; } if (EventInput.isMouseButtonDown2) { speed.x = -(deltaMouse.x / deltaTime) / 60; speed.y = (deltaMouse.y / deltaTime) / 60; speed *= speedMulti * data.mouseStrafeMulti.value * 0.1f; currentSpeed = speed; } else { Lerp2Way(ref currentSpeed, speed, data.accelMulti.value, data.decelMulti.value); } GameObject selectionIndicatorGO = RuntimeInspector.selectionIndicatorGO; if (selectionIndicatorGO.activeInHierarchy) { if (EventInput.isFocusCameraKey && !EventInput.isAlignWithViewKey && !EventInput.isMoveToViewKey) { ResetFollowPosRot(); FollowTarget(); } } if (!followTarget) { t.rotation = rotation = navRotation; navPosition += t.TransformDirection(currentSpeed * deltaTime) + (t.forward * scrollWheel * GetSpeedMultiScrollWheel() * deltaTime); t.position = position = navPosition; } if (RuntimeInspector.selectedGO != null) { if (EventInput.isFocusCameraKey) { if (EventInput.isAlignWithViewKey) { RuntimeInspector.selectedGO.transform.position = t.position; RuntimeInspector.selectedGO.transform.forward = t.forward; } else if (EventInput.isMoveToViewKey) { RuntimeInspector.selectedGO.transform.position = t.position + (t.forward * 2); } } } }
void OnEnable() { instance = this; }