コード例 #1
0
        public static void CopyAssets()
        {
            var dir = Application.streamingAssetsPath + "/" + Assets.Bundles;

            if (Directory.Exists(dir))
            {
                Directory.Delete(dir, true);
            }
            Directory.CreateDirectory(dir);
            var sourceDir = outputPath;
            var versions  = Assets.LoadVersions(Path.Combine(sourceDir, Assets.Versions));

            foreach (var file in versions.bundles)
            {
                if (file.location == 1)
                {
                    var destFile = Path.Combine(dir, file.name);
                    var destDir  = Path.GetDirectoryName(destFile);
                    if (!Directory.Exists(destDir) && !string.IsNullOrEmpty(destDir))
                    {
                        Directory.CreateDirectory(destDir);
                    }
                    File.Copy(Path.Combine(sourceDir, file.name), destFile);
                }
            }
            File.Copy(Path.Combine(sourceDir, Assets.Versions), Path.Combine(dir, Assets.Versions));
        }
コード例 #2
0
        public static void ViewVersions(string path)
        {
            var versions = Assets.LoadVersions(path);
            var txt      = "versions.txt";

            File.WriteAllText(txt, versions.ToString());
            EditorUtility.OpenWithDefaultApp(txt);
        }
コード例 #3
0
        public static void ViewVersions()
        {
            var versions = Assets.LoadVersions(Path.Combine(outputPath, Assets.Versions));
            var txt      = "versions.txt";

            File.WriteAllText(txt, versions.ToString());
            EditorUtility.OpenWithDefaultApp(txt);
        }
コード例 #4
0
        public static void CopyAssets()
        {
            var dir = Application.streamingAssetsPath + "/" + Assets.Bundles;

            if (Directory.Exists(dir))
            {
                Directory.Delete(dir, true);
            }
            Directory.CreateDirectory(dir);
            Debug.Log("show outputpath: " + outputPath);
            var sourceDir = outputPath;
            var versions  = Assets.LoadVersions(Path.Combine(sourceDir, Assets.Versions));
            var bundles   = new List <BundleRef>();
            var rules     = GetBuildRules();

            if (!rules.allAssetsToBuild)
            {
                var patches = rules.patchesInBuild;
                foreach (var patch in patches)
                {
                    var files = versions.GetFiles(patch);
                    foreach (var file in files)
                    {
                        if (!bundles.Exists(x => x.name.Equals(file.name)))
                        {
                            bundles.Add(file);
                        }
                    }
                }
            }
            else
            {
                bundles.AddRange(versions.bundles);
            }
            foreach (var file in bundles)
            {
                var destFile = Path.Combine(dir, file.name);
                var destDir  = Path.GetDirectoryName(destFile);
                if (!Directory.Exists(destDir) && !string.IsNullOrEmpty(destDir))
                {
                    Directory.CreateDirectory(destDir);
                }
                File.Copy(Path.Combine(sourceDir, file.name), destFile);
            }
            File.Copy(Path.Combine(sourceDir, Assets.Versions), Path.Combine(dir, Assets.Versions));
            AssetDatabase.Refresh();
        }