Ejemplo n.º 1
0
        public NodeWindow(string _editorPath, ConstellationScript _constellationScript)
        {
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            background          = new NodeEditorBackground(backgroundTexture);
            editorPath          = _editorPath;
            SelectedNodes       = new List <NodeView>();
            Nodes               = new List <NodeView>();
            ConstellationScript = _constellationScript;
            Links               = new LinksView(ConstellationScript);
            NodeFactory         = new NodesFactory(ConstellationScript?.ScriptAssembly?.GetAllScriptData());

            foreach (var node in _constellationScript.GetNodes())
            {
                DisplayNode(node);
            }
        }
Ejemplo n.º 2
0
        public NodeEditorPanel(IGUI _gui,
                               EditorWindow _editorWindow,
                               ConstellationScript _script,
                               IUndoable _undoable,
                               ClipBoard _editorClipBoard,
                               float positionX,
                               float positionY,
                               NodeEditorLinks.LinkAdded linkAdded,
                               NodeEditorLinks.LinkRemoved onLinkRemoved,
                               NodeEditorNodes.NodeAdded nodeAdded,
                               NodeEditorNodes.NodeRemoved nodeRemoved,
                               NodeEditorNodes.HelpClicked onHelpClicked,
                               ApplyInstanceChanges applyInstanceChanges,
                               ConstellationScriptData[] _constellationScripts)
        {
            constellationScripts = _constellationScripts;
            constellationScript  = _script;
            undoable             = _undoable;
            GUI              = _gui;
            EditorWindow     = _editorWindow;
            editorScrollSize = new Vector2(500, 500);
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            Background = new NodeEditorBackground(GUI, backgroundTexture);

            var allNodes = NodesFactory.GetAllNodes();

            nodes           = new string[allNodes.Length];
            editorScrollPos = new Vector2(positionX, positionY);

            for (var i = 0; i < allNodes.Length; i++)
            {
                nodes[i] = allNodes[i];
            }
            OnLinkAdded            += linkAdded;
            OnNodeAdded            += nodeAdded;
            OnNodeRemoved          += nodeRemoved;
            OnApplyInstanceChanges += applyInstanceChanges;
            OnHelpClicked          += onHelpClicked;
            OnLinkRemoved          += onLinkRemoved;
            nodeEditorSelection     = new NodeEditorSelection(GUI, _editorClipBoard);
            RequestSetup();
        }
Ejemplo n.º 3
0
        public NodeWindow(string _editorPath, ConstellationEditorDataService _constellationEditorData, Vector2 windowSize, Vector2 scrollPosition)
        {
            farNodeX         = windowSize.x;
            farNodeY         = windowSize.y;
            editorScrollSize = new Vector2(farNodeX + 400, farNodeY + 400);
            ScrollPosition   = scrollPosition;
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            background          = new NodeEditorBackground(backgroundTexture);
            editorPath          = _editorPath;
            SelectedNodes       = new List <NodeView>();
            Nodes               = new List <NodeView>();
            EditorData          = _constellationEditorData;
            ConstellationScript = EditorData.Script;
            Links               = new LinksView(ConstellationScript);
            NodeFactory         = new NodesFactory(ConstellationScript.ScriptAssembly.GetAllStaticScriptData());

            foreach (var node in ConstellationScript.GetNodes())
            {
                DisplayNode(node);
            }
        }