示例#1
0
        private IEnumerator _webGet(string url, Dictionary <string, string> info, CallBack_None_Params_String handler)
        {
            UnityWebRequest _get = UnityWebRequest.Get(AppendUrl(url, info));

            yield return(_get.Send());

            if (_get.isError)
            {
                Debug.Log(_get.error);
            }
            else
            {
                if (handler != null)
                {
                    handler(_get.downloadHandler.text);
                }
            }
        }
示例#2
0
        private IEnumerator _webPost(string url, Dictionary <string, string> info, CallBack_None_Params_String handler)
        {
            UnityWebRequest _post = new UnityWebRequest(url, "POST");

            _post.downloadHandler = new DownloadHandlerBuffer();
            _post.uploadHandler   = new UploadHandlerRaw(Encoding.Default.GetBytes(LitJson.JsonMapper.ToJson(info)));
            _post.SetRequestHeader("Content-Type", "application/json");

            yield return(_post.Send());

            if (_post.isError)
            {
                Debug.Log(_post.error);
            }
            else
            {
                if (handler != null)
                {
                    handler(_post.downloadHandler.text);
                }
            }
        }
示例#3
0
//		Web Post
        public void WebPost(string url, Dictionary <string, string> info, CallBack_None_Params_String handler)
        {
            CoroutineBehaviour.StartCoroutine(_webPost(url, info, handler));
        }