Exemplo n.º 1
0
 public static DataUtilities GetInstance(DialogueGraph graph, DialogueData data)
 {
     return(new DataUtilities
     {
         graph = graph,
         dataContainer = data
     });
 }
Exemplo n.º 2
0
        private void CreateGraph()
        {
            graph = new DialogueGraph()
            {
                name = "Dialogue Graph"
            };
            graph.StretchToParentSize();
            rootVisualElement.Add(graph);

            var toolbar = new Toolbar();


            var addDilogueNodeButton = new Button(() =>
            {
                graph.AddDialogueNode("Dialogue Node");
            })
            {
                text = "New Dialogue Node"
            };

            var createChoiceNodeButton = new Button(() =>
            {
                graph.AddChoiceNode("Choice Node");
            })
            {
                text = "New Choice Node"
            };

            var saveButton = new Button(() =>
            {
                var saveUtility = DataUtilities.GetInstance(graph, container);
                saveUtility.SaveGraph(path);
            })
            {
                text = "Save"
            };

            toolbar.Add(addDilogueNodeButton);
            toolbar.Add(createChoiceNodeButton);
            toolbar.Add(saveButton);



            rootVisualElement.Add(toolbar);
        }