Ejemplo n.º 1
0
        public static void EditGraph(DashGraph p_graph, string p_graphPath = "")
        {
            SelectionManager.ClearSelection();

            EditorConfig.editingRootGraph  = p_graph;
            EditorConfig.editingGraphPath  = p_graphPath;
            EditorConfig.editingGraph      = GraphUtils.GetGraphAtPath(p_graph, p_graphPath);
            EditorConfig.editingController = null;
        }
Ejemplo n.º 2
0
        public override void DrawInspector()
        {
            GUI.color = new Color(1, 0.75f, 0.5f);
            if (GUILayout.Button("Open Editor", GUILayout.Height(40)))
            {
                if (DashEditorCore.EditorConfig.editingController != null)
                {
                    DashEditorCore.EditController(DashEditorCore.EditorConfig.editingController,
                                                  GraphUtils.AddChildPath(DashEditorCore.EditorConfig.editingGraphPath, Model.id));
                }
                else
                {
                    DashEditorCore.EditGraph(DashEditorCore.EditorConfig.editingRootGraph,
                                             GraphUtils.AddChildPath(DashEditorCore.EditorConfig.editingGraphPath, Model.id));
                }
            }

            GUI.color = Color.white;

            if (!Model.useAsset)
            {
                if (GUILayout.Button("Save to Asset"))
                {
                    DashGraph graph = GraphUtils.CreateGraphAsAssetFile(SubGraph);
                    if (graph != null)
                    {
                        Model.useAsset   = true;
                        Model.graphAsset = graph;

                        _subGraphInstance   = null;
                        _selfReferenceIndex = -1;
                        _boundSubGraphData  = null;
                        _boundSubGraphReferences.Clear();
                    }
                }
            }
            else
            {
                if (GUILayout.Button("Bind Graph"))
                {
                    DashGraph graph = SubGraph.Clone();
                    _boundSubGraphData  = graph.SerializeToBytes(DataFormat.Binary, ref _boundSubGraphReferences);
                    _selfReferenceIndex = _boundSubGraphReferences.FindIndex(r => r == graph);

                    Model.useAsset   = false;
                    Model.graphAsset = null;
                }
            }

            GUI.color = Color.white;

            base.DrawInspector();
        }
Ejemplo n.º 3
0
        public static void EditController(DashController p_controller, string p_graphPath = "")
        {
            SelectionManager.ClearSelection();

            if (p_controller != null)
            {
                EditorConfig.editingRootGraph  = p_controller.Graph;
                EditorConfig.editingGraphPath  = p_graphPath;
                EditorConfig.editingGraph      = GraphUtils.GetGraphAtPath(p_controller.Graph, p_graphPath);
                EditorConfig.editingController = p_controller;
            }
            else
            {
                EditorConfig.editingGraph = null;
            }
        }