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,32 +1,54 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Entity;
|
|
7
|
-
using XmobiTea.GN.Entity.Models;
|
|
8
|
-
using XmobiTea.GN.Helper;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
public
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
namespace XmobiTea.GN.Networking
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
6
|
+
using XmobiTea.GN.Entity;
|
|
7
|
+
using XmobiTea.GN.Entity.Models;
|
|
8
|
+
using XmobiTea.GN.Helper;
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a player's friend list in the game.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class GamePlayerFriendUpdate
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID (optional).
|
|
17
|
+
/// </summary>
|
|
18
|
+
[StringDataMember(code = GNParameterCode.CharacterId, isOptional = true)]
|
|
19
|
+
public string? characterId;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player friends associated with the game player.
|
|
23
|
+
/// </summary>
|
|
24
|
+
[GNArrayDataMember(code = GNParameterCode.PlayerFriends, elementCls = typeof(GenericModels.FriendItem))]
|
|
25
|
+
public List<GenericModels.FriendItem> playerFriends;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnGamePlayerFriendUpdate" event.
|
|
30
|
+
/// </summary>
|
|
31
|
+
public class OnGamePlayerFriendUpdateEventHandler : IServerEventHandler
|
|
32
|
+
{
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Event triggered when a game player's friend list is updated.
|
|
35
|
+
/// </summary>
|
|
36
|
+
public static Action<GamePlayerFriendUpdate> onUpdate;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the event code associated with this handler.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>The event code for "OnGamePlayerFriendUpdate".</returns>
|
|
42
|
+
public int getEventCode() => EventCode.OnGamePlayerFriendUpdate;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Handles the "OnGamePlayerFriendUpdate" operation event.
|
|
46
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="operationEvent">The operation event containing the parameters for the friend update.</param>
|
|
49
|
+
public void handle(OperationEvent operationEvent)
|
|
50
|
+
{
|
|
51
|
+
OnGamePlayerFriendUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GamePlayerFriendUpdate>(operationEvent.getParameters()));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 6ebcb4a8d827d194fb0be1fe4a2c20ce
|
|
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: 6ebcb4a8d827d194fb0be1fe4a2c20ce
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,32 +1,54 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Entity;
|
|
7
|
-
using XmobiTea.GN.Entity.Models;
|
|
8
|
-
using XmobiTea.GN.Helper;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
public
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
namespace XmobiTea.GN.Networking
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
6
|
+
using XmobiTea.GN.Entity;
|
|
7
|
+
using XmobiTea.GN.Entity.Models;
|
|
8
|
+
using XmobiTea.GN.Helper;
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a player's group list in the game.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class GamePlayerGroupUpdate
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID (optional).
|
|
17
|
+
/// </summary>
|
|
18
|
+
[StringDataMember(code = GNParameterCode.CharacterId, isOptional = true)]
|
|
19
|
+
public string? characterId;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player groups associated with the game player.
|
|
23
|
+
/// </summary>
|
|
24
|
+
[GNArrayDataMember(code = GNParameterCode.PlayerGroups, elementCls = typeof(GenericModels.GroupItem))]
|
|
25
|
+
public List<GenericModels.GroupItem> playerGroups;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnGamePlayerGroupUpdate" event.
|
|
30
|
+
/// </summary>
|
|
31
|
+
public class OnGamePlayerGroupUpdateEventHandler : IServerEventHandler
|
|
32
|
+
{
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Event triggered when a game player's group list is updated.
|
|
35
|
+
/// </summary>
|
|
36
|
+
public static Action<GamePlayerGroupUpdate> onUpdate;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the event code associated with this handler.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>The event code for "OnGamePlayerGroupUpdate".</returns>
|
|
42
|
+
public int getEventCode() => EventCode.OnGamePlayerGroupUpdate;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Handles the "OnGamePlayerGroupUpdate" operation event.
|
|
46
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="operationEvent">The operation event containing the parameters for the group update.</param>
|
|
49
|
+
public void handle(OperationEvent operationEvent)
|
|
50
|
+
{
|
|
51
|
+
OnGamePlayerGroupUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GamePlayerGroupUpdate>(operationEvent.getParameters()));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 35bf763818c1e5e4da0b46dc5edea865
|
|
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: 35bf763818c1e5e4da0b46dc5edea865
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Entity;
|
|
7
|
-
using XmobiTea.GN.Entity.Models;
|
|
8
|
-
using XmobiTea.GN.Helper;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
namespace XmobiTea.GN.Networking
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
6
|
+
using XmobiTea.GN.Entity;
|
|
7
|
+
using XmobiTea.GN.Entity.Models;
|
|
8
|
+
using XmobiTea.GN.Helper;
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating group members.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class GroupMemberUpdate
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A list of members associated with the group.
|
|
17
|
+
/// </summary>
|
|
18
|
+
[GNArrayDataMember(code = GNParameterCode.Members, elementCls = typeof(GenericModels.FriendItem))]
|
|
19
|
+
public List<GenericModels.MemberItem> members;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Handles the "OnGroupMemberUpdate" event.
|
|
24
|
+
/// </summary>
|
|
25
|
+
public class OnGroupMemberUpdateEventHandler : IServerEventHandler
|
|
26
|
+
{
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Event triggered when group members are updated.
|
|
29
|
+
/// </summary>
|
|
30
|
+
public static Action<GroupMemberUpdate> onUpdate;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the event code associated with this handler.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <returns>The event code for "OnGroupMemberUpdate".</returns>
|
|
36
|
+
public int getEventCode() => EventCode.OnGroupMemberUpdate;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Handles the "OnGroupMemberUpdate" operation event.
|
|
40
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
41
|
+
/// </summary>
|
|
42
|
+
/// <param name="operationEvent">The operation event containing the parameters for the group member update.</param>
|
|
43
|
+
public void handle(OperationEvent operationEvent)
|
|
44
|
+
{
|
|
45
|
+
OnGroupMemberUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GroupMemberUpdate>(operationEvent.getParameters()));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 35bac92c5f9be6e4291698e4b013d08d
|
|
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: 35bac92c5f9be6e4291698e4b013d08d
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Networking
|
|
2
|
-
{
|
|
3
|
-
using System;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Entity;
|
|
7
|
-
using XmobiTea.GN.Entity.Models;
|
|
8
|
-
using XmobiTea.GN.Helper;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
namespace XmobiTea.GN.Networking
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
6
|
+
using XmobiTea.GN.Entity;
|
|
7
|
+
using XmobiTea.GN.Entity.Models;
|
|
8
|
+
using XmobiTea.GN.Helper;
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents an update for group messages.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class GroupMessageUpdate
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A list of updated group messages.
|
|
17
|
+
/// </summary>
|
|
18
|
+
[GNArrayDataMember(code = GNParameterCode.GroupMessages, elementCls = typeof(GroupModels.GroupMessageResponseData))]
|
|
19
|
+
public List<GroupModels.GroupMessageResponseData> groupMessages;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Event handler for handling updates to group messages.
|
|
24
|
+
/// </summary>
|
|
25
|
+
public class OnGroupMessageUpdateEventHandler : IServerEventHandler
|
|
26
|
+
{
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// An action to be invoked when a group message update occurs.
|
|
29
|
+
/// </summary>
|
|
30
|
+
public static Action<GroupMessageUpdate> onUpdate;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the event code associated with the group message update.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <returns>The event code for group message updates.</returns>
|
|
36
|
+
public int getEventCode() => EventCode.OnGroupMessageUpdate;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Handles the group message update event.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <param name="operationEvent">The operation event containing the update data.</param>
|
|
42
|
+
public void handle(OperationEvent operationEvent)
|
|
43
|
+
{
|
|
44
|
+
OnGroupMessageUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GroupMessageUpdate>(operationEvent.getParameters()));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 5e54a29e89b138c40a34d6d9b37cb12e
|
|
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: 5e54a29e89b138c40a34d6d9b37cb12e
|
|
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: d780dff2517e3fd4196eada89d8e8b0d
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d780dff2517e3fd4196eada89d8e8b0d
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,67 +1,95 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Networking.Http
|
|
2
2
|
{
|
|
3
3
|
using System;
|
|
4
|
-
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
|
-
using XmobiTea.GN.Helper;
|
|
4
|
+
using System.Text;
|
|
7
5
|
using XmobiTea.GN.Common;
|
|
8
6
|
using XmobiTea.GN.Config;
|
|
9
|
-
using
|
|
10
|
-
using XmobiTea.
|
|
7
|
+
using XmobiTea.GN.Constant;
|
|
8
|
+
using XmobiTea.GN.Helper;
|
|
11
9
|
using XmobiTea.GN.Logger;
|
|
10
|
+
using XmobiTea.MsgPack;
|
|
12
11
|
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Represents the HTTP application response.
|
|
14
|
+
/// </summary>
|
|
13
15
|
public class HttpAppResponse
|
|
14
16
|
{
|
|
17
|
+
/// <summary>Gets or sets the HTTP status code.</summary>
|
|
15
18
|
public long statusCode { get; internal set; }
|
|
19
|
+
|
|
20
|
+
/// <summary>Gets or sets the error message, if any.</summary>
|
|
16
21
|
public string error { get; internal set; }
|
|
22
|
+
|
|
23
|
+
/// <summary>Gets or sets the response data in byte array format.</summary>
|
|
17
24
|
public byte[] data { get; internal set; }
|
|
25
|
+
|
|
26
|
+
/// <summary>Gets or sets the response text as a string.</summary>
|
|
18
27
|
public string text { get; internal set; }
|
|
19
28
|
|
|
29
|
+
/// <summary>
|
|
30
|
+
/// Checks if the response contains an error.
|
|
31
|
+
/// </summary>
|
|
32
|
+
/// <returns>True if there is an error; otherwise, false.</returns>
|
|
20
33
|
public bool hasError()
|
|
21
34
|
{
|
|
22
35
|
return this.error != null;
|
|
23
36
|
}
|
|
24
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Converts the HTTP response to a string for logging purposes.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>A string representation of the response.</returns>
|
|
25
42
|
public string toString()
|
|
26
43
|
{
|
|
27
44
|
var stringBuilder = new StringBuilder();
|
|
28
|
-
|
|
29
45
|
stringBuilder.Append(" StatusCode: " + this.statusCode);
|
|
30
46
|
if (!string.IsNullOrEmpty(this.error)) stringBuilder.Append(", <color=red>Error: " + this.error + "</color>");
|
|
31
47
|
stringBuilder.Append(", Text: " + this.text);
|
|
32
|
-
|
|
33
48
|
return stringBuilder.ToString();
|
|
34
49
|
}
|
|
35
50
|
|
|
51
|
+
/// <summary>
|
|
52
|
+
/// Returns a string representation of the HTTP response.
|
|
53
|
+
/// </summary>
|
|
54
|
+
/// <returns>A string representation of the HTTP response.</returns>
|
|
36
55
|
public override string ToString()
|
|
37
56
|
{
|
|
38
57
|
return this.toString();
|
|
39
58
|
}
|
|
40
59
|
}
|
|
41
60
|
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Enum representing the type of HTTP POST requests.
|
|
63
|
+
/// </summary>
|
|
42
64
|
public enum PostType
|
|
43
65
|
{
|
|
44
66
|
Json = 0,
|
|
45
67
|
MsgPack = 1,
|
|
46
68
|
}
|
|
47
69
|
|
|
70
|
+
/// <summary>
|
|
71
|
+
/// Class for managing HTTP peer connections and requests.
|
|
72
|
+
/// </summary>
|
|
48
73
|
internal class HttpPeer : PeerBase
|
|
49
74
|
{
|
|
50
75
|
private NetworkingHttpPeerBase networkingHttpPeerBase;
|
|
51
76
|
|
|
52
77
|
private const char JSON_CHAR_KNOWN = '[';
|
|
53
78
|
|
|
79
|
+
/// <summary>
|
|
80
|
+
/// Initializes the GN HTTP socket object.
|
|
81
|
+
/// </summary>
|
|
54
82
|
internal override void initGNSocketObject()
|
|
55
83
|
{
|
|
56
84
|
var gnServerSettings = GNNetwork.gnServerSettings;
|
|
57
85
|
if (gnServerSettings == null) throw new NullReferenceException("Where is GN Server Settings");
|
|
58
86
|
|
|
59
87
|
this.isUse = gnServerSettings.isUseHttp();
|
|
60
|
-
|
|
61
88
|
var httpRequestType = gnServerSettings.getHttpRequestType();
|
|
62
89
|
|
|
63
90
|
#if UNITY_USING_BEST_HTTP
|
|
64
|
-
if (httpRequestType == HttpRequestType.HTTPRequest) this.networkingHttpPeerBase = new NetworkingPeerHttpRequest();
|
|
91
|
+
if (httpRequestType == HttpRequestType.HTTPRequest) this.networkingHttpPeerBase = new NetworkingPeerHttpRequest();
|
|
92
|
+
else
|
|
65
93
|
#endif
|
|
66
94
|
if (httpRequestType == HttpRequestType.UnityWebRequest) this.networkingHttpPeerBase = new NetworkingPeerUnityWebRequest();
|
|
67
95
|
else if (httpRequestType == HttpRequestType.HttpWebRequest) this.networkingHttpPeerBase = new NetworkingPeerHttpWebRequest();
|
|
@@ -71,18 +99,20 @@
|
|
|
71
99
|
this.networkingHttpPeerBase.init(httpUrl, userAgent);
|
|
72
100
|
}
|
|
73
101
|
|
|
102
|
+
/// <summary>
|
|
103
|
+
/// Sends an operation request via HTTP.
|
|
104
|
+
/// </summary>
|
|
105
|
+
/// <param name="operationPending">The operation pending to be sent.</param>
|
|
74
106
|
internal override void send(OperationPending operationPending)
|
|
75
107
|
{
|
|
76
108
|
base.send(operationPending);
|
|
77
|
-
|
|
78
109
|
GNDebug.log("[GN Http SEND] " + operationPending.getOperationRequest().ToString());
|
|
79
110
|
|
|
80
111
|
var operationRequest = operationPending.getOperationRequest();
|
|
81
|
-
|
|
82
112
|
var authToken = operationPending.getAuthToken();
|
|
83
113
|
var secretKey = operationPending.getSecretKey();
|
|
114
|
+
var gameId = operationPending.getGameId();
|
|
84
115
|
var customTags = operationPending.getCustomTags();
|
|
85
|
-
|
|
86
116
|
var postType = !operationRequest.isEncrypted() ? PostType.Json : PostType.MsgPack;
|
|
87
117
|
|
|
88
118
|
var subUri = (postType == PostType.Json ? NetworkingPeer.API_JSON : NetworkingPeer.API_MSG_PACK) + "/" + operationRequest.getOperationCode() + "/" + (int)operationPending.getRequestType() + "/" + (int)operationPending.getRequestRole();
|
|
@@ -90,20 +120,24 @@
|
|
|
90
120
|
this.networkingHttpPeerBase.postRequest(subUri, operationRequest.getParameters(), postType, httpAppResponse =>
|
|
91
121
|
{
|
|
92
122
|
this.onSendOperationRequestResponse(operationPending, httpAppResponse);
|
|
93
|
-
}, operationRequest.getTimeout(), authToken, secretKey, customTags);
|
|
123
|
+
}, operationRequest.getTimeout(), authToken, secretKey, customTags, gameId);
|
|
94
124
|
}
|
|
95
125
|
|
|
126
|
+
/// <summary>
|
|
127
|
+
/// Handles the response of an operation request.
|
|
128
|
+
/// </summary>
|
|
129
|
+
/// <param name="operationPending">The pending operation.</param>
|
|
130
|
+
/// <param name="httpAppResponse">The HTTP application response received.</param>
|
|
96
131
|
void onSendOperationRequestResponse(OperationPending operationPending, HttpAppResponse httpAppResponse)
|
|
97
132
|
{
|
|
98
133
|
var operationRequest = operationPending.getOperationRequest();
|
|
99
134
|
var obj = new GNArray();
|
|
100
|
-
|
|
135
|
+
|
|
101
136
|
if (!httpAppResponse.hasError())
|
|
102
137
|
{
|
|
103
138
|
if (httpAppResponse.statusCode == 200)
|
|
104
139
|
{
|
|
105
140
|
var isEncrypted = false;
|
|
106
|
-
|
|
107
141
|
GNArray gnArray = null;
|
|
108
142
|
|
|
109
143
|
if (!string.IsNullOrEmpty(httpAppResponse.text))
|
|
@@ -150,31 +184,40 @@
|
|
|
150
184
|
this.onResponseHandler(obj, operationRequest.isEncrypted());
|
|
151
185
|
}
|
|
152
186
|
|
|
153
|
-
|
|
187
|
+
/// <summary>
|
|
188
|
+
/// Sends a GET request to the specified URI.
|
|
189
|
+
/// </summary>
|
|
190
|
+
/// <param name="subUri">The sub-URI for the request.</param>
|
|
191
|
+
/// <param name="onHttpAppResponse">Callback to handle the HTTP response.</param>
|
|
192
|
+
/// <param name="timeout">The timeout for the request, in seconds.</param>
|
|
193
|
+
/// <param name="authToken">Optional authentication token.</param>
|
|
194
|
+
/// <param name="secretKey">Optional secret key.</param>
|
|
195
|
+
internal void getRequest(string subUri, Action<HttpAppResponse> onHttpAppResponse, float timeout = 15, string authToken = null, string secretKey = null, string gameId = null)
|
|
154
196
|
{
|
|
155
|
-
this.networkingHttpPeerBase.getRequest(subUri, onHttpAppResponse, timeout, authToken, secretKey);
|
|
197
|
+
this.networkingHttpPeerBase.getRequest(subUri, onHttpAppResponse, timeout, authToken, secretKey, gameId);
|
|
156
198
|
}
|
|
157
199
|
|
|
200
|
+
/// <summary>
|
|
201
|
+
/// Uploads a file to the server.
|
|
202
|
+
/// </summary>
|
|
203
|
+
/// <param name="fileId">The ID of the file to upload.</param>
|
|
204
|
+
/// <param name="content">The content of the file as a byte array.</param>
|
|
205
|
+
/// <param name="mimetype">The MIME type of the file.</param>
|
|
206
|
+
/// <param name="onHttpAppResponse">Callback to handle the HTTP response.</param>
|
|
207
|
+
/// <param name="timeout">The timeout for the request, in seconds.</param>
|
|
158
208
|
internal void uploadFile(string fileId, byte[] content, string mimetype, Action<HttpAppResponse> onHttpAppResponse, float timeout = 60)
|
|
159
209
|
{
|
|
160
210
|
var authToken = GNNetwork.getAuthenticateStatus().getAuthToken();
|
|
161
211
|
|
|
162
212
|
if (string.IsNullOrEmpty(authToken))
|
|
163
213
|
{
|
|
164
|
-
var httpAppResponse = new HttpAppResponse
|
|
165
|
-
httpAppResponse.statusCode = 401;
|
|
166
|
-
httpAppResponse.error = "Auth token null";
|
|
167
|
-
|
|
214
|
+
var httpAppResponse = new HttpAppResponse { statusCode = 401, error = "Auth token null" };
|
|
168
215
|
onHttpAppResponse?.Invoke(httpAppResponse);
|
|
169
|
-
|
|
170
216
|
return;
|
|
171
217
|
}
|
|
172
218
|
|
|
173
219
|
var subUri = NetworkingPeer.UPLOAD_FILE + "/" + fileId;
|
|
174
|
-
|
|
175
220
|
this.networkingHttpPeerBase.postRequestUpload(subUri, content, mimetype, onHttpAppResponse, timeout);
|
|
176
221
|
}
|
|
177
|
-
|
|
178
222
|
}
|
|
179
|
-
|
|
180
223
|
}
|