Пример #1
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);
        }
Пример #2
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);
        }