public static string AssetBundleUrl2Name(string url)
        {
            string retName = null;
            string parren  = AssetBundlePathHelper.StreamingAssetsPath + "AssetBundles/" +
                             AssetBundlePathHelper.GetPlatformName() + "/";

            retName = url.Replace(parren, "");

            parren = AssetBundlePathHelper.PersistentDataPath + "AssetBundles/" +
                     AssetBundlePathHelper.GetPlatformName() + "/";
            retName = retName.Replace(parren, "");
            return(retName);
        }
        public static string AssetBundleName2Url(string name)
        {
            string retUrl = AssetBundlePathHelper.PersistentDataPath + "AssetBundles/" +
                            AssetBundlePathHelper.GetPlatformName() + "/" + name;

            if (File.Exists(retUrl))
            {
                return(retUrl);
            }

            return(AssetBundlePathHelper.StreamingAssetsPath + "AssetBundles/" +
                   AssetBundlePathHelper.GetPlatformName() + "/" + name);
        }
Beispiel #3
0
        public IEnumerator InitResMgrAsync()
        {
            if (AssetBundlePathHelper.SimulationMode)
            {
                AssetBundleSettings.AssetBundleConfigFile = ConfigFileUtility.BuildEditorDataTable();
                yield return(null);
            }
            else
            {
                AssetBundleSettings.AssetBundleConfigFile.Reset();

                var outResult = new List <string>();

                var pathPrefix = AssetBundlePathHelper.PathPrefix;

                // 未进行过热更
                if (AssetBundleSettings.LoadAssetResFromStreamingAssetsPath)
                {
                    var streamingPath = Application.streamingAssetsPath + "/AssetBundles/" +
                                        AssetBundlePathHelper.GetPlatformName() + "/" + ResDatas.FileName;
                    outResult.Add(pathPrefix + streamingPath);
                }
                // 进行过热更
                else
                {
                    var persistentPath = Application.persistentDataPath + "/AssetBundles/" +
                                         AssetBundlePathHelper.GetPlatformName() + "/" + ResDatas.FileName;
                    outResult.Add(pathPrefix + persistentPath);
                }

                foreach (var outRes in outResult)
                {
                    Log.I(outRes);
                    yield return(AssetBundleSettings.AssetBundleConfigFile.LoadFromFileAsync(outRes));
                }

                yield return(null);
            }
        }
Beispiel #4
0
 private static string GetPlatformName()
 {
     return(AssetBundlePathHelper.GetPlatformName());
 }