コード例 #1
0
        public static string GetABPre(ABResEnum type)
        {
            switch (type)
            {
            case ABResEnum.prefab:
                return(PRE_PREFAB);

            case ABResEnum.material:
                return(PRE_MAT);

            case ABResEnum.model:
                return(PRE_FBX);

            case ABResEnum.animation:
                return(PRE_ANIM);

            case ABResEnum.texture:
                return(PRE_TEXTURE);

            case ABResEnum.atlas:
                return(PRE_ATLAS);

            case ABResEnum.extension:
                return(PRE_EXT);
            }
            throw new Exception("无法处理的ABResEnum=" + type);
        }
コード例 #2
0
        public static string GetABName(string path, ABResEnum type, AssetImporter importer)
        {
            string pre = GetABPre(type);

            if (type == ABResEnum.atlas)
            {
                if (importer == null)
                {
                    importer = AssetImporter.GetAtPath(path);
                }
                TextureImporter textureImporter = importer as TextureImporter;
                return(pre + textureImporter.spritePackingTag);
            }
            else if (type == ABResEnum.texture)
            {
                string   fileName = Path.GetFileNameWithoutExtension(path);
                string[] splits   = fileName.Split('_');
                if (splits.Length < 2)
                {
                    string md5 = MD5Util.Sum(path).Substring(0, 8).ToLower();
                    return(pre + md5);
                }
                else
                {
                    return(pre + MD5Util.Sum(splits[0] + "_" + splits[1]).Substring(0, 8).ToLower());
                }
            }
            else
            {
                string md5 = MD5Util.Sum(path).Substring(0, 8).ToLower();
                return(pre + md5);
            }
        }
コード例 #3
0
 public ABSingleRes(string path) : base(path)
 {
     importer         = AssetImporter.GetAtPath(this.path);
     mAssetBundleName = importer.assetBundleName;
     type             = ABResUtil.GetType(this.path, importer);
 }