コード例 #1
0
        /// <summary>
        /// 解析资源信息
        /// </summary>
        /// <returns></returns>
        static AssetVersion DecodeLocalResourcesinfo()
        {
            TextAsset ta = Resources.Load(getPlatformFolder() + "/assetVersionInfo") as TextAsset;

            if (ta == null)
            {
                Debug.LogError("DecodeLocalResourcesinfo ERROR,not found resourcesinfo.txt at Resources Directory:" + getPlatformFolder());
                return(null);
            }
            AssetVersion local = AssetVersion.FromString(ta.text);

            return(local);
        }
コード例 #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);
                        }
                    });
                });
            });
        }
コード例 #3
0
        AssetVersion getAssetinfoFromLocal()
        {
            string fullpath = AssetBundleInfo.assetPath_local + "/" + "assetVersionInfo.txt";

            if (File.Exists(fullpath))
            {
                StreamReader sr   = File.OpenText(fullpath);
                string       text = sr.ReadToEnd();
                sr.Close();
                return(AssetVersion.FromString(text));
            }
            else
            {
                fullpath = AssetBundleInfo.curPlatformFloder + "/assetVersionInfo";
                Debug.Log("fullpath:" + fullpath);
                TextAsset ta = Resources.Load <TextAsset>(fullpath);
                if (ta == null)
                {
                    Debug.LogError("not find AssetVersionInfo at resource dir");
                    return(null);
                }
                return(AssetVersion.FromString(ta.text));
            }
        }