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); }
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); })); }