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,11 +1,13 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Entity
|
|
2
2
|
{
|
|
3
3
|
using System.Text;
|
|
4
|
-
|
|
5
|
-
using XmobiTea.GN.Constant;
|
|
6
4
|
using XmobiTea.GN.Common;
|
|
5
|
+
using XmobiTea.GN.Constant;
|
|
7
6
|
using XmobiTea.GN.Helper;
|
|
8
7
|
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Represents an operation response, encapsulating details such as operation code, return code, debug messages, and parameters.
|
|
10
|
+
/// </summary>
|
|
9
11
|
public class OperationResponse
|
|
10
12
|
{
|
|
11
13
|
private int operationCode;
|
|
@@ -17,6 +19,12 @@
|
|
|
17
19
|
|
|
18
20
|
private InvalidMember[] invalidMembers;
|
|
19
21
|
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Initializes a new instance of the <see cref="OperationResponse"/> class.
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <param name="operationCode">The operation code associated with the response.</param>
|
|
26
|
+
/// <param name="responseId">The response ID.</param>
|
|
27
|
+
/// <param name="encrypted">Indicates whether the response is encrypted.</param>
|
|
20
28
|
public OperationResponse(int operationCode, int responseId, bool encrypted = true)
|
|
21
29
|
{
|
|
22
30
|
this.operationCode = operationCode;
|
|
@@ -26,119 +34,159 @@
|
|
|
26
34
|
this.debugMessage = null;
|
|
27
35
|
}
|
|
28
36
|
|
|
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
|
-
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Gets the operation code of the response.
|
|
39
|
+
/// </summary>
|
|
40
|
+
public int getOperationCode() => this.operationCode;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Gets the return code of the response.
|
|
44
|
+
/// </summary>
|
|
45
|
+
public int getReturnCode() => this.returnCode;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Gets the parameters associated with the response.
|
|
49
|
+
/// </summary>
|
|
50
|
+
public GNHashtable getParameters() => this.parameters;
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Determines whether the response is encrypted.
|
|
54
|
+
/// </summary>
|
|
55
|
+
public bool isEncrypted() => this.encrypted;
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Gets the response ID of the operation.
|
|
59
|
+
/// </summary>
|
|
60
|
+
public int getResponseId() => this.responseId;
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Gets the debug message, if any.
|
|
64
|
+
/// </summary>
|
|
65
|
+
public string getDebugMessage() => this.debugMessage;
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// Gets the invalid members, if any, associated with the response.
|
|
69
|
+
/// </summary>
|
|
70
|
+
public InvalidMember[] getInvalidMembers() => this.invalidMembers;
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// Determines whether the response has an error based on the return code.
|
|
74
|
+
/// </summary>
|
|
75
|
+
public bool hasError() => this.getReturnCode() != ReturnCode.Ok;
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Sets the return code for the response.
|
|
79
|
+
/// </summary>
|
|
80
|
+
/// <param name="returnCode">The return code to set.</param>
|
|
81
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
69
82
|
public OperationResponse setReturnCode(int returnCode)
|
|
70
83
|
{
|
|
71
84
|
this.returnCode = returnCode;
|
|
72
85
|
return this;
|
|
73
86
|
}
|
|
74
87
|
|
|
88
|
+
/// <summary>
|
|
89
|
+
/// Sets the debug message for the response.
|
|
90
|
+
/// </summary>
|
|
91
|
+
/// <param name="debugMessage">The debug message to set.</param>
|
|
92
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
75
93
|
public OperationResponse setDebugMessage(string debugMessage)
|
|
76
94
|
{
|
|
77
95
|
this.debugMessage = debugMessage;
|
|
78
96
|
return this;
|
|
79
97
|
}
|
|
80
98
|
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// Adds or updates a parameter for the response.
|
|
101
|
+
/// </summary>
|
|
102
|
+
/// <param name="key">The parameter key.</param>
|
|
103
|
+
/// <param name="value">The parameter value.</param>
|
|
104
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
81
105
|
public OperationResponse setParameter(string key, object value)
|
|
82
106
|
{
|
|
83
107
|
if (this.parameters == null) this.parameters = new GNHashtable();
|
|
84
|
-
|
|
85
108
|
this.parameters.add(key, value);
|
|
86
|
-
|
|
87
109
|
return this;
|
|
88
110
|
}
|
|
89
111
|
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// Sets the parameters for the response.
|
|
114
|
+
/// </summary>
|
|
115
|
+
/// <param name="parameters">The parameters to set.</param>
|
|
116
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
90
117
|
public OperationResponse setParameters(GNHashtable parameters)
|
|
91
118
|
{
|
|
92
119
|
this.parameters = parameters;
|
|
93
120
|
return this;
|
|
94
121
|
}
|
|
95
122
|
|
|
123
|
+
/// <summary>
|
|
124
|
+
/// Sets whether the response is encrypted.
|
|
125
|
+
/// </summary>
|
|
126
|
+
/// <param name="encrypted">True if the response should be encrypted; otherwise false.</param>
|
|
127
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
96
128
|
public OperationResponse setEncrypted(bool encrypted)
|
|
97
129
|
{
|
|
98
130
|
this.encrypted = encrypted;
|
|
99
131
|
return this;
|
|
100
132
|
}
|
|
101
133
|
|
|
134
|
+
/// <summary>
|
|
135
|
+
/// Sets the invalid members for the response.
|
|
136
|
+
/// </summary>
|
|
137
|
+
/// <param name="invalidMembers">The invalid members to set.</param>
|
|
138
|
+
/// <returns>The updated <see cref="OperationResponse"/> instance.</returns>
|
|
102
139
|
public OperationResponse setInvalidMembers(InvalidMember[] invalidMembers)
|
|
103
140
|
{
|
|
104
141
|
this.invalidMembers = invalidMembers;
|
|
105
142
|
return this;
|
|
106
143
|
}
|
|
107
144
|
|
|
145
|
+
/// <summary>
|
|
146
|
+
/// Converts the operation response to a string representation.
|
|
147
|
+
/// </summary>
|
|
148
|
+
/// <returns>A string representation of the operation response.</returns>
|
|
108
149
|
public string toString()
|
|
109
150
|
{
|
|
110
151
|
var stringBuilder = new StringBuilder();
|
|
111
152
|
|
|
112
|
-
stringBuilder.Append("Code: "
|
|
153
|
+
stringBuilder.Append("Code: ")
|
|
154
|
+
.Append(CodeHelper.getOperationCodeName(this.operationCode))
|
|
155
|
+
.Append(", responseId: ")
|
|
156
|
+
.Append(this.responseId)
|
|
157
|
+
.Append(", returnCode: ")
|
|
158
|
+
.Append(CodeHelper.getReturnCodeName(this.returnCode));
|
|
113
159
|
|
|
114
|
-
if (this.returnCode == ReturnCode.Ok)
|
|
160
|
+
if (this.returnCode == ReturnCode.Ok)
|
|
161
|
+
{
|
|
162
|
+
stringBuilder.Append(", parameters: ").Append(this.parameters);
|
|
163
|
+
}
|
|
115
164
|
else if (this.returnCode == ReturnCode.InvalidRequestParameters)
|
|
116
165
|
{
|
|
117
166
|
if (this.invalidMembers != null)
|
|
118
167
|
{
|
|
119
|
-
var invalidStr = string.
|
|
120
|
-
|
|
121
|
-
foreach (var invalidMember in this.invalidMembers)
|
|
122
|
-
{
|
|
123
|
-
invalidStr += invalidMember;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
stringBuilder.Append(", invalidMembers " + invalidStr);
|
|
168
|
+
var invalidStr = string.Join(", ", this.invalidMembers);
|
|
169
|
+
stringBuilder.Append(", invalidMembers: ").Append(invalidStr);
|
|
127
170
|
}
|
|
128
|
-
else
|
|
171
|
+
else
|
|
172
|
+
{
|
|
173
|
+
stringBuilder.Append(", invalidMembers: null");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else
|
|
177
|
+
{
|
|
178
|
+
stringBuilder.Append(", debugMessage: ").Append(this.debugMessage);
|
|
129
179
|
}
|
|
130
|
-
else stringBuilder.Append(", debugMessage " + this.debugMessage);
|
|
131
180
|
|
|
132
|
-
stringBuilder.Append(", encrypted "
|
|
181
|
+
stringBuilder.Append(", encrypted: ").Append(this.encrypted);
|
|
133
182
|
|
|
134
183
|
return stringBuilder.ToString();
|
|
135
184
|
}
|
|
136
185
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
186
|
+
/// <summary>
|
|
187
|
+
/// Returns a string that represents the current operation response.
|
|
188
|
+
/// </summary>
|
|
189
|
+
/// <returns>A string representation of the operation response.</returns>
|
|
190
|
+
public override string ToString() => this.toString();
|
|
142
191
|
}
|
|
143
|
-
|
|
144
192
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: bbc7492669adfdc44b4a518df6345f2c
|
|
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: bbc7492669adfdc44b4a518df6345f2c
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,61 +1,112 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Entity.Request
|
|
2
|
-
{
|
|
3
|
-
using XmobiTea.GN.Constant;
|
|
4
|
-
using XmobiTea.GN.Helper;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
protected abstract
|
|
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
|
-
|
|
1
|
+
namespace XmobiTea.GN.Entity.Request
|
|
2
|
+
{
|
|
3
|
+
using XmobiTea.GN.Constant;
|
|
4
|
+
using XmobiTea.GN.Helper;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Base class for creating custom operation requests.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public abstract class CustomOperationRequest
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// The operation code for the request.
|
|
13
|
+
/// </summary>
|
|
14
|
+
protected abstract int operationCode { get; }
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Specifies if the request should be encrypted.
|
|
18
|
+
/// </summary>
|
|
19
|
+
protected abstract bool operationEncrypted { get; }
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// The type of request (e.g., Socket, HTTP).
|
|
23
|
+
/// </summary>
|
|
24
|
+
protected abstract RequestType requestType { get; }
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// The role of the request (e.g., Client, Admin, Server).
|
|
28
|
+
/// </summary>
|
|
29
|
+
protected abstract RequestRole requestRole { get; }
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Timeout value for the operation request.
|
|
33
|
+
/// </summary>
|
|
34
|
+
protected int operationTimeout { get; }
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Gets the request type for the operation.
|
|
38
|
+
/// </summary>
|
|
39
|
+
public RequestType getRequestType()
|
|
40
|
+
{
|
|
41
|
+
return this.requestType;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Gets the request role for the operation.
|
|
46
|
+
/// </summary>
|
|
47
|
+
public RequestRole getRequestRole()
|
|
48
|
+
{
|
|
49
|
+
return this.requestRole;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Constructor to initialize the operation timeout.
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <param name="timeout">Timeout in seconds for the operation.</param>
|
|
56
|
+
public CustomOperationRequest(int timeout)
|
|
57
|
+
{
|
|
58
|
+
this.operationTimeout = timeout;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Builds the operation request with the provided data and settings.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <returns>An `OperationRequest` object.</returns>
|
|
65
|
+
public abstract OperationRequest build();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
/// Generic base class for creating custom operation requests with strongly-typed request data.
|
|
70
|
+
/// </summary>
|
|
71
|
+
/// <typeparam name="TRequestData">The type of the request data.</typeparam>
|
|
72
|
+
public abstract class CustomOperationRequest<TRequestData> : CustomOperationRequest where TRequestData : new()
|
|
73
|
+
{
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// Data associated with the request.
|
|
76
|
+
/// </summary>
|
|
77
|
+
public TRequestData requestData { get; }
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
/// Constructor to initialize with a new instance of request data and a timeout.
|
|
81
|
+
/// </summary>
|
|
82
|
+
/// <param name="timeout">Timeout in seconds for the operation.</param>
|
|
83
|
+
public CustomOperationRequest(int timeout) : base(timeout)
|
|
84
|
+
{
|
|
85
|
+
this.requestData = new TRequestData();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/// <summary>
|
|
89
|
+
/// Constructor to initialize with an existing request data object and a timeout.
|
|
90
|
+
/// </summary>
|
|
91
|
+
/// <param name="requestData">The existing request data object.</param>
|
|
92
|
+
/// <param name="timeout">Timeout in seconds for the operation.</param>
|
|
93
|
+
public CustomOperationRequest(TRequestData requestData, int timeout) : base(timeout)
|
|
94
|
+
{
|
|
95
|
+
this.requestData = requestData;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// <summary>
|
|
99
|
+
/// Builds the operation request with serialized data and configured settings.
|
|
100
|
+
/// </summary>
|
|
101
|
+
/// <returns>An `OperationRequest` object with serialized request data.</returns>
|
|
102
|
+
public override OperationRequest build()
|
|
103
|
+
{
|
|
104
|
+
var request = new OperationRequest(this.operationCode, this.operationEncrypted, this.operationTimeout);
|
|
105
|
+
|
|
106
|
+
// Serialize the requestData into the parameters of the request.
|
|
107
|
+
request.setParameters(ConverterService.serializeObject(this.requestData));
|
|
108
|
+
|
|
109
|
+
return request;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 8aa4380b0ee6727478f6e948661fb5bd
|
|
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: 8aa4380b0ee6727478f6e948661fb5bd
|
|
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: 6472f7fa20319f044920e909df92bda8
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 6472f7fa20319f044920e909df92bda8
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,63 +1,84 @@
|
|
|
1
|
-
namespace XmobiTea.GN.Entity.Response
|
|
2
|
-
{
|
|
3
|
-
using XmobiTea.GN.Common;
|
|
4
|
-
using XmobiTea.GN.Constant;
|
|
5
|
-
using XmobiTea.GN.Helper;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
public
|
|
13
|
-
public
|
|
14
|
-
public
|
|
15
|
-
|
|
16
|
-
public
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.returnCode
|
|
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
|
-
public
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
namespace XmobiTea.GN.Entity.Response
|
|
2
|
+
{
|
|
3
|
+
using XmobiTea.GN.Common;
|
|
4
|
+
using XmobiTea.GN.Constant;
|
|
5
|
+
using XmobiTea.GN.Helper;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Base class for handling custom operation responses.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public abstract class CustomOperationResponse
|
|
11
|
+
{
|
|
12
|
+
public int operationCode { get; private set; }
|
|
13
|
+
public GNHashtable parameters { get; private set; }
|
|
14
|
+
public int returnCode { get; private set; }
|
|
15
|
+
public string debugMessage { get; private set; }
|
|
16
|
+
public int errorCode { get; private set; }
|
|
17
|
+
public InvalidMember[] invalidMembers { get; private set; }
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// Checks if the response contains a return code indicating an error.
|
|
21
|
+
/// </summary>
|
|
22
|
+
public bool hasReturnCodeError()
|
|
23
|
+
{
|
|
24
|
+
return this.returnCode != ReturnCode.Ok;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Configures the operation response using the provided `OperationResponse` object.
|
|
29
|
+
/// </summary>
|
|
30
|
+
/// <param name="operationResponse">The response from the operation to process.</param>
|
|
31
|
+
public virtual void setupOperationResponse(OperationResponse operationResponse)
|
|
32
|
+
{
|
|
33
|
+
this.operationCode = operationResponse.getOperationCode();
|
|
34
|
+
this.returnCode = operationResponse.getReturnCode();
|
|
35
|
+
this.debugMessage = operationResponse.getDebugMessage();
|
|
36
|
+
this.parameters = operationResponse.getParameters();
|
|
37
|
+
this.invalidMembers = operationResponse.getInvalidMembers();
|
|
38
|
+
|
|
39
|
+
// Extract error code if the return code does not indicate an error.
|
|
40
|
+
if (!this.hasReturnCodeError())
|
|
41
|
+
{
|
|
42
|
+
this.errorCode = this.parameters.getInt(ParameterCode.ErrorCode);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// Returns a string representation of the response.
|
|
48
|
+
/// </summary>
|
|
49
|
+
public string toString()
|
|
50
|
+
{
|
|
51
|
+
return "ReturnCode: " + this.returnCode + " " +
|
|
52
|
+
(this.parameters != null ? this.parameters.ToString() : this.debugMessage);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public override string ToString()
|
|
56
|
+
{
|
|
57
|
+
return this.toString();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// A generic variant of `CustomOperationResponse` that includes typed response data.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <typeparam name="TResponseData">The type of the response data.</typeparam>
|
|
65
|
+
public class CustomOperationResponse<TResponseData> : CustomOperationResponse
|
|
66
|
+
{
|
|
67
|
+
public TResponseData responseData { get; private set; }
|
|
68
|
+
|
|
69
|
+
/// <summary>
|
|
70
|
+
/// Configures the operation response and deserializes typed data if no errors are present.
|
|
71
|
+
/// </summary>
|
|
72
|
+
/// <param name="operationResponse">The response from the operation to process.</param>
|
|
73
|
+
public override void setupOperationResponse(OperationResponse operationResponse)
|
|
74
|
+
{
|
|
75
|
+
base.setupOperationResponse(operationResponse);
|
|
76
|
+
|
|
77
|
+
if (!this.hasReturnCodeError())
|
|
78
|
+
{
|
|
79
|
+
// Deserialize the parameters into the specified response data type.
|
|
80
|
+
this.responseData = ConverterService.deserializeObject<TResponseData>(this.parameters);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 209ce55f71e46fb4c8935874746a75b3
|
|
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: 209ce55f71e46fb4c8935874746a75b3
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|