Пример #1
0
        private IEnumerator SendHTTPPost(string url, string logVersion, string jsonString)
        {
            var encoding = new UTF8Encoding().GetBytes(jsonString);

            var request = UnityWebRequest.Put(string.Format("{0}/{1}/log", url, logVersion), encoding);

            request.method = UnityWebRequest.kHttpVerbPOST;
            var helper = new UnityWebRequestHelper(request);

            yield return(EditorCoroutine.Start(helper.SendWebRequest()));
        }
Пример #2
0
        public void GetLaunchingInfo <T>(LaunchingConfigurations launchingConfigurations, Action <T> callback)
        {
            var request = UnityWebRequest.Get(
                string.Format("{0}/{1}/appkeys/{2}/configurations",
                              launchingConfigurations.uri,
                              launchingConfigurations.version,
                              launchingConfigurations.appKey));

            request.method = UnityWebRequest.kHttpVerbGET;

            var helper = new UnityWebRequestHelper(request);

            EditorCoroutine.Start(
                helper.SendWebRequest(
                    (result) =>
            {
                var launchingInfo = JsonUtility.FromJson <T>(result.downloadHandler.text);
                callback(launchingInfo);
            }));
        }