public void DrawNodeEditor(float _width, float _height) { panelSize = new Vector2(_width, _height); editorScrollPos = EditorGUILayout.BeginScrollView(editorScrollPos, false, false, GUILayout.Width(_width), GUILayout.Height(_height)); GUILayoutOption[] options = { GUILayout.Width(editorScrollSize.x), GUILayout.Height(editorScrollSize.y) }; EditorGUILayout.LabelField("", options); GUI.SetColor(new Color(25, 25, 25)); GUI.DrawTexture(new Rect(0, 0, _width, _height), Texture2D.blackTexture); GUI.SetColor(Color.white); if (Background != null) { for (var i = 0; i < 50; i++) { for (var j = 0; j < 25; j++) { Rect texRect = new Rect(i * Background.width, j * Background.height, Background.width, Background.height); GUI.DrawTexture(texRect, Background); } } } DrawEditorNodes(); LinksView.DrawLinks(); DrawIncompleteLink(); EditorGUILayout.EndScrollView(); editorScrollSize = new Vector2(farNodeX + 400, farNodeY + 400); nodeEditorSelection.Draw(Nodes.ToArray(), LinksView.GetLinks(), editorScrollPos); }
public string Draw(string[] constellationNames) { GUI.SetColor(Color.white); GUILayout.BeginHorizontal(); foreach (var path in constellationNames) { var names = path.Split('/'); var name = names[names.Length - 1].Split('.')[0]; if (GUILayout.Button(name, "MiniToolbarButton", GUILayout.MaxWidth(125), GUILayout.MinWidth(125))) { return(path); } if (GUILayout.Button("X", "MiniToolbarButton", GUILayout.MaxWidth(20), GUILayout.MinWidth(20))) { removeNode = path; } GUI.SetColor(Color.grey); GUILayout.Space(10); } GUI.SetColor(Color.white); GUILayout.EndHorizontal(); return(null); }
public void DrawBackgroundGrid(float _width, float _height, float offsetX, float offsetY, Color tint) { if (Background != null) { //Background location based of current location allowing unlimited background //How many background are needed to fill the background var xCount = Mathf.Round(_width / Background.width) + 2; var yCount = Mathf.Round(_height / Background.height) + 2; //Current scroll offset for background var xOffset = Mathf.Round(offsetX / Background.width) - 1; var yOffset = Mathf.Round(offsetY / Background.height) - 1; var texRect = new Rect(0, 0, Background.width, Background.height); // if (isInstance && constellationScript.IsDifferentThanSource) GUI.SetColor(tint); for (var i = xOffset; i < xOffset + xCount; i++) { for (var j = yOffset; j < yOffset + yCount; j++) { texRect.x = i * Background.width; texRect.y = j * Background.height; GUI.DrawTexture(texRect, Background); } } GUI.SetColor(Color.white); } }
private void DrawInstancePannel() { if (!constellationScript.IsDifferentThanSource || isTutorial) { return; } GUI.SetColor(Color.yellow); if (GUI.DrawButton(new Rect(0, 0, 100, 25), "Apply")) { if (isInstance) { constellationScript.IsDifferentThanSource = false; } OnApplyInstanceChanges(); } GUI.SetColor(Color.white); }
private void DrawInstancePannel() { if (!constellationScript.IsDifferentThanSource || NodeEditorNodes.IsTutorial()) { return; } GUI.SetColor(Color.yellow); Event e = Event.current; var x = 0; var y = 40; var width = 100; var height = 25; if (GUI.DrawButton(new Rect(x, y, width, height), "Apply")) { if (isInstance) { constellationScript.IsDifferentThanSource = false; } OnApplyInstanceChanges(); } GUI.SetColor(Color.white); }
public string Draw(string[] constellationsPath, ConstellationInstanceObject[] instancesPath) { GUI.SetColor(Color.white); GUILayout.BeginHorizontal(); foreach (var path in constellationsPath) { var constellationPath = path.Split('/'); var name = constellationPath[constellationPath.Length - 1].Split('.') [0]; if (instancesPath != null) { foreach (var instanceName in instancesPath) { if (path == instanceName.InstancePath) { GUI.SetColor(Color.yellow); } } } if (GUILayout.Button(name, "MiniToolbarButton", GUILayout.MaxWidth(125), GUILayout.MinWidth(125))) { return(path); } if (GUILayout.Button("X", "MiniToolbarButton", GUILayout.MaxWidth(20), GUILayout.MinWidth(20))) { removeNode = path; } GUI.SetColor(Color.grey); GUILayout.Space(10); } GUI.SetColor(Color.white); GUILayout.EndHorizontal(); return(null); }