예제 #1
0
    private static void OpenWindow()
    {
        NodeBasedEditor window = GetWindow <NodeBasedEditor>();

        window.titleContent   = new GUIContent("Node Based Editor");
        window.minSize        = new Vector2(800f, 600f);
        window.wantsMouseMove = true;
        window.Show();
    }
예제 #2
0
    private static void OpenWindow()
    {
        if (EditorApplication.isPlaying)
        {
            //NodeBasedEditor window = GetWindow<NodeBasedEditor>();
            NodeBasedEditor window = new NodeBasedEditor(GameObject.FindObjectOfType <MMIAvatar>());
            window.Show();

            window.titleContent = new GUIContent("CoSimulation Hierachy Editor");
        }
        else
        {
            EditorUtility.DisplayDialog("Cannot open window", "Please enter play mode to open the window", "OK");
        }
    }
예제 #3
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.LabelField("Size", dataGraph.Size.ToString());

        if (GUILayout.Button(openNodeEditorText))
        {
            if (nodeBasedEditor == null)
            {
                nodeBasedEditor = BindNodeEditorWindow();
                nodeBasedEditor.onDataChange -= OnNodeEditorDataChange;
                nodeBasedEditor.onDataChange += OnNodeEditorDataChange;
            }

            nodeBasedEditor.Show();
            nodeBasedEditor.ClearData();
            nodeBasedEditor.SetData(ref dataGraph, OnCreateDataNode, OnRemoveDataNode, OnCreateDataEdge, OnRemoveDataEdge);
            nodeBasedEditor.Repaint();
        }

        if (GUILayout.Button(closeNodeEditorText))
        {
            if (nodeBasedEditor == null)
            {
                nodeBasedEditor = BindNodeEditorWindow();
                nodeBasedEditor.onDataChange -= OnNodeEditorDataChange;
                nodeBasedEditor.onDataChange += OnNodeEditorDataChange;
            }

            nodeBasedEditor.ClearData();
            nodeBasedEditor.Repaint();

            nodeBasedEditor = null;
        }

        OnNodeEditorDataChange();
    }