private void SaveNodeToLibrary(Node node, string path) { try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } //copy from library var source = node.FullFolderPath; if (Directory.Exists(source)) { SaverLoader.CopyFilesRecursively(new DirectoryInfo(source), new DirectoryInfo(path), true); } //delete paths.meta var pathMetaFile = Path.Combine(path, UserSettings.Instance.PathsMetaFileName); if (File.Exists(pathMetaFile)) { File.Delete(pathMetaFile); } Bus.LibraryChanged += true; } catch (Exception ex) { UIManager.ShowDialog(null, ex.Message, "Ok"); UnityEngine.Debug.LogException(ex); } }
public void RefreshNode() { Bus.ClosePopupMenu += true; AddKnobsFromSource(FullFolderPath); SaverLoader.Save(Graph.Instance, Graph.Instance.SceneFilePath); Bus.SceneChanged += true; }
internal static void CloneNode(Graph graph, Node source) { using (var command = new StateCommand("Clone node")) { var node = GameObject.Instantiate(graph.NodePrefab, graph.NodesHolder.transform); node.Init(); node.transform.position = new Vector3(Screen.width / 2, Screen.height / 2); node.HeaderText = source.HeaderText; node.SourceLibraryFolder = source.SourceLibraryFolder; node.RemoveKnobs(); node.AddKnobsFromSource(source.FullFolderPath); SaverLoader.Save(Graph.Instance, Graph.Instance.SceneFilePath); SaverLoader.CopyFilesRecursively(new DirectoryInfo(source.FullFolderPath), new DirectoryInfo(node.FullFolderPath), true); } Bus.SceneChanged += true; }
public void Dispose() { var buffer = new byte[0]; using (var ms = new MemoryStream()) { SaverLoader.SavePxw(Graph.Instance, ms); buffer = ms.ToArray(); } redo = () => { using (var ms = new MemoryStream(buffer)) SaverLoader.Load(Graph.Instance, ms, true); SaverLoader.Save(Graph.Instance, Graph.Instance.SceneFilePath); Bus.SceneChanged += true; }; SaverLoader.Save(Graph.Instance, Graph.Instance.SceneFilePath); Bus.SceneChanged += true; }
public StateCommand(string actionDesc) { ActionDescription = actionDesc; var buffer = new byte[0]; using (var ms = new MemoryStream()) { SaverLoader.SavePxw(Graph.Instance, ms); buffer = ms.ToArray(); } undo = () => { using (var ms = new MemoryStream(buffer)) { SaverLoader.Load(Graph.Instance, ms, true); } SaverLoader.Save(Graph.Instance, Graph.Instance.SceneFilePath); Bus.SceneChanged += true; }; UndoRedoManager.Instance.Add(this); }
public static void LoadGraph(string filePath) { SaverLoader.Load(graph, filePath, true); Bus.SceneFilePathChanged += true; UndoRedoManager.Instance.ClearHistory(); }
public static void SaveGraph(string filePath) { SaverLoader.Save(graph, filePath); Bus.SceneFilePathChanged += true; }