public static string GetABNameByAssetName(string assetName)
        {
            AssetsMap map = AssetsMap.Instance;

            if (!map.assets.ContainsKey(assetName))
            {
                return(null);
            }
            int abID = map.assets[assetName];
            KeyValuePair <string, string> abPair = map.assetbundles[abID];

            return(abPair.Key);
        }
Пример #2
0
        public AssetsMap()
        {
            _instance = this;

            string nativePath = ABConfig.AssetbundleRoot_Hotfix + "/" + ABConfig.NAME_ASSETSMAP; // 首先读取persistentData文件夹,是否有map文件

            if (File.Exists(nativePath))
            {
                ReadJson(File.ReadAllText(nativePath));
                _isDone = true;
            }
            else
            {
                IsStreamingAssets = true;

                nativePath = ABConfig.AssetbundleRoot_Streaming_AsWWW + "/" + ABConfig.NAME_ASSETSMAP; // 读取StreamingAssets的jar包,是否有map文件

                Coroutines.StartACoroutine(GetJson(nativePath));
            }
        }