Exemplo n.º 1
0
        private void SaveAs()
        {
            var saveUtility = GraphSaveUtility.GetInstance(_graphView);

            // TODO: change file path only if save succeeded.
            _filePath = EditorUtility.SaveFilePanelInProject("New narrative", "New narrative", "asset", "Save As...");
            saveUtility.SaveNodes(_filePath);
            UpdateTitle();
        }
Exemplo n.º 2
0
 private void Save()
 {
     if (_filePath == null)
     {
         SaveAs();
     }
     else
     {
         var saveUtility = GraphSaveUtility.GetInstance(_graphView);
         saveUtility.SaveNodes(_filePath);
     }
 }
Exemplo n.º 3
0
        private void CreateNew()
        {
            var loadFilePath = EditorUtility.SaveFilePanelInProject("Create Narrative", "New narrative", "asset", "");

            var saveUtility = GraphSaveUtility.GetInstance(_graphView);

            _graphView = new StoryGraphView
            {
                name = "Narrative Graph"
            };
            _filePath = loadFilePath;
            UpdateTitle();
        }
Exemplo n.º 4
0
        private void Update()
        {
            if (Selection.activeObject == null || Selection.activeObject.GetType() != typeof(DialogueContainer))
            {
                return;
            }
            var selectedGraph = Selection.activeObject as DialogueContainer;
            var path          = AssetDatabase.GetAssetPath(selectedGraph.GetInstanceID());

            if (path != null && path != _filePath)
            {
                var saveUtility = GraphSaveUtility.GetInstance(_graphView);
                saveUtility.LoadNarrative(path);
                _filePath = path;
                UpdateTitle();
            }
        }
Exemplo n.º 5
0
 private void RequestDataOperation(bool save)
 {
     if (!string.IsNullOrEmpty(_fileName))
     {
         var saveUtility = GraphSaveUtility.GetInstance(_graphView);
         if (save)
         {
             saveUtility.SaveGraph(_fileName);
         }
         else
         {
             saveUtility.LoadNarrative(_fileName);
         }
     }
     else
     {
         EditorUtility.DisplayDialog("Invalid File name", "Please Enter a valid filename", "OK");
     }
 }