Exemple #1
0
        private async Task loadStreamingABFiles()
        {
            string abFiles = AppSetting.StreamingAssetsURL + AppSetting.ABFiles;

            Debug.Log("StreamingABFiles" + abFiles);
            UnityWebRequest request = UnityWebRequest.Get(abFiles);
            await request.SendWebRequest();

            if (request.error == null)
            {
                string[] line = request.downloadHandler.text.Split('\n');
                streamingABRes = new ABResInfo(request.downloadHandler.text, true);
            }
        }
Exemple #2
0
        internal override async Task Initialize()
        {
            if (IsInitialize)
            {
                return;
            }
#if !UNITY_EDITOR
            string abFiles = AppSetting.PersistentDataURL + AppSetting.ABFiles;
            //Debug.Log("URL"+ abFiles);
            UnityWebRequest request = UnityWebRequest.Get(abFiles);
            await request.SendWebRequest();

            if (request.error == null)
            {
                string[] line = request.downloadHandler.text.Split('\n');
                persistentABRes = new ABResInfo(request.downloadHandler.text);
            }
            else
            {
                await loadStreamingABFiles();

                persistentABRes = streamingABRes;
            }
            if (persistentABRes == null)
            {
                return;
            }
            foreach (ABResFile file in persistentABRes.dicFileInfo.Values)
            {
                if (file.isStreaming)
                {
                    AssetBundleManager.assetBundleURL.Add(file.File, AppSetting.StreamingAssetsURL + file.File);
                }
                else
                {
                    AssetBundleManager.assetBundleURL.Add(file.File, AppSetting.PersistentDataURL + file.File);
                }
            }
#else
            await new WaitForEndOfFrame();
#endif
            IsInitialize = true;
            CLog.Log("初始化VersionMondule完成");
        }