public static void GenerateUI(string pathToData, bool recompile = false, Func <FlowWindow, bool> predicate = null) { var filename = Path.GetFileName(pathToData); var directory = pathToData.Replace(filename, ""); currentProject = Path.GetFileNameWithoutExtension(pathToData); var basePath = directory + currentProject; CreateDirectory(basePath, string.Empty); CreateDirectory(basePath, FlowDatabase.OTHER_NAME); AssetDatabase.StartAssetEditing(); predicate = predicate ?? delegate { return(true); }; try { foreach (var each in FlowSystem.GetWindows().Where(_ => !_.isDefaultLink && predicate(_))) { var relativePath = GetRelativePath(each, "/"); if (!string.IsNullOrEmpty(each.directory)) { CreateDirectory(basePath, relativePath); } GenerateUIWindow(basePath + relativePath + "/", each, recompile); } } catch (Exception e) { Debug.LogException(e); } AssetDatabase.StopAssetEditing(); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); }
private static void Generate(string pathToData, bool recompile, System.Func <FlowWindow, bool> predicate) { var filename = Path.GetFileName(pathToData); var directory = pathToData.Replace(filename, string.Empty); FlowCompilerSystem.currentProject = Path.GetFileNameWithoutExtension(pathToData); FlowCompilerSystem.currentProjectDirectory = directory; var basePath = directory + FlowCompilerSystem.currentProject; IO.CreateDirectory(basePath, string.Empty); IO.CreateDirectory(basePath, FlowDatabase.OTHER_NAME); predicate = predicate ?? delegate { return(true); }; AssetDatabase.StartAssetEditing(); { try { var windows = FlowSystem.GetWindows().Where(w => !w.isDefaultLink && predicate(w)); foreach (var each in windows) { var relativePath = IO.GetRelativePath(each, "/"); FlowCompilerSystem.GenerateWindow(basePath + relativePath + "/", each, recompile); } } catch (Exception e) { Debug.LogException(e); } } AssetDatabase.StopAssetEditing(); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); FlowSystem.SetDirty(); FlowSystem.Save(); }
private static void Generate(string pathToData, bool recompile, bool minimalScriptsSize, System.Func <FD.FlowWindow, bool> predicate) { var filename = Path.GetFileName(pathToData); if (string.IsNullOrEmpty(pathToData) == true) { throw new Exception("`pathToData` is wrong: " + pathToData + ". Filename: " + filename); } var directory = pathToData.Replace(filename, string.Empty); CompilerSystem.currentProject = Path.GetFileNameWithoutExtension(pathToData); CompilerSystem.currentProjectDirectory = directory; var basePath = directory + CompilerSystem.currentProject; IO.CreateDirectory(basePath, string.Empty); IO.CreateDirectory(basePath, FlowDatabase.OTHER_NAME); predicate = predicate ?? delegate { return(true); }; AssetDatabase.StartAssetEditing(); { try { var windows = FlowSystem.GetWindows().Where(w => w.CanCompiled() && predicate(w)); foreach (var each in windows) { var relativePath = IO.GetRelativePath(each, "/"); CompilerSystem.GenerateWindow(basePath + relativePath + "/", each, recompile, minimalScriptsSize); } } catch (Exception e) { Debug.LogException(e); } } AssetDatabase.StopAssetEditing(); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); FlowSystem.SetDirty(); FlowSystem.Save(); }