-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoedleWebRequest.cs
101 lines (84 loc) · 2.74 KB
/
GoedleWebRequest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// ===============================
// AUTHOR : Marc Müller goedle.io GmbH
// CREATE DATE : 31.07.2018
// PURPOSE : Helping class to substitute the UnityWebRequest
//=================================
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using UnityEngineInternal;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
using UnityEngine;
using UnityEngine.Networking;
namespace goedle.detail {
public interface IGoedleWebRequest
{
bool isHttpError { get; }
bool isNetworkError { get; }
string url { get; set; }
long responseCode { get; }
string method { get; set; }
bool chunkedTransfer{ get; set; }
DownloadHandler downloadHandler { get; set; }
UploadHandler uploadHandler { get; set; }
UnityWebRequest unityWebRequest { get; set; }
UnityWebRequestAsyncOperation SendWebRequest();
void SetRequestHeader(string name, string value);
}
public class GoedleWebRequest : IGoedleWebRequest{
UnityWebRequest _unityWebRequest { get; set; }
public bool isNetworkError
{
get { return _unityWebRequest.isNetworkError; }
}
public bool isHttpError
{
get { return _unityWebRequest.isHttpError; }
}
public string url
{
get { return _unityWebRequest.url; }
set { _unityWebRequest.url = value; }
}
public string method
{
get { return _unityWebRequest.method; }
set { _unityWebRequest.method = value; }
}
public bool chunkedTransfer
{
get { return _unityWebRequest.chunkedTransfer; }
set { _unityWebRequest.chunkedTransfer = value; }
}
public UnityWebRequest unityWebRequest
{
get { return _unityWebRequest; }
set { _unityWebRequest = value; }
}
public DownloadHandler downloadHandler
{
get { return _unityWebRequest.downloadHandler; }
set { _unityWebRequest.downloadHandler = value; }
}
public UploadHandler uploadHandler
{
get { return _unityWebRequest.uploadHandler; }
set { _unityWebRequest.uploadHandler = value; }
}
public UnityWebRequestAsyncOperation SendWebRequest()
{
return _unityWebRequest.SendWebRequest();
}
public long responseCode
{
get { return _unityWebRequest.responseCode; }
}
public void SetRequestHeader(string name, string value)
{
_unityWebRequest.SetRequestHeader(name,value);
}
}
}