Revize af50416b
Přidáno uživatelem Zuzana Káčereková před téměř 4 roky(ů)
Client/Client/Assets/Scripts/NetworkingManager.cs | ||
---|---|---|
15 | 15 |
StartCoroutine(Post(uri, XmlCommunication.Serialize(request))); |
16 | 16 |
|
17 | 17 |
// Mock response: |
18 |
StartCoroutine(Get(uri)); |
|
18 |
// StartCoroutine(Get(uri));
|
|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
public void StartGet() |
... | ... | |
23 | 23 |
StartCoroutine(Get(uri)); |
24 | 24 |
} |
25 | 25 |
|
26 |
public void StartWeatherGet(WeatherProvider weatherProvider, string uri) |
|
27 |
{ |
|
28 |
StartCoroutine(WeatherGet(weatherProvider, uri)); |
|
29 |
} |
|
30 |
|
|
26 | 31 |
IEnumerator Post(string uri, string toPost) |
27 | 32 |
{ |
28 | 33 |
Debug.Log("Uploading: " + toPost); |
... | ... | |
36 | 41 |
} |
37 | 42 |
else |
38 | 43 |
{ |
44 |
// Show results as text |
|
39 | 45 |
Debug.Log("Upload complete!"); |
46 |
|
|
47 |
var xml = www.downloadHandler.text; |
|
48 |
|
|
49 |
Debug.Log(xml); |
|
50 |
|
|
51 |
rushManager.SetResponse(XmlCommunication.Deserialize<Response>(xml)); |
|
52 |
|
|
53 |
Debug.Log("Response received!"); |
|
40 | 54 |
} |
41 | 55 |
} |
42 | 56 |
|
... | ... | |
60 | 74 |
} |
61 | 75 |
} |
62 | 76 |
|
77 |
IEnumerator WeatherGet(WeatherProvider weatherProvider, string uri) |
|
78 |
{ |
|
79 |
Debug.Log("Downloading weather..."); |
|
80 |
UnityWebRequest www = UnityWebRequest.Get(uri); |
|
81 |
www.certificateHandler = new AcceptAllCertificates(); |
|
82 |
yield return www.SendWebRequest(); |
|
83 |
|
|
84 |
if (www.isNetworkError || www.isHttpError) |
|
85 |
{ |
|
86 |
Debug.Log(www.error); |
|
87 |
} |
|
88 |
else |
|
89 |
{ |
|
90 |
// Show results as text |
|
91 |
var weather = www.downloadHandler.text; |
|
92 |
weatherProvider.LoadFromResponse(weather); |
|
93 |
Debug.Log(weather); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
63 | 97 |
public class AcceptAllCertificates : CertificateHandler |
64 | 98 |
{ |
65 | 99 |
protected override bool ValidateCertificate(byte[] certificateData) |
Také k dispozici: Unified diff
Re #8949 UI updates, bugfixes, com. finalized