diff --git a/Assets/QFramework/Example/ResKitExample/SpriteAtlas/TestSpriteAtlas.cs b/Assets/QFramework/Example/ResKitExample/SpriteAtlas/TestSpriteAtlas.cs index 4dd39560c..56b4d9ca0 100755 --- a/Assets/QFramework/Example/ResKitExample/SpriteAtlas/TestSpriteAtlas.cs +++ b/Assets/QFramework/Example/ResKitExample/SpriteAtlas/TestSpriteAtlas.cs @@ -37,24 +37,26 @@ namespace QFramework public class TestSpriteAtlas : MonoBehaviour { [SerializeField] private Image mImage; - + // Use this for initialization private IEnumerator Start() { var loader = ResLoader.Allocate(); - + ResMgr.Init(); +#if UNITY_2017_1_OR_NEWER var spriteAtlas = loader.LoadSync("spriteatlas"); var square = spriteAtlas.GetSprite("Square"); Log.I(spriteAtlas.spriteCount); mImage.sprite = square; - +#endif + yield return new WaitForSeconds(5.0f); - + loader.Recycle2Cache(); loader = null; } } -} +} \ No newline at end of file diff --git a/Assets/QFramework/Framework/0.Core/8.CrossPlatformAPI/UnityAPI.cs b/Assets/QFramework/Framework/0.Core/8.CrossPlatformAPI/UnityAPI.cs index dae4df723..580205f25 100644 --- a/Assets/QFramework/Framework/0.Core/8.CrossPlatformAPI/UnityAPI.cs +++ b/Assets/QFramework/Framework/0.Core/8.CrossPlatformAPI/UnityAPI.cs @@ -17,7 +17,8 @@ public IDisposable HttpGet(string url, Dictionary headers, Actio return ObservableWWW.Get(url, headers).Subscribe(onResponse); } - public IDisposable HttpPost(string url, Dictionary headers, Dictionary form, Action onResponse) + public IDisposable HttpPost(string url, Dictionary headers, Dictionary form, + Action onResponse) { var wwwForm = new WWWForm(); @@ -42,7 +43,7 @@ public IDisposable HttpPatch(string url, Dictionary headers, contentDict.ForEach((key, value) => { jsonForm[key] = value; }); var content = new ByteArrayContent(Encoding.UTF8.GetBytes(jsonForm.ToString()), "application/json"); - + httpClient.Patch(new Uri(url), content, (responseContent) => { onResponse(responseContent.Data); }); return Disposable.Create(() => httpClient.Abort()); @@ -57,9 +58,15 @@ public IDisposable HttpDelete(string url, Dictionary headers, Ac headers.ForEach((k, v) => { request.SetRequestHeader(k, v); }); } +#if UNITY_2017_1_OR_NEWER return request.SendWebRequest() .AsAsyncOperationObservable() - .Subscribe(operation => { onResponse.Invoke(); });; + .Subscribe(operation => { onResponse.Invoke(); }); +#else + return request.Send() + .AsAsyncOperationObservable() + .Subscribe(operation => { onResponse.Invoke(); }); +#endif } } }