// Draw the connection in the connection list. public static void DrawConnectionInList(GraphGrammarConnection connection) { connection.StartPositionX = 10; connection.EndPositionX = 60; connection.StartPositionY = connection.EndPositionY = 25 + 50 * _connections.FindIndex(c => c == connection); // Background color of selectable area. Color rectColor = SampleStyle.ColorBlue; rectColor.a = 0.75f; EditorCanvas.DrawQuad(new Rect(5, connection.StartPositionY - 23, Screen.width - 8, 46), connection.Selected ? rectColor : Color.clear); // Draw this connection. connection.Draw(); }
// Content of connections. void LayoutConnectionsInterface() { // Show the canvas, that is the list of nodes. LayoutSymbolList(); // Buttons for switching editing mode. LayoutEditingModeButtonGroup(); // Canvas for preview symbol. GUILayout.BeginArea(Container.SymbolPreviewArea); EditorGUI.DrawRect(Container.SymbolPreviewCanvas, SampleStyle.ColorDarkestGrey); // [TODO] This part (value assign) is temporary. _centerPosition.x = Screen.width / 2 - 25; _connection.StartPosition = _centerPosition; _centerPosition.x = Screen.width / 2 + 25; _connection.EndPosition = _centerPosition; // Draw this connection. _connection.Draw(); GUILayout.EndArea(); switch (_editingMode) { case EditingMode.Create: case EditingMode.Modify: // Content of property. GUILayout.BeginArea(Container.SymbolPropertiesArea); GUILayout.Space(SampleStyle.PaddingBlock); EditorGUILayout.BeginVertical(SampleStyle.Frame(SampleStyle.ColorLightestGrey)); // Information of connection. _symbolName = SampleStyle.TextFieldLabeled(Languages.GetText("MissionAlphabet-Name"), _symbolName, SampleStyle.TextFieldLabel, SampleStyle.TextField, SampleStyle.TextFieldHeight); _symbolDescription = SampleStyle.TextAreaLabeled(Languages.GetText("MissionAlphabet-Description"), _symbolDescription, SampleStyle.TextAreaLabel, SampleStyle.TextArea, SampleStyle.TextAreaHeight); _symbolOutlineColor = SampleStyle.ColorFieldLabeled(Languages.GetText("MissionAlphabet-OutlineColor"), _symbolOutlineColor, SampleStyle.ColorFieldLabel, SampleStyle.ColorField); _connectionType = (ConnectionType)SampleStyle.EnumPopupLabeled(Languages.GetText("MissionAlphabet-ConnectionType"), _connectionType, SampleStyle.EnumPopUpLabel, SampleStyle.EnumPopUp, SampleStyle.EnumPopUpHeight); _connectionArrowType = (ConnectionArrowType)SampleStyle.EnumPopupLabeled(Languages.GetText("MissionAlphabet-ArrowType"), _connectionArrowType, SampleStyle.EnumPopUpLabel, SampleStyle.EnumPopUp, SampleStyle.EnumPopUpHeight); // Update the conntection. UpdateConnection(_connection); // Show content of submition. LayoutSubmitionHint(); LayoutSubmitionButton(); EditorGUILayout.EndVertical(); GUILayout.EndArea(); break; } }