void DownLoadCheckFileFail(DownLoader dloader, CheckComplete onComplete, bool useCache, bool needRetry)
        {
            isChecking = false;
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());
            bool   isfileExit = File.Exists(tfilePath);

            if (dloader.IsCompleteDownLoad && isfileExit)
            {
                DownLoadCheckFileFinished(onComplete);
            }
            else
            {
                if (ReTryCheckCount >= ReTryMaxCount)
                {
                    needRetry = false;
                }

                if (needRetry)
                {
                    ReTryCheckCount++;
                    if (autoUseCacheCheck && isfileExit)
                    {
                        StartCoroutine(WaitRetryCheck(0.1f, onComplete, true, needRetry));
                    }
                    else
                    {
                        StartCoroutine(WaitRetryCheck(3, onComplete, useCache, needRetry));
                    }
                }
                else
                {
                    CallCheckOnComplete(onComplete, null);
                }
            }
        }
 void ReleaseCheckLoader()
 {
     if (checkLoader == null)
     {
         return;
     }
     checkLoader.Dispose();
     checkLoader = null;
 }
 void DownLoadCheckFileEnd(DownLoader dloader, CheckComplete onComplete, bool useCache, bool needRetry)
 {
     if (dloader.IsCompleteDownLoad)
     {
         DownLoadCheckFileFinished(onComplete);
     }
     else
     {
         Debug.Log(dloader.Error);
         DownLoadCheckFileFail(dloader, onComplete, useCache, needRetry);
     }
 }
示例#4
0
        /// <summary>
        /// POST从URL获取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static T FromUrl <T>(string url, string data, int recursionLimit)
        {
            var message = new RequestMessage {
                Url = url, PostData = data
            };

            if (Credence != null)
            {
                message.Cookies = Credence;
            }

            var content = DownLoader.GetContent(message, 3);

            return(content.FromJson <T>(recursionLimit));
        }
示例#5
0
        /// <summary>
        /// POST从URL获取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static T FromUrl <T>(string url, string data)
        {
            var message = new RequestMessage {
                Url = url, PostData = data
            };

            if (Credence != null)
            {
                message.Cookies = Credence;
            }
            string webProxy = ConfigurationUtility.AppSettings <string>("WebProxy", string.Empty);

            if (!string.IsNullOrEmpty(webProxy))
            {
                message.Proxy = new WebProxy(webProxy);
            }
            var content = DownLoader.GetContent(message, 3);

            return(content.FromJson <T>());
        }
示例#6
0
        public void DownComp()
        {
            string   str     = GameUtils.ReadFile("ABVersion.Json");
            JsonData data    = JsonMapper.ToObject(str);
            JsonData entries = data["Entries"];

            DownLoader         loader = DownLoadManager.Instance.GetDownLoader();
            List <UrlDiskPath> temp   = new List <UrlDiskPath>();

            foreach (var item in entries.Keys)
            {
                JsonData it   = entries[item];
                string   url  = "http://182.48.99.226:18080/SharedFiles/Res/Assetbundles/Android_Assetbundles/";
                string   disk = (string)it["N"];
                url += disk;
                UrlDiskPath path = new UrlDiskPath(url, PathManager.Instance.PersistentDataCustomPath + "/" + disk);
                temp.Add(path);
            }

            loader.DownLoadFiles(temp.ToArray(), DownComp1, ProgressCallback1, Fail);
        }
        IEnumerator CheckingUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
        {
            ReleaseCheckLoader();

            string tuf        = GetServerUrl(LoaderManager.byteFileInfoFileName + BaseBundle.sSuffixName);
            string tcheckfile = GetCheckFileName();
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, tcheckfile);

            if (!useCache || !File.Exists(tfilePath))
            {
                checkLoader = DownLoadManager.DownLoadFileAsync(tuf, GameCore.PersistentResDataPath, tcheckfile, null, 0, null);
                while (!checkLoader.IsDone)
                {
                    yield return(null);
                }
                DownLoadCheckFileEnd(checkLoader, onComplete, useCache, needRetry);
            }
            else
            {
                DownLoadCheckFileFinished(onComplete);
            }
        }
        IEnumerator CheckingUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
        {
            ReleaseCheckLoader();

            string tdicpath   = string.Format("{0}/{1}/", updateData.server, updateData.version);
            string tuf        = GetServerUrl(LoadManager.byteFileInfoFileName + LoadManager.sSuffixName);
            string tcheckfile = GetCheckFileName();
            string tfilePath  = CombinePath(LoadManager.sidePath, tcheckfile);

            if (!useCache || !File.Exists(tfilePath))
            {
                checkLoader = DownLoadManager.DownLoadFileAsync(tuf, LoadManager.sidePath, tcheckfile, null, 0, null);
                while (!checkLoader.IsDone)
                {
                    yield return(null);
                }
                DownLoadCheckFileEnd(checkLoader, onComplete, useCache, needRetry);
            }
            else
            {
                DownLoadCheckFileFinished(onComplete);
            }
        }
示例#9
0
        public async override void OnShow()
        {
            base.OnShow();
            HFLog.C("页面完全显示");
            HFFramework.HotFixManager.Instance.ExecuteHotFix("hotfixdll", "HotFix");

            /*
             * AssetManager.Instance.RefCount();
             *
             * AssetManager.Instance.GetSprite("texture", "123");
             *
             * AssetManager.Instance.RefCount();
             * AssetManager.Instance.UnloadUnusedAssetBundle();
             *
             * Material mat = AssetManager.Instance.GetAsset<Material>("mat", "mat");
             * HFLog.C(mat);
             * mat.name = "12";
             *
             * AssetPackage ap = AssetManager.Instance.GetAssetBundle("mat");
             * Material mat1 =  ap.assetBundle.LoadAsset<Material>("mat");
             * HFLog.C(mat1);
             *
             * mat1 = GameObject.Instantiate(mat);
             *
             * HFLog.C(mat == mat1);
             * HFLog.C(mat1.name);
             *
             * GameObject g = GameObject.CreatePrimitive(PrimitiveType.Cube);
             * g.GetComponent<MeshRenderer>().material = mat;
             * mat.color = Color.red;
             *
             * GameObject g1 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
             * g1.GetComponent<MeshRenderer>().material = mat1;
             */


            //AssetManager.Instance.GetAssetAsync<Sprite>("texture", "123");


            //AssetManager.Instance.GetAssetAsync<Sprite>("texture", "123");

            /*
             * FileStream fs = new FileStream(Application.dataPath+ "/1.bin", FileMode.Create);
             * BinaryFormatter ff =  new BinaryFormatter();
             * ff.Serialize(fs, ConfigAddress.Instance);
             * fs.Close();
             *
             * fs = new FileStream(Application.dataPath + "/1.bin", FileMode.Open);
             * ff = new BinaryFormatter();
             * ConfigAddress ss = ff.Deserialize(fs) as ConfigAddress ;
             * Debug.Log(ss);
             *
             * await UIManager.Instance.Close<FunctionController>();
             * AssetManager.Instance.RefCount();
             * AssetManager.Instance.UnloadUnusedAssetBundle();
             */

            return;

            TimerManager.Schedule(1, 5, -1, delegate(Timer timer)
            {
                HFFramework.HotFixManager.Instance.executor.Invoke("HotFixEnter", "Test", null, "1", "2", "3");
            });

            DownLoader  loader   = DownLoadManager.Instance.GetDownLoader();
            string      url      = "http://182.48.99.226:18080/SharedFiles/Res/Assetbundles/Android_Assetbundles/ABVersion.Json";
            string      diskPath = PathManager.Instance.PersistentDataCustomPath + "/ABVersion.Json";
            UrlDiskPath path     = new UrlDiskPath(url, diskPath);

            loader.DownLoadFiles(new UrlDiskPath[] { path }, DownComp, ProgressCallback, Fail);
        }
示例#10
0
 void DownloadProcess(DownLoader pSender)
 {
     Debug.Log(pSender.Progress);
 }
示例#11
0
 void DownloadComplete(DownLoader pSender)
 {
     Debug.Log("DownloadComplete-" + pSender.CompleteFile + " - error:" + pSender.Error);
 }