Exemplo n.º 1
0
        public static string GetAtlasPath(string folderPath, string tag)
        {
            string atlasPath = UIPrefabProcessor.GetShadowTextureFolderPath(folderPath) + "/UI_" + tag + ".png";

            UIPrefabProcessor.CreateInexistentFolder(atlasPath);
            return(atlasPath);
        }
Exemplo n.º 2
0
        private static Dictionary <string, string> ComputeMd5(string folderPath)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();
            string systemPath = UIPrefabProcessor.ToFileSystemPath(folderPath);

            string[]      allFilePaths = Directory.GetFiles(systemPath, "*.*");
            List <string> filePathList = new List <string>();

            foreach (string s in allFilePaths)
            {
                if (s.ToLower().EndsWith(".png") || s.ToLower().EndsWith(".png.meta"))
                {
                    filePathList.Add(s);
                }
            }
            //MD5 md5 = MD5.Create();
            for (int i = 0; i < filePathList.Count; i++)
            {
                string path = filePathList[i];
                //byte[] data = md5.ComputeHash(File.ReadAllBytes(path));
                //result.Add(UIPrefabProcessor.ToAssetPath(path), Convert.ToBase64String(data));
                result.Add(UIPrefabProcessor.ToAssetPath(path), AssetPatchMaker.GetFileLastWriteTime(path));
            }
            return(result);
        }
Exemplo n.º 3
0
        private static string[] GetAssetPaths(string folderPath)
        {
            string systemPath = UIPrefabProcessor.ToFileSystemPath(folderPath);

            string[] filePaths = Directory.GetFiles(systemPath, "*.png");
            string[] result    = new string[filePaths.Length];
            for (int i = 0; i < filePaths.Length; i++)
            {
                result[i] = UIPrefabProcessor.ToAssetPath(filePaths[i]);
            }
            return(result);
        }
Exemplo n.º 4
0
        private static void WriteJson(string content, string path)
        {
            string jsonPath = UIPrefabProcessor.ToFileSystemPath(path);

            if (File.Exists(jsonPath) == true)
            {
                File.Delete(jsonPath);
            }
            if (!string.IsNullOrEmpty(content))
            {
                StreamWriter sw = File.CreateText(jsonPath);
                sw.Write(content);
                sw.Close();
                AssetDatabase.ImportAsset(path);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取目录下Texture的Packingtag
        /// 同时验证同一目录下Texture的PackingTag是否相同,不同则报错,提示修改
        /// </summary>
        /// <param name="assetPaths"></param>
        /// <returns></returns>
        private static string GetFolderTexturePackingTag(string[] assetPaths)
        {
            string tag = null;

            foreach (string s in assetPaths)
            {
                string nextTag = GetTexturePackingTag(s);
                if (tag != null && tag != nextTag)
                {
                    UIPrefabProcessor.ThrowException("同一目录下存在不同的SpritePackingTag,路径: " + s + " tag: " + nextTag);
                }
                else
                {
                    tag = nextTag;
                }
            }
            return(tag);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 图片文件列表的Md5保存在图集文件夹下
 /// </summary>
 /// <param name="folderPath"></param>
 /// <returns></returns>
 private static string GetMd5RecordPath(string folderPath)
 {
     return(UIPrefabProcessor.GetShadowTextureFolderPath(folderPath) + "/md5.json");
 }