// Basic construction. public GraphGrammarNode(string name, string abbreviation, string description, NodeTerminalType terminal) : this() { this._name = name; this._abbreviation = abbreviation; this._description = description; this._terminal = terminal; }
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 node, mostly reference is in Alphabet. public void UpdateSymbolInfo(GraphGrammarNode referenceNode) { _terminal = referenceNode.Terminal; _name = referenceNode.Name; _abbreviation = referenceNode.Abbreviation; _description = referenceNode.Description; _outlineColor = referenceNode.OutlineColor; _filledColor = referenceNode.FilledColor; _textColor = referenceNode.TextColor; }
// Refresh the fields when select any symbol. void UpdateFields(GraphGrammarNode node) { _symbolTerminal = node.Terminal; _symbolName = node.Name; _symbolAbbreviation = node.Abbreviation; _symbolDescription = node.Description; _symbolOutlineColor = node.OutlineColor; _symbolFilledColor = node.FilledColor; _symbolTextColor = node.TextColor; // Repaint the window. Repaint(); }
// Initial whole fields in window. private static void InitFields() { _symbolName = string.Empty; _symbolAbbreviation = string.Empty; _symbolDescription = string.Empty; _symbolOutlineColor = Color.black; _symbolFilledColor = Color.white; _symbolTextColor = Color.black; _symbolTerminal = NodeTerminalType.Terminal; // Unfocus from the field. GUI.FocusControl("FocusToNothing"); }
// Construction public GraphGrammarNode() : base() { this._alphabetID = Guid.NewGuid(); this._type = SymbolType.Node; this._name = string.Empty; this._abbreviation = string.Empty; this._description = string.Empty; this._terminal = NodeTerminalType.Terminal; this._outlineScope = new Rect(0, 0, 39, 39); this._filledScope = new Rect(2, 2, 35, 35); this._textScope = new Rect(0, 0, 45, 34); this._outlineColor = Color.black; this._filledColor = Color.white; this._textColor = Color.black; this._stickiedConnections = new List <StickiedConnection>(); }
// Clone construction for basic informations. public GraphGrammarNode(GraphGrammarNode node) { // Generate new symbol ID, but use same alphabet ID. this._symbolID = Guid.NewGuid(); this._alphabetID = node.AlphabetID; // Basic information to copy. this._type = SymbolType.Node; this._name = node.Name; this._abbreviation = node.Abbreviation; this._description = node.Description; this._terminal = node.Terminal; this._outlineScope = node.OutlineScope; this._filledScope = node.FilledScope; this._textScope = node.TextScope; this._outlineColor = node.OutlineColor; this._filledColor = node.FilledColor; this._textColor = node.TextColor; // Keep it empty. this._stickiedConnections = new List <StickiedConnection>(); }
// Content of nodes. void LayoutNodesInterface() { // 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); _centerPosition.x = Screen.width / 2; _node.Position = _centerPosition; _node.Draw(); GUILayout.EndArea(); // Area for input fields. 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 node. _symbolTerminal = (NodeTerminalType)SampleStyle.EnumPopupLabeled(Languages.GetText("MissionAlphabet-SymbolType"), _symbolTerminal, SampleStyle.EnumPopUpLabel, SampleStyle.EnumPopUp, SampleStyle.EnumPopUpHeight); _symbolName = SampleStyle.TextFieldLabeled(Languages.GetText("MissionAlphabet-Name"), _symbolName, SampleStyle.TextFieldLabel, SampleStyle.TextField, SampleStyle.TextFieldHeight); _symbolAbbreviation = SampleStyle.TextFieldLabeled(Languages.GetText("MissionAlphabet-Abbreviation"), _symbolAbbreviation, 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); _symbolFilledColor = SampleStyle.ColorFieldLabeled(Languages.GetText("MissionAlphabet-FilledColor"), _symbolFilledColor, SampleStyle.ColorFieldLabel, SampleStyle.ColorField); _symbolTextColor = SampleStyle.ColorFieldLabeled(Languages.GetText("MissionAlphabet-TextColor"), _symbolTextColor, SampleStyle.ColorFieldLabel, SampleStyle.ColorField); // Update the node. UpdateNode(_node); // Show content of submition. LayoutSubmitionHint(); LayoutSubmitionButton(); EditorGUILayout.EndVertical(); GUILayout.EndArea(); break; } }
// Basic construction. public GraphGrammarNode(NodeTerminalType terminal) : this() { this._terminal = terminal; }