com.xmobitea.changx.gn-unity 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/GNServerSettingsEditor.cs +27 -23
- package/Runtime/Common/GNArray.cs +302 -302
- package/Runtime/Common/GNArray.cs.meta +11 -11
- package/Runtime/Common/GNData.cs +48 -48
- package/Runtime/Common/GNData.cs.meta +11 -11
- package/Runtime/Common/GNHashtable.cs +241 -241
- package/Runtime/Common/GNHashtable.cs.meta +11 -11
- package/Runtime/Common/IGNData.cs +11 -11
- package/Runtime/Common/IGNData.cs.meta +11 -11
- package/Runtime/Common.meta +8 -8
- package/Runtime/Config/GNServerSettings.cs.meta +11 -11
- package/Runtime/Config.meta +8 -8
- package/Runtime/Constant/Commands.cs.meta +11 -11
- package/Runtime/Constant/EnumType/FriendStatus.cs +12 -12
- package/Runtime/Constant/EnumType/FriendStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/GoogleLoginType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/GroupStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/InvalidMemberType.cs +23 -23
- package/Runtime/Constant/EnumType/InvalidMemberType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/ItemType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/OwnerType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/PermissionDataItem.cs +10 -10
- package/Runtime/Constant/EnumType/PermissionDataItem.cs.meta +11 -11
- package/Runtime/Constant/EnumType/RequestRole.cs +11 -11
- package/Runtime/Constant/EnumType/RequestRole.cs.meta +7 -7
- package/Runtime/Constant/EnumType/RequestType.cs +19 -19
- package/Runtime/Constant/EnumType/RequestType.cs.meta +11 -11
- package/Runtime/Constant/EnumType.meta +8 -8
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs.meta +7 -7
- package/Runtime/Constant/ErrorCode.meta +8 -8
- package/Runtime/Constant/EventCode.cs +16 -16
- package/Runtime/Constant/EventCode.cs.meta +11 -11
- package/Runtime/Constant/OperationCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode/ParameterCode.cs +12 -12
- package/Runtime/Constant/ParameterCode/ParameterCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode.meta +8 -8
- package/Runtime/Constant/ReturnCode.cs +25 -25
- package/Runtime/Constant/ReturnCode.cs.meta +11 -11
- package/Runtime/Constant.meta +8 -8
- package/Runtime/Entity/DataMember.cs +124 -124
- package/Runtime/Entity/DataMember.cs.meta +11 -11
- package/Runtime/Entity/GNMetadata.cs +27 -27
- package/Runtime/Entity/GNMetadata.cs.meta +11 -11
- package/Runtime/Entity/InvalidMember.cs +33 -33
- package/Runtime/Entity/InvalidMember.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GenericModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +49 -49
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models.meta +8 -8
- package/Runtime/Entity/OperationEvent.cs +75 -75
- package/Runtime/Entity/OperationEvent.cs.meta +11 -11
- package/Runtime/Entity/OperationHelper.cs +35 -35
- package/Runtime/Entity/OperationHelper.cs.meta +11 -11
- package/Runtime/Entity/OperationRequest.cs +99 -99
- package/Runtime/Entity/OperationRequest.cs.meta +11 -11
- package/Runtime/Entity/OperationResponse.cs.meta +11 -11
- package/Runtime/Entity/Request/CustomOperationRequest.cs +61 -61
- package/Runtime/Entity/Request/CustomOperationRequest.cs.meta +11 -11
- package/Runtime/Entity/Request.meta +8 -8
- package/Runtime/Entity/Response/CustomOperationResponse.cs +63 -63
- package/Runtime/Entity/Response/CustomOperationResponse.cs.meta +11 -11
- package/Runtime/Entity/Response.meta +8 -8
- package/Runtime/Entity.meta +8 -8
- package/Runtime/GNNetwork.cs +182 -184
- package/Runtime/GNNetwork.cs.meta +11 -11
- package/Runtime/GNNetworkApi.cs +19 -26
- package/Runtime/GNNetworkApi.cs.meta +11 -11
- package/Runtime/GNNetworkAuthenticateApi.cs.meta +11 -11
- package/Runtime/GNNetworkCharacterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkContentApi.cs.meta +11 -11
- package/Runtime/GNNetworkDashboardApi.cs.meta +11 -11
- package/Runtime/GNNetworkGamePlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkGroupApi.cs.meta +11 -11
- package/Runtime/GNNetworkInventoryApi.cs.meta +11 -11
- package/Runtime/GNNetworkMasterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkStoreInventoryApi.cs.meta +11 -11
- package/Runtime/Helper/CodeHelper.cs +97 -97
- package/Runtime/Helper/CodeHelper.cs.meta +11 -11
- package/Runtime/Helper/ConverterService.cs +12 -22
- package/Runtime/Helper/ConverterService.cs.meta +11 -11
- package/Runtime/Helper/ParseGNHelper.cs +451 -451
- package/Runtime/Helper/ParseGNHelper.cs.meta +11 -11
- package/Runtime/Helper.meta +8 -8
- package/Runtime/Logger/GNDebug.cs +49 -49
- package/Runtime/Logger/GNDebug.cs.meta +11 -11
- package/Runtime/Logger.meta +8 -8
- package/Runtime/Networking/AuthenticateStatus.cs +35 -35
- package/Runtime/Networking/AuthenticateStatus.cs.meta +11 -11
- package/Runtime/Networking/Handler/IServerEventHandler.cs +25 -25
- package/Runtime/Networking/Handler/IServerEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +32 -32
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +33 -33
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +32 -32
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +32 -32
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +29 -29
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +29 -29
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler.meta +8 -8
- package/Runtime/Networking/Http/HttpPeer.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +25 -25
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +486 -486
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +142 -142
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +188 -192
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs.meta +11 -11
- package/Runtime/Networking/Http.meta +8 -8
- package/Runtime/Networking/IPeer.cs +19 -19
- package/Runtime/Networking/IPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeer.cs +144 -144
- package/Runtime/Networking/NetworkingPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeerAPI.cs.meta +11 -11
- package/Runtime/Networking/OperationPending.cs +95 -95
- package/Runtime/Networking/OperationPending.cs.meta +11 -11
- package/Runtime/Networking/PeerBase.cs +242 -242
- package/Runtime/Networking/PeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +185 -183
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +177 -175
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/SocketPeer.cs +197 -191
- package/Runtime/Networking/Socket/SocketPeer.cs.meta +11 -11
- package/Runtime/Networking/Socket.meta +8 -8
- package/Runtime/Networking.meta +8 -8
- package/Runtime/Unity/ServiceUpdate.cs +20 -20
- package/Runtime/Unity/ServiceUpdate.cs.meta +11 -11
- package/Runtime/Unity.meta +8 -8
- package/Runtime/XmobiTea.GN.runtime.asmdef +16 -16
- package/Runtime/XmobiTea.GN.runtime.asmdef.meta +7 -7
- package/package.json +1 -1
|
@@ -1,192 +1,188 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking.Http
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections;
|
|
5
|
-
using System.Text;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
using UnityEngine.Networking;
|
|
8
|
-
using XmobiTea.GN.Common;
|
|
9
|
-
using XmobiTea.GN.Constant;
|
|
10
|
-
using XmobiTea.GN.Helper;
|
|
11
|
-
using XmobiTea.MsgPack;
|
|
12
|
-
|
|
13
|
-
class
|
|
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
|
-
unityWebRequest.
|
|
48
|
-
|
|
49
|
-
unityWebRequest.
|
|
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
|
-
unityWebRequest.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
unityWebRequest.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
unityWebRequest.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
}
|
|
1
|
+
namespace XmobiTea.GN.Networking.Http
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
using System.Text;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
using UnityEngine.Networking;
|
|
8
|
+
using XmobiTea.GN.Common;
|
|
9
|
+
using XmobiTea.GN.Constant;
|
|
10
|
+
using XmobiTea.GN.Helper;
|
|
11
|
+
using XmobiTea.MsgPack;
|
|
12
|
+
|
|
13
|
+
internal class NetworkingPeerUnityWebRequest : NetworkingHttpPeerBase
|
|
14
|
+
{
|
|
15
|
+
class AcceptAllCertificatesSignedWithASpecificKeyPublicKey : CertificateHandler
|
|
16
|
+
{
|
|
17
|
+
protected override bool ValidateCertificate(byte[] certificateData)
|
|
18
|
+
{
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private MonoBehaviour unityMonoBehaviour;
|
|
24
|
+
|
|
25
|
+
public override void getRequest(string subUri, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey)
|
|
26
|
+
{
|
|
27
|
+
this.unityMonoBehaviour.StartCoroutine(this.ieGetRequestViaUnityWebRequest(subUri, onHttpAppResponse, timeout, authToken, secretKey));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public override void postRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags)
|
|
31
|
+
{
|
|
32
|
+
this.unityMonoBehaviour.StartCoroutine(this.iePostRequestViaUnityWebRequest(subUri, param, postType, onHttpAppResponse, timeout, authToken, secretKey, customTags));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public override void postRequestUpload(string subUri, byte[] content, string mimetype, Action<HttpAppResponse> onHttpAppResponse, float timeout)
|
|
36
|
+
{
|
|
37
|
+
this.unityMonoBehaviour.StartCoroutine(this.iePostRequestUploadViaUnityWebRequest(subUri, content, mimetype, onHttpAppResponse, timeout));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private IEnumerator ieGetRequestViaUnityWebRequest(string subUri, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey)
|
|
41
|
+
{
|
|
42
|
+
using (var unityWebRequest = UnityWebRequest.Get(new Uri(this.httpUrl + "/" + subUri)))
|
|
43
|
+
{
|
|
44
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
45
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
46
|
+
|
|
47
|
+
unityWebRequest.timeout = (int)timeout;
|
|
48
|
+
|
|
49
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
50
|
+
if (!string.IsNullOrEmpty(secretKey)) unityWebRequest.SetRequestHeader(Commands.RequestSecretCmd, secretKey);
|
|
51
|
+
//unityWebRequest.SetRequestHeader("User-Agent", userAgent);
|
|
52
|
+
|
|
53
|
+
yield return unityWebRequest.SendWebRequest();
|
|
54
|
+
|
|
55
|
+
certificateHandler.Dispose();
|
|
56
|
+
|
|
57
|
+
var httpAppResponse = new HttpAppResponse();
|
|
58
|
+
httpAppResponse.statusCode = unityWebRequest.responseCode;
|
|
59
|
+
|
|
60
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError
|
|
61
|
+
|| unityWebRequest.result == UnityWebRequest.Result.ProtocolError
|
|
62
|
+
|| unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
63
|
+
{
|
|
64
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
{
|
|
68
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
69
|
+
httpAppResponse.data = downloadHandler.data;
|
|
70
|
+
httpAppResponse.text = downloadHandler.text;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private IEnumerator iePostRequestViaUnityWebRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags)
|
|
78
|
+
{
|
|
79
|
+
using (var unityWebRequest = new UnityWebRequest(new Uri(this.httpUrl + "/" + subUri)))
|
|
80
|
+
{
|
|
81
|
+
unityWebRequest.method = UnityWebRequest.kHttpVerbPOST;
|
|
82
|
+
|
|
83
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
84
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
85
|
+
|
|
86
|
+
unityWebRequest.timeout = (int)timeout;
|
|
87
|
+
|
|
88
|
+
if (param == null) param = new GNHashtable();
|
|
89
|
+
if (customTags != null) param.add(GNParameterCode.CustomTags, customTags);
|
|
90
|
+
|
|
91
|
+
//unityWebRequest.SetRequestHeader("User-Agent", userAgent);
|
|
92
|
+
|
|
93
|
+
if (postType == PostType.Json)
|
|
94
|
+
{
|
|
95
|
+
unityWebRequest.SetRequestHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
|
|
96
|
+
|
|
97
|
+
var content = Encoding.UTF8.GetBytes(Serializer.Serialize(param.toData()));
|
|
98
|
+
|
|
99
|
+
unityWebRequest.uploadHandler = new UploadHandlerRaw(content);
|
|
100
|
+
}
|
|
101
|
+
else if (postType == PostType.MsgPack)
|
|
102
|
+
{
|
|
103
|
+
unityWebRequest.SetRequestHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
|
|
104
|
+
|
|
105
|
+
var dataSend = param.toData();
|
|
106
|
+
|
|
107
|
+
var content = MsgPackSerializer.Serialize(dataSend);
|
|
108
|
+
|
|
109
|
+
unityWebRequest.uploadHandler = new UploadHandlerRaw(content);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
unityWebRequest.downloadHandler = new DownloadHandlerBuffer();
|
|
113
|
+
|
|
114
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
115
|
+
if (!string.IsNullOrEmpty(secretKey)) unityWebRequest.SetRequestHeader(Commands.RequestSecretCmd, secretKey);
|
|
116
|
+
|
|
117
|
+
yield return unityWebRequest.SendWebRequest();
|
|
118
|
+
|
|
119
|
+
certificateHandler.Dispose();
|
|
120
|
+
|
|
121
|
+
var httpAppResponse = new HttpAppResponse();
|
|
122
|
+
httpAppResponse.statusCode = unityWebRequest.responseCode;
|
|
123
|
+
|
|
124
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError
|
|
125
|
+
|| unityWebRequest.result == UnityWebRequest.Result.ProtocolError
|
|
126
|
+
|| unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
127
|
+
{
|
|
128
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
{
|
|
132
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
133
|
+
httpAppResponse.data = downloadHandler.data;
|
|
134
|
+
httpAppResponse.text = downloadHandler.text;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private IEnumerator iePostRequestUploadViaUnityWebRequest(string subUri, byte[] content, string mimetype, Action<HttpAppResponse> onHttpAppResponse, float timeout)
|
|
142
|
+
{
|
|
143
|
+
var form = new UnityEngine.WWWForm();
|
|
144
|
+
form.AddBinaryData(Commands.File, content, null, mimetype);
|
|
145
|
+
|
|
146
|
+
using (var unityWebRequest = UnityWebRequest.Post(new Uri(this.httpUrl + "/" + subUri), form))
|
|
147
|
+
{
|
|
148
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
149
|
+
|
|
150
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
151
|
+
|
|
152
|
+
unityWebRequest.timeout = (int)timeout;
|
|
153
|
+
|
|
154
|
+
var authToken = GNNetwork.getAuthenticateStatus().getAuthToken();
|
|
155
|
+
|
|
156
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
157
|
+
|
|
158
|
+
yield return unityWebRequest.SendWebRequest();
|
|
159
|
+
|
|
160
|
+
certificateHandler.Dispose();
|
|
161
|
+
|
|
162
|
+
var httpAppResponse = new HttpAppResponse();
|
|
163
|
+
httpAppResponse.statusCode = unityWebRequest.responseCode;
|
|
164
|
+
|
|
165
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError
|
|
166
|
+
|| unityWebRequest.result == UnityWebRequest.Result.ProtocolError
|
|
167
|
+
|| unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
168
|
+
{
|
|
169
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
{
|
|
173
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
174
|
+
httpAppResponse.data = downloadHandler.data;
|
|
175
|
+
httpAppResponse.text = downloadHandler.text;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public NetworkingPeerUnityWebRequest()
|
|
183
|
+
{
|
|
184
|
+
this.unityMonoBehaviour = new GameObject("[GN] UnityWebRequestSupport").AddComponent<MonoBehaviour>();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: dc5891aeed68b2f4da9ba6c00a8daa93
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: dc5891aeed68b2f4da9ba6c00a8daa93
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 508b36f536bb55146ad7c5069c61377d
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 508b36f536bb55146ad7c5069c61377d
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using XmobiTea.GN.Common;
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Entity;
|
|
7
|
-
|
|
8
|
-
internal interface IPeer
|
|
9
|
-
{
|
|
10
|
-
void initPeer();
|
|
11
|
-
|
|
12
|
-
void enqueue(RequestType requestType, RequestRole requestRole, OperationRequest operationRequest, Action<OperationResponse> onOperationResponse, string authToken, string secretKey, GNHashtable customTags);
|
|
13
|
-
|
|
14
|
-
bool isUsing();
|
|
15
|
-
|
|
16
|
-
void service();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
namespace XmobiTea.GN.Networking
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using XmobiTea.GN.Common;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
6
|
+
using XmobiTea.GN.Entity;
|
|
7
|
+
|
|
8
|
+
internal interface IPeer
|
|
9
|
+
{
|
|
10
|
+
void initPeer();
|
|
11
|
+
|
|
12
|
+
void enqueue(RequestType requestType, RequestRole requestRole, OperationRequest operationRequest, Action<OperationResponse> onOperationResponse, string authToken, string secretKey, GNHashtable customTags);
|
|
13
|
+
|
|
14
|
+
bool isUsing();
|
|
15
|
+
|
|
16
|
+
void service();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: ae20e7e7970e7724b9a595eb53b70866
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ae20e7e7970e7724b9a595eb53b70866
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|