static void GetInfo() { if (SelectedObject != null) { StringBuilder sb = new StringBuilder(256); //name, form id sb.AppendFormat("TID: {0} | FID: {1} \n", SelectedObject.name, SelectedObject.GetComponent <BaseController>().Ref()?.FormID ?? "N/A"); //tags etc sb.AppendFormat("Unity Tag: {0} | Unity Layer: {1} | Entity tags: {2} \n", SelectedObject.tag, SelectedObject.layer, SelectedObject.GetComponent <BaseController>().Ref()?.Tags?.ToNiceString() ?? "N/A"); //coords sb.AppendFormat("Location: ({0:f2},{1:f2},{2:f2})\n", SelectedObject.transform.position.x, SelectedObject.transform.position.y, SelectedObject.transform.position.z); //enabled? active? sb.AppendFormat("Active: {0} | Visible: {1}", SelectedObject.activeSelf, SelectedObject.GetComponent <BaseController>().Ref()?.GetVisibility().ToString() ?? "N/A"); ConsoleModule.WriteLine(sb.ToString()); } else { ConsoleModule.WriteLine("No object selected!"); } }
public void TransitionToPauseState() { var state = PlayingAnimator.GetBehaviour <PauseState>(); if (SelectedObject != null) { state.SelectedProgrammer = SelectedObject.GetComponent <Programmer>(); } PlayingAnimator.SetStateBool(StateParameter.Pause, true); }
protected override void RefreshScale() { var difference = (Camera.transform.position - SelectedObject.transform.position).magnitude; var realScale = scale - 1f; realScale *= 100f; realScale = 999f - realScale; realScale = difference / realScale; if (realScale > maxScale) { realScale = maxScale; } var selectedTransform = SelectedObject.transform; var mesh = SelectedObject.GetComponent <MeshFilter>().mesh; var meshSize = Vector3.one; if (mesh != null) { meshSize = mesh.bounds.size; } var objSize = selectedTransform.localScale; var size = Vector3.Scale(meshSize, objSize); _xCube.localPosition = Vector3.up * size.x / 2f; _xCube.localScale = Vector3.one * realScale * 3f; _xAxis.localPosition = Vector3.up * size.x / 4f; _xAxis.localScale = new Vector3(2f * realScale, size.x / 4f, 2f * realScale); _yCube.localPosition = Vector3.up * size.y / 2f; _yCube.localScale = Vector3.one * realScale * 3f; _yAxis.localPosition = Vector3.up * size.y / 4f; _yAxis.localScale = new Vector3(2f * realScale, size.y / 4f, 2f * realScale); _zCube.localPosition = Vector3.up * size.z / 2f; _zCube.localScale = Vector3.one * realScale * 3f; _zAxis.localPosition = Vector3.up * size.z / 4f; _zAxis.localScale = new Vector3(2f * realScale, size.z / 4f, 2f * realScale); _center.localScale = Vector3.one * 5f * realScale; }
public override void ExecuteHandling(Handle handle) { var handleTransform = handle.transform; var axisRay = new Ray(handleTransform.position, handleTransform.up); var mouseRay = Camera.ScreenPointToRay(Input.mousePosition); if (!ClosestPointsOnTwoLines( out _, out var currentPoint, mouseRay.origin, mouseRay.direction, axisRay.origin, axisRay.direction)) { return; } if (!FirstHandling) { var difference = currentPoint - _lastPoint; difference = Quaternion.Inverse(SelectedObject.transform.rotation) * difference; var mesh = SelectedObject.GetComponent <MeshFilter>().mesh; var meshSize = Vector3.one; if (mesh != null) { meshSize = mesh.bounds.size; } difference = new Vector3( difference.x / meshSize.x, difference.y / meshSize.y, difference.z / meshSize.z); SelectedObject.transform.localScale += difference * 2f; } else { FirstHandling = false; } _lastPoint = currentPoint; }
private void OnGUI() { RefreshSelection(); IncludeChild = GUILayout.Toggle(IncludeChild, "Include Child Objects", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(20)); if (IncludeChild) { IncludeRecursively = GUILayout.Toggle(IncludeRecursively, "Include Recursively", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(20)); } DrawUILine(Color.black); if (GUILayout.Button("Group selected", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { GroupSelected(); } if (GUILayout.Button("Add Child", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AddEmptyChild(); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <VerticalLayoutGroup>()) { GUI.color = Color.green; } if (GUILayout.Button("V Group", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { SetLayout(UILayout.Vertical); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <HorizontalLayoutGroup>()) { GUI.color = Color.green; } if (GUILayout.Button("H Group", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { SetLayout(UILayout.Horizontal); } GUI.color = Color.white; if (GUILayout.Button("Flip layout", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { FlipLayout(); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <ContentSizeFitter>()) { GUI.color = Color.green; } if (GUILayout.Button("Content Size", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AddContentSizeFitter(); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <LayoutElement>()) { GUI.color = Color.green; } if (GUILayout.Button("Layout Element", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AddUIComponent(typeof(LayoutElement)); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <Image>()) { GUI.color = Color.green; } if (GUILayout.Button("Add Image", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AddUIComponent(typeof(Image)); } GUI.color = Color.white; if (!WrongObject && SelectedObject.GetComponent <Button>()) { GUI.color = Color.green; } if (!WrongObject && SelectedObject.GetComponent <Button>()) { GUI.color = Color.green; } if (GUILayout.Button("Add Button", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AddUIComponent(typeof(Button)); } DrawUILine(Color.black); GUI.color = Color.white; if (GUILayout.Button("Duplicate", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { Duplicate(); } if (GUILayout.Button("V-Align", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AlignV(); } if (GUILayout.Button("H-Align", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { AlignH(); } if (GUILayout.Button("V-Spacing", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { SpacingV(); } if (GUILayout.Button("H-Spacing", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { SpacingH(); } if (GUILayout.Button("TXT -> TMP", GUILayout.MinWidth(buttonWidth), GUILayout.MinHeight(buttonHeight))) { SwitchToTMP(); } DrawUILine(Color.black); }