com.xmobitea.changx.gn-unity 2.0.3 → 2.4.0
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 +16 -300
- package/Runtime/Common/GNArray.cs +387 -302
- package/Runtime/Common/GNArray.cs.meta +11 -11
- package/Runtime/Common/GNData.cs +61 -48
- package/Runtime/Common/GNData.cs.meta +11 -11
- package/Runtime/Common/GNHashtable.cs +404 -241
- package/Runtime/Common/GNHashtable.cs.meta +11 -11
- package/Runtime/Common/IGNData.cs +20 -11
- package/Runtime/Common/IGNData.cs.meta +11 -11
- package/Runtime/Common.meta +8 -8
- package/Runtime/Config/GNServerSettings.cs +136 -92
- package/Runtime/Config/GNServerSettings.cs.meta +11 -11
- package/Runtime/Config.meta +8 -8
- package/Runtime/Constant/Commands.cs +82 -19
- 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 +5 -5
- package/Runtime/Constant/EnumType/GoogleLoginType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
- 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 +5 -5
- package/Runtime/Constant/EnumType/ItemType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
- 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/PushPlatformType.cs +10 -0
- package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
- package/Runtime/Constant/EnumType/RequestRole.cs +11 -11
- package/Runtime/Constant/EnumType/RequestRole.cs.meta +7 -7
- package/Runtime/Constant/EnumType/RequestType.cs +20 -19
- package/Runtime/Constant/EnumType/RequestType.cs.meta +11 -11
- package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
- package/Runtime/Constant/EnumType.meta +8 -8
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs.meta +7 -7
- package/Runtime/Constant/ErrorCode.meta +8 -8
- package/Runtime/Constant/EventCode.cs +43 -16
- package/Runtime/Constant/EventCode.cs.meta +11 -11
- package/Runtime/Constant/OperationCode.cs +249 -211
- package/Runtime/Constant/OperationCode.cs.meta +11 -11
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs +614 -466
- 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 +73 -25
- package/Runtime/Constant/ReturnCode.cs.meta +11 -11
- package/Runtime/Constant.meta +8 -8
- package/Runtime/Entity/DataMember.cs +342 -124
- package/Runtime/Entity/DataMember.cs.meta +11 -11
- package/Runtime/Entity/GNMetadata.cs +72 -27
- package/Runtime/Entity/GNMetadata.cs.meta +11 -11
- package/Runtime/Entity/InvalidMember.cs +52 -33
- package/Runtime/Entity/InvalidMember.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
- package/Runtime/Entity/Models/AuthenticateModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
- package/Runtime/Entity/Models/CharacterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/CloudScriptModels.cs +185 -0
- package/Runtime/Entity/Models/CloudScriptModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs +134 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs +34 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentModels.cs +150 -153
- package/Runtime/Entity/Models/ContentModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentRequestModels.cs +129 -129
- package/Runtime/Entity/Models/ContentRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
- package/Runtime/Entity/Models/ContentResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
- package/Runtime/Entity/Models/DashboardModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
- package/Runtime/Entity/Models/DashboardRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
- package/Runtime/Entity/Models/DashboardResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
- package/Runtime/Entity/Models/GamePlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GenericModels.cs +102 -102
- package/Runtime/Entity/Models/GenericModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupModels.cs +812 -676
- package/Runtime/Entity/Models/GroupModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
- package/Runtime/Entity/Models/GroupRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
- package/Runtime/Entity/Models/GroupResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryModels.cs +667 -558
- package/Runtime/Entity/Models/InventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
- package/Runtime/Entity/Models/InventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
- package/Runtime/Entity/Models/InventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
- package/Runtime/Entity/Models/MasterPlayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
- package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +59 -49
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
- package/Runtime/Entity/Models/StoreInventoryModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs.meta +11 -11
- package/Runtime/Entity/Models.meta +8 -8
- package/Runtime/Entity/OperationEvent.cs +111 -75
- package/Runtime/Entity/OperationEvent.cs.meta +11 -11
- package/Runtime/Entity/OperationHelper.cs +51 -35
- package/Runtime/Entity/OperationHelper.cs.meta +11 -11
- package/Runtime/Entity/OperationRequest.cs +142 -99
- package/Runtime/Entity/OperationRequest.cs.meta +11 -11
- package/Runtime/Entity/OperationResponse.cs +111 -63
- package/Runtime/Entity/OperationResponse.cs.meta +11 -11
- package/Runtime/Entity/Request/CustomOperationRequest.cs +112 -61
- package/Runtime/Entity/Request/CustomOperationRequest.cs.meta +11 -11
- package/Runtime/Entity/Request.meta +8 -8
- package/Runtime/Entity/Response/CustomOperationResponse.cs +84 -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 +501 -182
- package/Runtime/GNNetwork.cs.meta +11 -11
- package/Runtime/GNNetworkApi.cs +38 -19
- package/Runtime/GNNetworkApi.cs.meta +11 -11
- package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
- package/Runtime/GNNetworkAuthenticateApi.cs.meta +11 -11
- package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
- package/Runtime/GNNetworkCharacterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
- package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
- package/Runtime/GNNetworkContentApi.cs +238 -132
- package/Runtime/GNNetworkContentApi.cs.meta +11 -11
- package/Runtime/GNNetworkDashboardApi.cs +278 -117
- package/Runtime/GNNetworkDashboardApi.cs.meta +11 -11
- package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
- package/Runtime/GNNetworkGamePlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkGroupApi.cs +1228 -582
- package/Runtime/GNNetworkGroupApi.cs.meta +11 -11
- package/Runtime/GNNetworkInventoryApi.cs +1048 -507
- package/Runtime/GNNetworkInventoryApi.cs.meta +11 -11
- package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
- package/Runtime/GNNetworkMasterPlayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
- package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -11
- package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
- package/Runtime/GNNetworkStoreInventoryApi.cs.meta +11 -11
- package/Runtime/Helper/CodeHelper.cs +140 -98
- package/Runtime/Helper/CodeHelper.cs.meta +11 -11
- package/Runtime/Helper/ConverterService.cs +236 -52
- 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 +92 -49
- package/Runtime/Logger/GNDebug.cs.meta +11 -11
- package/Runtime/Logger.meta +8 -8
- package/Runtime/Networking/AuthenticateStatus.cs +57 -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 +61 -32
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +54 -33
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +54 -32
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +54 -32
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +48 -29
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +47 -29
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs.meta +11 -11
- package/Runtime/Networking/Handler.meta +8 -8
- package/Runtime/Networking/Http/HttpPeer.cs +68 -25
- package/Runtime/Networking/Http/HttpPeer.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +65 -25
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +513 -486
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +172 -142
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs.meta +11 -11
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +225 -188
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs.meta +11 -11
- package/Runtime/Networking/Http.meta +8 -8
- package/Runtime/Networking/IPeer.cs +41 -19
- package/Runtime/Networking/IPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeer.cs +198 -144
- package/Runtime/Networking/NetworkingPeer.cs.meta +11 -11
- package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
- package/Runtime/Networking/NetworkingPeerAPI.cs.meta +11 -11
- package/Runtime/Networking/OperationPending.cs +159 -95
- package/Runtime/Networking/OperationPending.cs.meta +11 -11
- package/Runtime/Networking/PeerBase.cs +305 -242
- package/Runtime/Networking/PeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +222 -185
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +235 -177
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs.meta +11 -11
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs.meta +11 -11
- package/Runtime/Networking/Socket/SocketPeer.cs +242 -197
- 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/ServiceCoroutine.cs +10 -0
- package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
- package/Runtime/Unity/ServiceUpdate.cs +33 -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,188 +1,225 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking.Http
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections;
|
|
5
|
-
using System.Text;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
using
|
|
8
|
-
using XmobiTea.GN.
|
|
9
|
-
using XmobiTea.GN.
|
|
10
|
-
using XmobiTea.GN.
|
|
11
|
-
using XmobiTea.MsgPack;
|
|
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
|
-
unityWebRequest.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
unityWebRequest.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
certificateHandler
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
namespace XmobiTea.GN.Networking.Http
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
using System.Text;
|
|
6
|
+
using UnityEngine.Networking;
|
|
7
|
+
using XmobiTea.GN.Common;
|
|
8
|
+
using XmobiTea.GN.Constant;
|
|
9
|
+
using XmobiTea.GN.Helper;
|
|
10
|
+
using XmobiTea.GN.Unity;
|
|
11
|
+
using XmobiTea.MsgPack;
|
|
12
|
+
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Handles HTTP networking using UnityWebRequest.
|
|
15
|
+
/// </summary>
|
|
16
|
+
internal class NetworkingPeerUnityWebRequest : NetworkingHttpPeerBase
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// A certificate handler to accept all certificates.
|
|
20
|
+
/// Used for environments where certificates cannot be validated.
|
|
21
|
+
/// </summary>
|
|
22
|
+
class AcceptAllCertificatesSignedWithASpecificKeyPublicKey : CertificateHandler
|
|
23
|
+
{
|
|
24
|
+
protected override bool ValidateCertificate(byte[] certificateData)
|
|
25
|
+
{
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private UnityEngine.MonoBehaviour unityMonoBehaviour;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Sends a GET request using UnityWebRequest.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <param name="subUri">The sub-URI for the request.</param>
|
|
36
|
+
/// <param name="onHttpAppResponse">Callback to handle the HTTP response.</param>
|
|
37
|
+
/// <param name="timeout">Timeout for the request, in seconds.</param>
|
|
38
|
+
/// <param name="authToken">Optional authentication token.</param>
|
|
39
|
+
/// <param name="secretKey">Optional secret key.</param>
|
|
40
|
+
public override void getRequest(string subUri, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, string gameId)
|
|
41
|
+
{
|
|
42
|
+
this.unityMonoBehaviour.StartCoroutine(this.ieGetRequestViaUnityWebRequest(subUri, onHttpAppResponse, timeout, authToken, secretKey, gameId));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// Sends a POST request with specified parameters and content type using UnityWebRequest.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="subUri">The sub-URI for the request.</param>
|
|
49
|
+
/// <param name="param">The parameters to include in the request.</param>
|
|
50
|
+
/// <param name="postType">The type of POST request (e.g., JSON, MsgPack).</param>
|
|
51
|
+
/// <param name="onHttpAppResponse">Callback to handle the HTTP response.</param>
|
|
52
|
+
/// <param name="timeout">Timeout for the request, in seconds.</param>
|
|
53
|
+
/// <param name="authToken">Optional authentication token.</param>
|
|
54
|
+
/// <param name="secretKey">Optional secret key.</param>
|
|
55
|
+
/// <param name="customTags">Optional custom tags.</param>
|
|
56
|
+
public override void postRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags, string gameId)
|
|
57
|
+
{
|
|
58
|
+
this.unityMonoBehaviour.StartCoroutine(this.iePostRequestViaUnityWebRequest(subUri, param, postType, onHttpAppResponse, timeout, authToken, secretKey, customTags, gameId));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Sends a file upload request using UnityWebRequest.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="subUri">The sub-URI for the request.</param>
|
|
65
|
+
/// <param name="content">The file content to upload.</param>
|
|
66
|
+
/// <param name="mimetype">The MIME type of the file.</param>
|
|
67
|
+
/// <param name="onHttpAppResponse">Callback to handle the HTTP response.</param>
|
|
68
|
+
/// <param name="timeout">Timeout for the request, in seconds.</param>
|
|
69
|
+
public override void postRequestUpload(string subUri, byte[] content, string mimetype, Action<HttpAppResponse> onHttpAppResponse, float timeout)
|
|
70
|
+
{
|
|
71
|
+
this.unityMonoBehaviour.StartCoroutine(this.iePostRequestUploadViaUnityWebRequest(subUri, content, mimetype, onHttpAppResponse, timeout));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private IEnumerator ieGetRequestViaUnityWebRequest(string subUri, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, string gameId)
|
|
75
|
+
{
|
|
76
|
+
using (var unityWebRequest = UnityWebRequest.Get(new Uri(this.httpUrl + "/" + subUri)))
|
|
77
|
+
{
|
|
78
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
79
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
80
|
+
|
|
81
|
+
unityWebRequest.timeout = (int)timeout;
|
|
82
|
+
|
|
83
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
84
|
+
if (!string.IsNullOrEmpty(secretKey)) unityWebRequest.SetRequestHeader(Commands.RequestSecretCmd, secretKey);
|
|
85
|
+
if (!string.IsNullOrEmpty(gameId)) unityWebRequest.SetRequestHeader(Commands.RequestGameIdCmd, gameId);
|
|
86
|
+
|
|
87
|
+
yield return unityWebRequest.SendWebRequest();
|
|
88
|
+
|
|
89
|
+
certificateHandler.Dispose();
|
|
90
|
+
|
|
91
|
+
var httpAppResponse = new HttpAppResponse
|
|
92
|
+
{
|
|
93
|
+
statusCode = unityWebRequest.responseCode
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError ||
|
|
97
|
+
unityWebRequest.result == UnityWebRequest.Result.ProtocolError ||
|
|
98
|
+
unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
99
|
+
{
|
|
100
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
101
|
+
}
|
|
102
|
+
else
|
|
103
|
+
{
|
|
104
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
105
|
+
httpAppResponse.data = downloadHandler.data;
|
|
106
|
+
httpAppResponse.text = downloadHandler.text;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private IEnumerator iePostRequestViaUnityWebRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags, string gameId)
|
|
114
|
+
{
|
|
115
|
+
using (var unityWebRequest = new UnityWebRequest(new Uri(this.httpUrl + "/" + subUri)))
|
|
116
|
+
{
|
|
117
|
+
unityWebRequest.method = UnityWebRequest.kHttpVerbPOST;
|
|
118
|
+
|
|
119
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
120
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
121
|
+
|
|
122
|
+
unityWebRequest.timeout = (int)timeout;
|
|
123
|
+
|
|
124
|
+
if (param == null) param = new GNHashtable();
|
|
125
|
+
if (customTags != null) param.add(GNParameterCode.CustomTags, customTags);
|
|
126
|
+
|
|
127
|
+
if (postType == PostType.Json)
|
|
128
|
+
{
|
|
129
|
+
unityWebRequest.SetRequestHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
|
|
130
|
+
var content = Encoding.UTF8.GetBytes(Serializer.Serialize(param.toData()));
|
|
131
|
+
unityWebRequest.uploadHandler = new UploadHandlerRaw(content);
|
|
132
|
+
}
|
|
133
|
+
else if (postType == PostType.MsgPack)
|
|
134
|
+
{
|
|
135
|
+
unityWebRequest.SetRequestHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
|
|
136
|
+
var content = MsgPackSerializer.Serialize(param.toData());
|
|
137
|
+
unityWebRequest.uploadHandler = new UploadHandlerRaw(content);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
unityWebRequest.downloadHandler = new DownloadHandlerBuffer();
|
|
141
|
+
|
|
142
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
143
|
+
if (!string.IsNullOrEmpty(secretKey)) unityWebRequest.SetRequestHeader(Commands.RequestSecretCmd, secretKey);
|
|
144
|
+
if (!string.IsNullOrEmpty(gameId)) unityWebRequest.SetRequestHeader(Commands.RequestGameIdCmd, gameId);
|
|
145
|
+
|
|
146
|
+
yield return unityWebRequest.SendWebRequest();
|
|
147
|
+
|
|
148
|
+
certificateHandler.Dispose();
|
|
149
|
+
|
|
150
|
+
var httpAppResponse = new HttpAppResponse
|
|
151
|
+
{
|
|
152
|
+
statusCode = unityWebRequest.responseCode
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError ||
|
|
156
|
+
unityWebRequest.result == UnityWebRequest.Result.ProtocolError ||
|
|
157
|
+
unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
158
|
+
{
|
|
159
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
160
|
+
}
|
|
161
|
+
else
|
|
162
|
+
{
|
|
163
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
164
|
+
httpAppResponse.data = downloadHandler.data;
|
|
165
|
+
httpAppResponse.text = downloadHandler.text;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private IEnumerator iePostRequestUploadViaUnityWebRequest(string subUri, byte[] content, string mimetype, Action<HttpAppResponse> onHttpAppResponse, float timeout)
|
|
173
|
+
{
|
|
174
|
+
var form = new UnityEngine.WWWForm();
|
|
175
|
+
form.AddBinaryData(Commands.File, content, null, mimetype);
|
|
176
|
+
|
|
177
|
+
using (var unityWebRequest = UnityWebRequest.Post(new Uri(this.httpUrl + "/" + subUri), form))
|
|
178
|
+
{
|
|
179
|
+
var certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
|
|
180
|
+
|
|
181
|
+
unityWebRequest.certificateHandler = certificateHandler;
|
|
182
|
+
|
|
183
|
+
unityWebRequest.timeout = (int)timeout;
|
|
184
|
+
|
|
185
|
+
var authToken = GNNetwork.getAuthenticateStatus().getAuthToken();
|
|
186
|
+
|
|
187
|
+
if (!string.IsNullOrEmpty(authToken)) unityWebRequest.SetRequestHeader(Commands.RequestAuthTokenCmd, authToken);
|
|
188
|
+
|
|
189
|
+
yield return unityWebRequest.SendWebRequest();
|
|
190
|
+
|
|
191
|
+
certificateHandler.Dispose();
|
|
192
|
+
|
|
193
|
+
var httpAppResponse = new HttpAppResponse
|
|
194
|
+
{
|
|
195
|
+
statusCode = unityWebRequest.responseCode
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if (unityWebRequest.result == UnityWebRequest.Result.ConnectionError ||
|
|
199
|
+
unityWebRequest.result == UnityWebRequest.Result.ProtocolError ||
|
|
200
|
+
unityWebRequest.result == UnityWebRequest.Result.DataProcessingError)
|
|
201
|
+
{
|
|
202
|
+
httpAppResponse.error = unityWebRequest.error;
|
|
203
|
+
}
|
|
204
|
+
else
|
|
205
|
+
{
|
|
206
|
+
var downloadHandler = unityWebRequest.downloadHandler;
|
|
207
|
+
httpAppResponse.data = downloadHandler.data;
|
|
208
|
+
httpAppResponse.text = downloadHandler.text;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/// <summary>
|
|
216
|
+
/// Constructor initializes Unity MonoBehaviour for coroutines.
|
|
217
|
+
/// </summary>
|
|
218
|
+
public NetworkingPeerUnityWebRequest()
|
|
219
|
+
{
|
|
220
|
+
this.unityMonoBehaviour = new UnityEngine.GameObject("[GN] UnityWebRequestSupport").AddComponent<ServiceCoroutine>();
|
|
221
|
+
|
|
222
|
+
UnityEngine.GameObject.DontDestroyOnLoad(this.unityMonoBehaviour.gameObject);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -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,41 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
void
|
|
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
|
+
/// <summary>
|
|
9
|
+
/// Defines the interface for managing peer communication.
|
|
10
|
+
/// </summary>
|
|
11
|
+
internal interface IPeer
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Initializes the peer connection.
|
|
15
|
+
/// </summary>
|
|
16
|
+
void initPeer();
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// Enqueues a request to be sent to the server.
|
|
20
|
+
/// </summary>
|
|
21
|
+
/// <param name="requestType">The type of request to send.</param>
|
|
22
|
+
/// <param name="requestRole">The role associated with the request.</param>
|
|
23
|
+
/// <param name="operationRequest">The operation request object containing the request data.</param>
|
|
24
|
+
/// <param name="onOperationResponse">The callback invoked upon receiving a response.</param>
|
|
25
|
+
/// <param name="authToken">The authentication token to include with the request.</param>
|
|
26
|
+
/// <param name="secretKey">The secret key to include with the request, if applicable.</param>
|
|
27
|
+
/// <param name="customTags">Custom tags to be attached to the request.</param>
|
|
28
|
+
void enqueue(RequestType requestType, RequestRole requestRole, OperationRequest operationRequest, Action<OperationResponse> onOperationResponse, string authToken, string secretKey, GNHashtable customTags, string gameId);
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Checks whether the peer is currently in use.
|
|
32
|
+
/// </summary>
|
|
33
|
+
/// <returns>True if the peer is in use, otherwise false.</returns>
|
|
34
|
+
bool isUsing();
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Processes any pending requests or responses.
|
|
38
|
+
/// </summary>
|
|
39
|
+
void service();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -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:
|