Exemplo n.º 1
0
        AssetbundleConfig loadABConfig()
        {
            string fullpath = AssetBundleInfo.assetPath_local + "\\" + "abConfig.txt";

            fullpath = fullpath.Replace("/", "\\");
            if (File.Exists(fullpath))
            {
                StreamReader sr   = File.OpenText(fullpath);
                string       text = sr.ReadToEnd();
                sr.Close();
                return(AssetbundleConfig.FromStr(text));
            }
            else
            {
                fullpath = AssetBundleInfo.curPlatformFloder + "/abConfig";
                Debug.Log("fullpath:" + fullpath);
                TextAsset ta = Resources.Load <TextAsset>(fullpath);
                if (ta == null)
                {
                    Debug.LogError("not find abConfig at resource dir");
                    return(null);
                }
                return(AssetbundleConfig.FromStr(ta.text));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 拉资源配置信息
        /// </summary>
        /// <param name="url"></param>
        /// <param name="back"></param>
        void pullAssetinfoFromSer(System.Action <AssetVersion> back)
        {
            string VersionPath         = AssetBundleInfo.assetPath_server + "/" + "assetVersionInfo.txt"; //资源版本信息
            string ConfigPath          = AssetBundleInfo.assetPath_server + "/" + "abConfig.txt";         //资源包配置信息
            string GameAssetConfigPath = AssetBundleInfo.assetPath_server + "/" + "gameAssetConfig.txt";  //游戏资源预加载信息

            loader.LoadFileFromServer(GameAssetConfigPath, (string str0) => {
                gameAssetConfig = GameAssetConfig.FromStr(str0);
                loader.LoadFileFromServer(ConfigPath, (string str) => {
                    Debug.Log("config file download"); abConfig = AssetbundleConfig.FromStr(str);
                    loader.LoadFileFromServer(VersionPath, (string str1) => {
                        AssetVersion av = AssetVersion.FromString(str1);
                        if (back != null)
                        {
                            back(av);
                        }
                    });
                });
            });
        }