com.xmobitea.changx.gn-unity 2.0.0 → 2.0.1
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 +294 -294
- package/Runtime/Config/GNServerSettings.cs +5 -9
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs.meta +11 -11
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs.meta +11 -11
- package/Runtime/Entity/DataMember.cs +1 -1
- package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -11
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -11
- package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -11
- package/Runtime/Helper/ConverterService.cs +22 -12
- package/Runtime/Networking/Http/HttpPeer.cs +6 -2
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +473 -360
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +3 -68
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +5 -1
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Networking.Http
|
|
2
2
|
{
|
|
3
|
+
#if UNITY_USING_BEST_HTTP
|
|
4
|
+
|
|
3
5
|
using BestHTTP;
|
|
4
6
|
using System;
|
|
5
7
|
using System.IO;
|
|
@@ -124,73 +126,6 @@ namespace XmobiTea.GN.Networking.Http
|
|
|
124
126
|
request.Send();
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
//public override void postRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags)
|
|
128
|
-
//{
|
|
129
|
-
// postRequestViaHttpRequest(subUri, param, postType, onHttpAppResponse, timeout, authToken, secretKey, customTags);
|
|
130
|
-
//}
|
|
131
|
-
|
|
132
|
-
//public async void postRequestViaHttpRequest(string subUri, GNHashtable param, PostType postType, Action<HttpAppResponse> onHttpAppResponse, float timeout, string authToken, string secretKey, GNHashtable customTags)
|
|
133
|
-
//{
|
|
134
|
-
// try
|
|
135
|
-
// {
|
|
136
|
-
// var httpRequest = (System.Net.HttpWebRequest)WebRequest.Create(this.httpUrl + "/" + subUri);
|
|
137
|
-
// httpRequest.UserAgent = this.userAgent;
|
|
138
|
-
// httpRequest.SendChunked = false;
|
|
139
|
-
// // Prevents hitting a proxy if no proxy is available. TODO: Add support for proxy's.
|
|
140
|
-
// httpRequest.Proxy = null;
|
|
141
|
-
|
|
142
|
-
// if (!string.IsNullOrEmpty(authToken)) httpRequest.Headers.Add(Commands.RequestAuthTokenCmd, authToken);
|
|
143
|
-
// if (!string.IsNullOrEmpty(secretKey)) httpRequest.Headers.Add(Commands.RequestSecretCmd, secretKey);
|
|
144
|
-
|
|
145
|
-
// httpRequest.Method = "POST";
|
|
146
|
-
// httpRequest.KeepAlive = false;
|
|
147
|
-
// httpRequest.Timeout = (int)timeout;
|
|
148
|
-
// httpRequest.AllowWriteStreamBuffering = false;
|
|
149
|
-
// httpRequest.Proxy = null;
|
|
150
|
-
// httpRequest.ReadWriteTimeout = (int)timeout;
|
|
151
|
-
|
|
152
|
-
// if (postType == PostType.Json)
|
|
153
|
-
// {
|
|
154
|
-
// httpRequest.ContentType = Commands.APPLICATION_JSON;
|
|
155
|
-
|
|
156
|
-
// var dataSend = param.toData();
|
|
157
|
-
|
|
158
|
-
// var content = Encoding.UTF8.GetBytes(Serializer.Serialize(dataSend));
|
|
159
|
-
|
|
160
|
-
// httpRequest.ContentLength = content.LongLength;
|
|
161
|
-
|
|
162
|
-
// using (var stream = httpRequest.GetRequestStream())
|
|
163
|
-
// {
|
|
164
|
-
// stream.Write(content, 0, content.Length);
|
|
165
|
-
// }
|
|
166
|
-
// }
|
|
167
|
-
// else if (postType == PostType.MsgPack)
|
|
168
|
-
// {
|
|
169
|
-
// httpRequest.ContentType = Commands.APPLICATION_MSGPACK;
|
|
170
|
-
|
|
171
|
-
// var dataSend = param.toData();
|
|
172
|
-
|
|
173
|
-
// var content = MsgPackSerializer.Serialize(dataSend);
|
|
174
|
-
|
|
175
|
-
// httpRequest.ContentLength = content.LongLength;
|
|
176
|
-
|
|
177
|
-
// using (var stream = httpRequest.GetRequestStream())
|
|
178
|
-
// {
|
|
179
|
-
// stream.Write(content, 0, content.Length);
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
182
|
-
|
|
183
|
-
// var response = await httpRequest.GetResponseAsync();
|
|
184
|
-
|
|
185
|
-
// response.
|
|
186
|
-
// }
|
|
187
|
-
// catch (Exception e)
|
|
188
|
-
// {
|
|
189
|
-
|
|
190
|
-
// }
|
|
191
|
-
//}
|
|
192
|
-
|
|
193
|
-
|
|
194
129
|
public override void init(string httpUrl, string userAgent)
|
|
195
130
|
{
|
|
196
131
|
base.init(httpUrl, userAgent);
|
|
@@ -203,5 +138,5 @@ namespace XmobiTea.GN.Networking.Http
|
|
|
203
138
|
HTTPManager.KeepAliveDefaultValue = true;
|
|
204
139
|
}
|
|
205
140
|
}
|
|
206
|
-
|
|
141
|
+
#endif
|
|
207
142
|
}
|
|
@@ -10,6 +10,8 @@ namespace XmobiTea.GN.Networking.Http
|
|
|
10
10
|
using XmobiTea.GN.Helper;
|
|
11
11
|
using XmobiTea.MsgPack;
|
|
12
12
|
|
|
13
|
+
class UnityWebRequestSupportMono : MonoBehaviour { }
|
|
14
|
+
|
|
13
15
|
internal class NetworkingPeerUnityWebRequest : NetworkingHttpPeerBase
|
|
14
16
|
{
|
|
15
17
|
class AcceptAllCertificatesSignedWithASpecificKeyPublicKey : CertificateHandler
|
|
@@ -181,7 +183,9 @@ namespace XmobiTea.GN.Networking.Http
|
|
|
181
183
|
|
|
182
184
|
public NetworkingPeerUnityWebRequest()
|
|
183
185
|
{
|
|
184
|
-
|
|
186
|
+
var unityWebRequestSupport = new GameObject("[GN] UnityWebRequestSupport");
|
|
187
|
+
|
|
188
|
+
this.unityMonoBehaviour = unityWebRequestSupport.AddComponent<UnityWebRequestSupportMono>();
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
|