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(); }
private void Save() { if (_filePath == null) { SaveAs(); } else { var saveUtility = GraphSaveUtility.GetInstance(_graphView); saveUtility.SaveNodes(_filePath); } }
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(); }
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(); } }
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"); } }