Beispiel #1
0
        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);
        }
Beispiel #2
0
        public AssetsMap()
        {
            _instance = this;

            string nativePath = $"{ABConfig.RootPath_HotFix}/{ABConfig.NAME_ASSETSMAP}"; // 首先读取PersistentData文件夹,是否有map文件

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

                nativePath = $"{ABConfig.RootPath_WebStreaming}/{ABConfig.NAME_ASSETSMAP}"; // 尝试读取StreamingAssets文件夹
                Coroutines.StartACoroutine(GetJson(nativePath));
            }
        }