示例#1
0
        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();
        }
示例#2
0
        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(string.Format("`pathToData` is wrong: {0}. Filename: {1}", pathToData, 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.GetContainersAndWindows().Where(w => w.CanCompiled() && predicate(w));
                    //var windows = FlowSystem.GetContainers().Where(w => w.CanCompiled() && predicate(w));
                    foreach (var each in windows)
                    {
                        var relativePath = IO.GetRelativePath(each, "/");
                        CompilerSystem.GenerateWindow(string.Format("{0}{1}/", basePath, relativePath), each, recompile, minimalScriptsSize);
                    }

                    // Generate Base Files
                    var newInfo              = new Tpl.Info(CompilerSystem.currentNamespace, "Container", "ContainerBase", "LayoutWindowType", basePath);
                    var baseClassTemplate    = TemplateGenerator.GenerateWindowLayoutContainerBaseClass(newInfo.baseClassname, newInfo.baseNamespace, newInfo.containerClassName);
                    var derivedClassTemplate = TemplateGenerator.GenerateWindowLayoutDerivedClass(newInfo.classname, newInfo.baseClassname, newInfo.baseNamespace);

                    IO.CreateFile(basePath, newInfo.baseClassnameFile, baseClassTemplate, rewrite: true);
                    IO.CreateFile(basePath, newInfo.classnameFile, derivedClassTemplate, rewrite: false);
                } catch (Exception e) {
                    if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                    {
                        UnityEngine.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();
        }
示例#4
0
 public static string GetNamespace(FlowWindow window)
 {
     return(Tpl.GetNamespace() + IO.GetRelativePath(window, "."));
 }
示例#5
0
 public static string GetNamespace(FD.FlowWindow window)
 {
     return(string.Format("{0}{1}", Tpl.GetNamespace(), IO.GetRelativePath(window, ".")));
 }