0312 cdn请求改用UnityWebRequest
| | |
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AssetsVersion.txt");
|
| | | assetVerUrl = assetVersionUrl;
|
| | | Debug.Log("http地址:assetVersionUrl " + assetVersionUrl);
|
| | | HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
|
| | | HttpRequest.Instance.UnityWebRequestGet(assetVersionUrl, 5, OnGetAssetVersionFile);
|
| | | }
|
| | |
|
| | | private static void OnGetAssetVersionFile(bool _ok, string _result)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | |
|
| | | private static void BeginCheckAssets()
|
| | | {
|
| | | bool checkStream = true;
|
| | |
| | | using System.Net;
|
| | | using System.Text;
|
| | | using UnityEngine;
|
| | | using UnityEngine.Networking;
|
| | |
|
| | |
|
| | | public class HttpRequest : SingletonMonobehaviour<HttpRequest>
|
| | |
| | | HttpBehaviour.Create(_url, "GET", "", _contentType, _retry, _result);
|
| | | }
|
| | |
|
| | | public void UnityWebRequestGet(string _url, int timeout = 5, Action<bool, string> _result = null)
|
| | | {
|
| | | StartCoroutine(GetDataB(_url, timeout, _result));
|
| | | }
|
| | |
|
| | | IEnumerator GetDataB(string remoteURL, int timeout, Action<bool, string> _result = null)
|
| | | {
|
| | | UnityWebRequest request = UnityWebRequest.Get(remoteURL);
|
| | | request.timeout = timeout;
|
| | | yield return request.SendWebRequest();
|
| | |
|
| | | if (request.isDone)
|
| | | {
|
| | | if (request.result == UnityWebRequest.Result.Success)
|
| | | {
|
| | | _result(true, request.downloadHandler.text);
|
| | | }
|
| | | else
|
| | | {
|
| | | _result(false, request.result.ToString());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | static StringBuilder buffer = new StringBuilder();
|
| | | public static string HashtablaToString(IDictionary<string, string> parameters)
|
| | | {
|