MakeNameList() public method

public MakeNameList ( ) : string[]
return string[]
Exemplo n.º 1
0
        void OnGUI()
        {
            // Disable GUI during the play mode, or when no patch is available.
            if (isPlayMode || _patch == null)
            {
                DrawNoPatchMessage();
                return;
            }

            // Tool bar
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            // - Create node menu
            _nodeFactory.CreateNodeMenuGUI(_patch);
            GUILayout.Space(100);

            // - Patch selector
            var patchIndex    = _patchManager.GetIndexOf(_patch);
            var newPatchIndex = EditorGUILayout.Popup(
                patchIndex, _patchManager.MakeNameList(),
                EditorStyles.toolbarDropDown
                );

            GUILayout.FlexibleSpace();

            EditorGUILayout.EndHorizontal();

            // View area
            EditorGUILayout.BeginHorizontal();

            // - Main view
            DrawMainViewGUI();

            // - Side view (property editor)
            DrawSideBarGUI();

            EditorGUILayout.EndHorizontal();

            // Re-initialize the editor if the patch selection was changed.
            if (patchIndex != newPatchIndex)
            {
                _patch = _patchManager.RetrieveAt(newPatchIndex);
                _patchManager.Select(_patch);
                Repaint();
            }

            // Cancel wiring with a mouse click or hitting the esc key.
            if (_wiring != null)
            {
                var e = Event.current;
                if (e.type == EventType.MouseUp ||
                    (e.type == EventType.KeyDown && e.keyCode == KeyCode.Escape))
                {
                    _wiring = null;
                    e.Use();
                }
            }
        }
Exemplo n.º 2
0
        void OnGUI()
        {
            // Do nothing while play mode.
            if (isPlayMode)
            {
                DrawPlaceholderGUI("Not available in play mode");
                return;
            }

            // If there is something wrong with the patch manager, reset it.
            if (!_patchManager.isValid)
            {
                _patchManager.Reset();
            }

            // Patch validity check.
            if (_patch != null)
            {
                if (!_patch.isValid)
                {
                    _patch = null; // Seems like not good. Abandon it.
                }
                else if (!_patch.CheckNodesValidity())
                {
                    _patch.Rescan(); // Some nodes are not good. Rescan them.
                }
            }
            // Get a patch if no one is selected.
            if (_patch == null)
            {
                _patch = _patchManager.RetrieveLastSelected();
            }

            // Draw a placeholder if no patch is available.
            // Disable GUI during the play mode, or when no patch is available.
            if (_patch == null)
            {
                DrawPlaceholderGUI("No patch available");
                return;
            }

            // Tool bar
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            // - Create node menu
            _nodeFactory.CreateNodeMenuGUI(_patch);
            GUILayout.Space(100);

            // - Patch selector
            var patchIndex    = _patchManager.GetIndexOf(_patch);
            var newPatchIndex = EditorGUILayout.Popup(
                patchIndex, _patchManager.MakeNameList(),
                EditorStyles.toolbarDropDown
                );

            GUILayout.FlexibleSpace();

            EditorGUILayout.EndHorizontal();

            // View area
            EditorGUILayout.BeginHorizontal();

            // - Main view
            DrawMainViewGUI();

            // - Side view (property editor)
            DrawSideBarGUI();

            EditorGUILayout.EndHorizontal();

            // Re-initialize the editor if the patch selection was changed.
            if (patchIndex != newPatchIndex)
            {
                _patch = _patchManager.RetrieveAt(newPatchIndex);
                _patchManager.Select(_patch);
                Repaint();
            }

            // Cancel wiring with a mouse click or hitting the esc key.
            if (_wiring != null)
            {
                var e = Event.current;
                if (e.type == EventType.MouseUp ||
                    (e.type == EventType.KeyDown && e.keyCode == KeyCode.Escape))
                {
                    _wiring = null;
                    e.Use();
                }
            }
        }