Esempio n. 1
0
        protected virtual UnityWebRequest CreateUnityWebRequest <T>(IUploadWebRequest <T> request) where T : WebResult, new()
        {
            var requestUrl      = $"{ServerUrl}/{request.Url}";
            var unityWebRequest = UnityWebRequest.Post(requestUrl, request.PostForm);

            Debug.Log($"{unityWebRequest.method}: {requestUrl}");
            return(unityWebRequest);
        }
Esempio n. 2
0
        public void Send <T>(IUploadWebRequest <T> request, Action <T> onResult = null) where T : WebResult, new()
        {
            var unityWebRequest = CreateUnityWebRequest(request);

            CoroutineUtility.Start(SendRequest(unityWebRequest, () =>
            {
                var result = new T();
                result.SetUnityWebRequest(unityWebRequest);
                onResult?.Invoke(result);
            }));
        }