// Basic construction. public GraphGrammarConnection(string name, string description, ConnectionType requirement, ConnectionArrowType arrowType) : this() { this._name = name; this._description = description; this._requirement = requirement; this._arrow = arrowType; }
public static void Initialize() { // Initial whole fields in window. _symbolName = string.Empty; _symbolAbbreviation = string.Empty; _symbolDescription = string.Empty; _symbolOutlineColor = Color.black; _symbolFilledColor = Color.white; _symbolTextColor = Color.black; _symbolTerminal = NodeTerminalType.Terminal; // Set the first values. _currentTab = AlphabetWindowTab.Nodes; _isInitTabButton = true; _editingMode = EditingMode.None; _scrollPosition = Vector2.zero; _messageHint = string.Empty; _messageType = MessageType.Info; _node = new GraphGrammarNode(NodeTerminalType.Terminal); _connection = new GraphGrammarConnection(); _symbolListCanvas = new Rect(0, 0, Screen.width, Screen.height); _symbolListCanvasInWindow = _symbolListCanvas; _symbolListArea = new Rect(0, 0, Screen.width, Screen.height); _centerPosition = new Vector2(Screen.width / 2, 75); _connectionType = ConnectionType.WeakRequirement; _connectionArrowType = ConnectionArrowType.Normal; // Revoke all. Alphabet.RevokeAllSelected(); }
// Update the information form another connection, mostly reference is in Alphabet. public void UpdateSymbolInfo(GraphGrammarConnection referenceConnection) { _name = referenceConnection.Name; _description = referenceConnection.Description; _outlineColor = referenceConnection.OutlineColor; _requirement = referenceConnection.Requirement; _arrow = referenceConnection.Arrow; }
void UpdateFields(GraphGrammarConnection connection) { _symbolName = connection.Name; _symbolDescription = connection.Description; _symbolOutlineColor = connection.OutlineColor; _connectionType = connection.Requirement; _connectionArrowType = connection.Arrow; // Repaint the window. Repaint(); }
// Basic construction. public GraphGrammarConnection() : base() { this._alphabetID = Guid.NewGuid(); this._type = SymbolType.Connection; this._name = string.Empty; this._description = string.Empty; this._requirement = ConnectionType.WeakRequirement; this._arrow = ConnectionArrowType.Normal; this._startpointScope = new Rect(0, 0, this._pointScopeSize, this._pointScopeSize); this._endpointScope = new Rect(100, 100, this._pointScopeSize, this._pointScopeSize); this._outlineColor = Color.black; this._startpointStickyOn = null; this._endpointStickyOn = null; }
// Clone construction for basic informations. public GraphGrammarConnection(GraphGrammarConnection connection) { // Generate new symbol ID, but use same alphabet ID. this._symbolID = Guid.NewGuid(); this._alphabetID = connection.AlphabetID; // Basic information to copy. this._type = SymbolType.Connection; this._name = connection.Name; this._description = connection.Description; this._requirement = connection.Requirement; this._arrow = connection.Arrow; this._startpointScope = connection.StartpointScope; this._endpointScope = connection.EndpointScope; this._outlineColor = connection.OutlineColor; this._startpointStickyOn = null; this._endpointStickyOn = null; }
// 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; } }