Example #1
0
 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();
 }
Example #2
0
        // Native function for Editor Window.
        void OnGUI()
        {
            if (_isInitTabButton)
            {
                NodeTabButtonStyle       = new GUIStyle(SampleStyle.GetButtonStyle(SampleStyle.ButtonType.Left, SampleStyle.ButtonColor.Blue));
                ConnectionTabButtonStyle = new GUIStyle(SampleStyle.GetButtonStyle(SampleStyle.ButtonType.Right, SampleStyle.ButtonColor.Blue));
                _isInitTabButton         = false;
            }
            SampleStyle.DrawWindowBackground(SampleStyle.ColorGrey);
            // Buttons - Nodes or Connections.
            GUILayout.BeginVertical(SampleStyle.Frame(SampleStyle.ColorLightestGrey));
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Toggle(_currentTab == AlphabetWindowTab.Nodes, Languages.GetText("MissionAlphabet-Tab-Nodes"), NodeTabButtonStyle, SampleStyle.TabButtonHeight))
            {
                _editingMode = (_currentTab != AlphabetWindowTab.Nodes) ? EditingMode.None : _editingMode;
                _currentTab  = AlphabetWindowTab.Nodes;
            }
            if (GUILayout.Toggle(_currentTab == AlphabetWindowTab.Connections, Languages.GetText("MissionAlphabet-Tab-Connections"), ConnectionTabButtonStyle, SampleStyle.TabButtonHeight))
            {
                _editingMode = (_currentTab != AlphabetWindowTab.Connections) ? EditingMode.None : _editingMode;
                _currentTab  = AlphabetWindowTab.Connections;
            }
            EditorGUILayout.EndHorizontal();
            // Toggle for nodes interface and connection interface.
            switch (_currentTab)
            {
            case AlphabetWindowTab.Nodes:
                // Header.
                GUILayout.Label(Languages.GetText("MissionAlphabet-List-Nodes"), SampleStyle.HeaderTwo, SampleStyle.HeaderTwoHeightLayout);
                // Content of nodes.
                LayoutNodesInterface();
                break;

            case AlphabetWindowTab.Connections:
                // Header.
                GUILayout.Label(Languages.GetText("MissionAlphabet-List-Connections"), SampleStyle.HeaderTwo, SampleStyle.HeaderTwoHeightLayout);
                // Content of connections.
                LayoutConnectionsInterface();
                break;
            }

            // Event controller.
            EventController();
            GUILayout.EndVertical();
        }