/// <summary>
        /// Sets the initial settings for the DialogueGraphView instance.
        /// </summary>
        public DialogueGraphView(EditorWindow editorWindow)
        {
            if (exposedProperties == null)
            {
                exposedProperties = new List <ExposedProperty>();
            }

            // Load the stylesheet.
            styleSheets.Add(Resources.Load <StyleSheet>("DialogueGraph"));

            // Setup features for zooming, dragging, and selecting.
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            // Draw the grid.
            GridBackground grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            // Create the start node.
            AddElement(GenerateEntryPointNode());

            AddSearchWindow(editorWindow);
        }
Пример #2
0
        public TreeGraphView(TreeGraphEditorWindow editorWindow)
        {
            this.editorWindow = editorWindow;
            SetupZoom(0.1f, 4f);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new ClickSelector());

            var grid = new GridBackground();

            grid.StretchToParentSize();
            Insert(0, grid);

            nodeSearcher   = ScriptableObject.CreateInstance <NodeSearcher>();
            actionSearcher = ScriptableObject.CreateInstance <ActionSearcher>();

            nodeSearcher.Initialize(this);
            actionSearcher.Initialize(this);

            edgeConnectorListener = new EdgeConnectorListener(this);
            CreateRootNode();

            nodeCreationRequest = OnNodeCreationRequest;
            graphViewChanged    = OnGraphViewChanged;
        }
    public StrategyGraphView(Strategy strategy, string path)
    {
        styleSheets.Add(Resources.Load <StyleSheet>("StrategiesGraph"));

        SetupZoom(0.01f, 2f);

        this.AddManipulator(new ContentDragger());
        this.AddManipulator(new SelectionDragger());
        this.AddManipulator(new RectangleSelector());
        this.AddManipulator(new FreehandSelector());

        var grid = new GridBackground();

        Insert(0, grid);
        grid.StretchToParentSize();
        this.strategy = strategy;
        this.path     = path;

        AddElement(EntryPoint(strategy));

        foreach (var dn in strategy.nodes)
        {
            if (dn is StartDecision)
            {
                continue;
            }

            AddNodeToDecision(dn);
        }

        ConnectStrategyNodes();
        graphViewChanged += Changes;

        FrameAll();
    }
Пример #4
0
        public PatchworkView(EditorWindow parentWindow)
        {
            _parentWindow = parentWindow;
            styleSheets.Add(Resources.Load<StyleSheet>("Patchwork"));

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale * 2f, 0.1f, 1f);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            GridBackground grid = new GridBackground();
            Insert(0, grid);
            grid.StretchToParentSize();

            var colourNode = new ColourTextureNode();
            colourNode.SetNodePosition(new Vector2(400, 400));
            AddElement(colourNode);

            var outputNode = new OutputNode();
            outputNode.SetNodePosition(new Vector2(800, 300));
            AddElement(outputNode);

            Edge edge = (colourNode.outputContainer[0] as Port).ConnectTo(outputNode.inputContainer[0] as Port);
            Add(edge);

            colourNode.UpdateTexture();

            AddSearchWindow();
        }
Пример #5
0
        private void SetUpGrid()
        {
            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();
        }
 protected void CreateGridBackground()
 {
     GridBackground = new GridBackground {
         name = "Grid"
     };
     Insert(0, GridBackground);
 }
Пример #7
0
        private NodeSearchWindow searchWindow;                  // Search window

        // Spawning graph view
        public DialogueGraphView(DialogueEditorWindow newEditorWindow)
        {
            editorWindow = newEditorWindow;

            // Adding and loading this editor .css
            StyleSheet tmpStyleSheet = Resources.Load <StyleSheet>(styleSheetsName);

            styleSheets.Add(tmpStyleSheet);

            // Adding zoom to the editor
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());    // Ability to drag content
            this.AddManipulator(new SelectionDragger());  // Ability to drag selection
            this.AddManipulator(new RectangleSelector()); // Adding rectangle selector
            this.AddManipulator(new FreehandSelector());  // Adding keyboard selection

            // Adding grid to background
            GridBackground grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            AddSearchWindow();
        }
        public MyGraphView(MyGraphWindow window)
        {
            var grid = new GridBackground();

            Add(grid);
            grid.SendToBack();
        }
Пример #9
0
        public UINavGraphView(UINavEditor editor)
        {
            this.editor = editor;

            name = "UI Navigation Graph";

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            this.StretchToParentSize();

            //styleSheets.Add(Resources.Load<StyleSheet>("LSMGraphUSS"));
            GridBackground grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            AddSearchWindow();

            new NavNestedEndNode(this, new Vector2(0, 200));
            new NavStartNode(this, Vector2.zero);
        }
Пример #10
0
        public LogicGraphView(SceneView sceneView, bool drawGrid = false)
        {
            this.SceneView = sceneView;

            StyleSheet styleSheet = Resources.Load <StyleSheet>("LogicGraphUSS");

            if (styleSheet == null)
            {
                Debug.Log("Cant find styleSheet");
            }
            styleSheets.Add(styleSheet);
            //this.AddManipulator(new ContentDragger());
            selectionDragger          = new LogicSelectionDragger();
            selectionDragger.panSpeed = Vector2.one;

            this.AddManipulator(selectionDragger);

            gridBackground = new GridBackground();
            Insert(0, gridBackground);
            gridBackground.StretchToParentSize();
            gridBackground.visible       = drawGrid;
            gridBackground.style.display = drawGrid ? DisplayStyle.Flex : DisplayStyle.None;

            viewTransform.position = new Vector3(100, 100, 0);

            AddSearchWindow();
            //this.AddManipulator(new RectangleSelector());



            this.StretchToParentSize();
            this.pickingMode = PickingMode.Ignore;
            sceneView.rootVisualElement.Add(this);
        }
Пример #11
0
        public TreeGraphView(BehaviourTreeEditorr editor, VisualElement inspectorContainer)
        {
            this.editor             = editor;
            this.inspectorContainer = inspectorContainer;

            name = "BehaviourTreeGraph";

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            //styleSheets.Add(Resources.Load<StyleSheet>("LSMGraphUSS"));
            GridBackground grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            AddSearchWindow();

            AddNodeView(new Vector2(100, 100), typeof(RootTask));

            this.StretchToParentSize();
            graphViewChanged += (e) => { editor.IsUnsaved = true; return(e); };
        }
Пример #12
0
        public CodeGraphView(CodeGraph editorWindow)
        {
            this.editorWindow = editorWindow;
            this.AddStyleSheet("CodeGraph");
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            var searchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();

            searchWindowProvider.Initialize(this.editorWindow, this);
            nodeCreationRequest     = c => SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), searchWindowProvider);
            graphViewChanged       += OnGraphViewChanged;
            serializeGraphElements += SerializeGraphElementsImplementation;

            // canPasteSerializedData = CanPasteSerializedDataImplementation;
            unserializeAndPaste += UnserializeAndPasteImplementation;

            // deleteSelection = DeleteSelectionImplementation;
        }
Пример #13
0
        public ReddotGraphView(EditorWindow editorWindow)
        {
            ReddotPort.graphView = this;
            m_editorWindow       = editorWindow;
            var nodeStyle = AssetDatabase.LoadAssetAtPath <StyleSheet>(@"Assets\XFramework\Extend\Core\Modules\UI\Reddot\Editor\NarrativeGraph.uss");

            styleSheets.Add(nodeStyle);

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            nodeCreationRequest += context =>
            {
                var node = new ReddotNode();
                AddNode(node, context.screenMousePosition);
            };
        }
Пример #14
0
        public UIRelationGraphView()
        {
            styleSheets.Add(Resources.Load <StyleSheet>("NarrativeGraph"));
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            var provider = ScriptableObject.CreateInstance <UIViewMenuWindowProvider>();

            provider.CreateNodeEvent += configuration => {
                foreach (var existNode in m_nodes)
                {
                    if (existNode.Configuration == configuration)
                    {
                        return(false);
                    }
                }

                var node = new UINextLinkNode(configuration);
                AddNewNode(node);
                return(true);
            };
            nodeCreationRequest += context => {
                if (m_sourceNode == null)
                {
                    return;
                }
                SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), provider);
            };

            graphViewChanged += change => {
                if (change.elementsToRemove == null)
                {
                    return(change);
                }
                foreach (var element in change.elementsToRemove)
                {
                    if (element is UINextLinkNode linkNode)
                    {
                        m_nodes.RemoveSwap(linkNode);
                        RefreshPosition();
                    }
                    else if (element is Edge edge)
                    {
                        m_edges.RemoveSwap(edge);
                    }
                }

                return(change);
            };
        }
        private void ConstructGridBackground()
        {
            GridBackground grid = new GridBackground();

            grid.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/OTGCombatSystem/Editor/CombatSM/_CharacterView/SubViews/CharacterGraphSubView/CharacterGraphGridStyle.uss"));

            Insert(0, grid);
            grid.StretchToParentSize();
        }
Пример #16
0
        public ScriptGraphView(ScriptsConfiguration config, ScriptGraphState state, List <Script> scripts)
        {
            this.config  = config;
            this.scripts = scripts;
            this.state   = state;

            CustomStyleSheet = config.GraphCustomStyleSheet;
            styleSheets.Add(StyleSheet);
            if (CustomStyleSheet != null)
            {
                styleSheets.Add(CustomStyleSheet);
            }

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            var minimap = new MiniMap();

            minimap.anchored = true;
            minimap.SetPosition(new Rect(10, 30, 200, 140));
            minimap.visible = false;
            Add(minimap);

            var toolbar = new Toolbar();

            Add(toolbar);
            var rebuildButton = new Button(HandleRebuildButtonClicked);

            rebuildButton.text = "Rebuild Graph";
            toolbar.Add(rebuildButton);
            var alignButton = new Button(AutoAlign);

            alignButton.text = "Auto Align";
            toolbar.Add(alignButton);
            var minimapToggle = new Toggle();

            minimapToggle.label = "Show Minimap";
            minimapToggle.RegisterValueChangedCallback(evt => minimap.visible = evt.newValue);
            toolbar.Add(minimapToggle);
            var saveButton = new Button(SerializeState);

            saveButton.text = "Save";
            toolbar.Add(saveButton);

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            RebuildGraph();
        }
Пример #17
0
        public NodeEditorView(NodeEditorWindow window) : base()
        {
            Window = window;

            GridBackground gridBackground = new GridBackground();

            Add(gridBackground);
            gridBackground.SendToBack();

            nodeCreationRequest = NodeCreationRequestEventHandler;
        }
Пример #18
0
        public DialogEditorGraphView()
        {
            var background = new GridBackground();

            background.StretchToParentSize();

            Insert(0, background);

            TestNode();

            AddManipulators();
        }
Пример #19
0
        public NodeSketchGraphView()
        {
            styleSheets.Add(Resources.Load <StyleSheet>("Styles/GraphView"));

            var gridBackground = new GridBackground();

            gridBackground.pickingMode = PickingMode.Ignore;
            Add(gridBackground);
            gridBackground.SendToBack();

            this.deleteSelection += OnDeleteSelection;
        }
Пример #20
0
        public StoryGraphView(StoryGraphViewWindow window)
        {
            var grid = new GridBackground();

            //grid.
            Add(grid);
            grid.SendToBack();

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new ContentZoomer());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
        }
Пример #21
0
        public DialogueGraph()
        {
            styleSheets.Add(Resources.Load <StyleSheet>("EditorStyle"));

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new RectangleSelector());
            var grid = new GridBackground();

            Insert(0, grid);
            AddElement(GenerateEntryPoint());
        }
        public NodeGraphView(GraphTypeMetadata graphTypeMetadata)
        {
            styleSheets.Add(Resources.Load <StyleSheet>(ResourceAssetPaths.NodeGraphView_StyleSheet));

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            CustomContentDragger customContentDragger = new CustomContentDragger();

            this.AddManipulator(customContentDragger);
            SecondarySelectionDragger secondarySelectionDragger = new SecondarySelectionDragger();

            this.AddManipulator(secondarySelectionDragger); // Order here matters because the SecondarySelectionDragger allows the event to propagate
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            // Grid lines
            m_gridBackground = new GridBackground();
            Insert(0, m_gridBackground);
            m_gridBackground.StretchToParentSize();

            // Minimap
            m_miniMap = new MiniMap {
                anchored = true
            };
            m_miniMap.SetPosition(new Rect(0, 0, 200, 200));
            this.RegisterCallback <GeometryChangedEvent>((GeometryChangedEvent evt) => { m_miniMap.SetPosition(new Rect(evt.newRect.xMax - 210, evt.newRect.yMax - 210, 200, 200)); });
            Add(m_miniMap);

            GraphTypeMetadata    = graphTypeMetadata;
            m_nodeCreationWindow = ScriptableObject.CreateInstance <NodeCreationWindow>();
            m_nodeCreationWindow.Setup(this, GraphTypeMetadata);

            nodeCreationRequest = context =>
            {
                SearchWindow.Open(new SearchWindowContext(context.screenMousePosition, 0, 0), m_nodeCreationWindow);
            };
            graphViewChanged += OnGraphViewChanged;

            m_edgeConectorListener  = new EdgeConnectorListener(this);
            serializeGraphElements += CopyAndSerializeGraphElements;
            unserializeAndPaste    += UnserializeAndPasteGraphElements;
            canPasteSerializedData += CanUnserializeAndPaste;

            RegisterCallback <MouseMoveEvent>(x => { m_mousePosition = x.localMousePosition; });
            RegisterCallback <MouseUpEvent>(x => { OnMouseClick?.Invoke(); });
            Undo.undoRedoPerformed += () => { SetNodeCollection(NodeGraph); };

            m_graphAxesController = new GraphAxesController(this, customContentDragger, secondarySelectionDragger);
            Add(m_graphAxesController);
            m_graphAxesController.PlaceBehind(contentViewContainer);
            m_graphAxesController.SetEnable(true);
        }
Пример #23
0
    public DEGraphView()
    {
        styleSheets.Add(Resources.Load <StyleSheet>("degraph"));

        SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
        this.AddManipulator(new ContentDragger());
        this.AddManipulator(new SelectionDragger());
        this.AddManipulator(new RectangleSelector());

        var grid = new GridBackground();

        Insert(0, grid);
        grid.StretchToParentSize();
    }
Пример #24
0
        public BTGraphView()
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            GridBackground gridBackground = new GridBackground();

            Insert(0, gridBackground);
            gridBackground.StretchToParentSize();

            CreateBTNode(Vector2.one * 150, true);
        }
Пример #25
0
        public BehaviorTreeGraphView()
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            this.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(BehaviorTreeGraphWindow.c_StylePath));
        }
Пример #26
0
            public TimelineGraphView() : base()
            {
                SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
                this.AddManipulator(new ContentDragger());
                this.AddManipulator(new ContentZoomer());
                this.AddManipulator(new SelectionDragger());
                this.AddManipulator(new RectangleSelector());
                this.AddManipulator(new FreehandSelector());

                var grid = new GridBackground();

                Insert(0, grid);
                grid.StretchToParentSize();

                this.StretchToParentSize();
            }
Пример #27
0
        public EasyGraphView(EasyGraphWindow editorWindow) : this()
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            var grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            AddSearchWindow(editorWindow);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());
        }
Пример #28
0
    public DialogueGraphView()
    {
        styleSheets.Add(Resources.Load <StyleSheet>(path: "DialogueGraph"));
        SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

        this.AddManipulator(new ContentDragger());
        this.AddManipulator(new SelectionDragger());
        this.AddManipulator(new RectangleSelector());

        var grid = new GridBackground();

        Insert(index: 0, grid);
        grid.StretchToParentSize();

        AddElement(GenerateEntryPointNode());
    }
Пример #29
0
    //This is the CONSTRUCTOR for this specific graph class - the constructor handles the initalization logic on creation
    public SpeakEasyGraph()
    {
        styleSheets.Add(Resources.Load <StyleSheet>("SpeakEasyGraphSheet"));
        SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); //Enables the ability to zoom in and out of the graph.

        //Few comforts.
        this.AddManipulator(new ContentDragger());
        this.AddManipulator(new SelectionDragger());
        this.AddManipulator(new RectangleSelector());
        this.AddManipulator(new FreehandSelector());

        GridBackground grid = new GridBackground();

        Insert(0, grid);
        grid.StretchToParentSize();
    }
Пример #30
0
        /// <summary>Initializes a new instance of the <see cref="StoryView"/> class.</summary>
        public StoryView()
        {
            styleSheets.Add(Resources.Load <StyleSheet>("StoryView"));
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            GridBackground grid = new GridBackground();

            Insert(0, grid);
            grid.StretchToParentSize();

            AddElement(GetEntryPointNodeInstance());
        }