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.
Files changed (239) hide show
  1. package/Editor/GNServerSettingsEditor.cs +16 -300
  2. package/Runtime/Common/GNArray.cs +387 -302
  3. package/Runtime/Common/GNArray.cs.meta +11 -11
  4. package/Runtime/Common/GNData.cs +61 -48
  5. package/Runtime/Common/GNData.cs.meta +11 -11
  6. package/Runtime/Common/GNHashtable.cs +404 -241
  7. package/Runtime/Common/GNHashtable.cs.meta +11 -11
  8. package/Runtime/Common/IGNData.cs +20 -11
  9. package/Runtime/Common/IGNData.cs.meta +11 -11
  10. package/Runtime/Common.meta +8 -8
  11. package/Runtime/Config/GNServerSettings.cs +136 -92
  12. package/Runtime/Config/GNServerSettings.cs.meta +11 -11
  13. package/Runtime/Config.meta +8 -8
  14. package/Runtime/Constant/Commands.cs +82 -19
  15. package/Runtime/Constant/Commands.cs.meta +11 -11
  16. package/Runtime/Constant/EnumType/FriendStatus.cs +12 -12
  17. package/Runtime/Constant/EnumType/FriendStatus.cs.meta +11 -11
  18. package/Runtime/Constant/EnumType/GoogleLoginType.cs +5 -5
  19. package/Runtime/Constant/EnumType/GoogleLoginType.cs.meta +11 -11
  20. package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
  21. package/Runtime/Constant/EnumType/GroupStatus.cs.meta +11 -11
  22. package/Runtime/Constant/EnumType/InvalidMemberType.cs +23 -23
  23. package/Runtime/Constant/EnumType/InvalidMemberType.cs.meta +11 -11
  24. package/Runtime/Constant/EnumType/ItemType.cs +5 -5
  25. package/Runtime/Constant/EnumType/ItemType.cs.meta +11 -11
  26. package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
  27. package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs.meta +11 -11
  28. package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
  29. package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs.meta +11 -11
  30. package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
  31. package/Runtime/Constant/EnumType/OwnerType.cs.meta +11 -11
  32. package/Runtime/Constant/EnumType/PermissionDataItem.cs +10 -10
  33. package/Runtime/Constant/EnumType/PermissionDataItem.cs.meta +11 -11
  34. package/Runtime/Constant/EnumType/PushPlatformType.cs +10 -0
  35. package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
  36. package/Runtime/Constant/EnumType/RequestRole.cs +11 -11
  37. package/Runtime/Constant/EnumType/RequestRole.cs.meta +7 -7
  38. package/Runtime/Constant/EnumType/RequestType.cs +20 -19
  39. package/Runtime/Constant/EnumType/RequestType.cs.meta +11 -11
  40. package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
  41. package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
  42. package/Runtime/Constant/EnumType.meta +8 -8
  43. package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
  44. package/Runtime/Constant/ErrorCode/GNErrorCode.cs.meta +7 -7
  45. package/Runtime/Constant/ErrorCode.meta +8 -8
  46. package/Runtime/Constant/EventCode.cs +43 -16
  47. package/Runtime/Constant/EventCode.cs.meta +11 -11
  48. package/Runtime/Constant/OperationCode.cs +249 -211
  49. package/Runtime/Constant/OperationCode.cs.meta +11 -11
  50. package/Runtime/Constant/ParameterCode/GNParameterCode.cs +614 -466
  51. package/Runtime/Constant/ParameterCode/GNParameterCode.cs.meta +11 -11
  52. package/Runtime/Constant/ParameterCode/ParameterCode.cs +12 -12
  53. package/Runtime/Constant/ParameterCode/ParameterCode.cs.meta +11 -11
  54. package/Runtime/Constant/ParameterCode.meta +8 -8
  55. package/Runtime/Constant/ReturnCode.cs +73 -25
  56. package/Runtime/Constant/ReturnCode.cs.meta +11 -11
  57. package/Runtime/Constant.meta +8 -8
  58. package/Runtime/Entity/DataMember.cs +342 -124
  59. package/Runtime/Entity/DataMember.cs.meta +11 -11
  60. package/Runtime/Entity/GNMetadata.cs +72 -27
  61. package/Runtime/Entity/GNMetadata.cs.meta +11 -11
  62. package/Runtime/Entity/InvalidMember.cs +52 -33
  63. package/Runtime/Entity/InvalidMember.cs.meta +11 -11
  64. package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
  65. package/Runtime/Entity/Models/AuthenticateModels.cs.meta +11 -11
  66. package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
  67. package/Runtime/Entity/Models/AuthenticateRequestModels.cs.meta +11 -11
  68. package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
  69. package/Runtime/Entity/Models/AuthenticateResponseModels.cs.meta +11 -11
  70. package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
  71. package/Runtime/Entity/Models/CharacterPlayerModels.cs.meta +11 -11
  72. package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
  73. package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs.meta +11 -11
  74. package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
  75. package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs.meta +11 -11
  76. package/Runtime/Entity/Models/CloudScriptModels.cs +185 -0
  77. package/Runtime/Entity/Models/CloudScriptModels.cs.meta +11 -0
  78. package/Runtime/Entity/Models/CloudScriptRequestModels.cs +134 -0
  79. package/Runtime/Entity/Models/CloudScriptRequestModels.cs.meta +11 -0
  80. package/Runtime/Entity/Models/CloudScriptResponseModels.cs +34 -0
  81. package/Runtime/Entity/Models/CloudScriptResponseModels.cs.meta +11 -0
  82. package/Runtime/Entity/Models/ContentModels.cs +150 -153
  83. package/Runtime/Entity/Models/ContentModels.cs.meta +11 -11
  84. package/Runtime/Entity/Models/ContentRequestModels.cs +129 -129
  85. package/Runtime/Entity/Models/ContentRequestModels.cs.meta +11 -11
  86. package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
  87. package/Runtime/Entity/Models/ContentResponseModels.cs.meta +11 -11
  88. package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
  89. package/Runtime/Entity/Models/DashboardModels.cs.meta +11 -11
  90. package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
  91. package/Runtime/Entity/Models/DashboardRequestModels.cs.meta +11 -11
  92. package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
  93. package/Runtime/Entity/Models/DashboardResponseModels.cs.meta +11 -11
  94. package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
  95. package/Runtime/Entity/Models/GamePlayerModels.cs.meta +11 -11
  96. package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
  97. package/Runtime/Entity/Models/GamePlayerRequestModels.cs.meta +11 -11
  98. package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
  99. package/Runtime/Entity/Models/GamePlayerResponseModels.cs.meta +11 -11
  100. package/Runtime/Entity/Models/GenericModels.cs +102 -102
  101. package/Runtime/Entity/Models/GenericModels.cs.meta +11 -11
  102. package/Runtime/Entity/Models/GroupModels.cs +812 -676
  103. package/Runtime/Entity/Models/GroupModels.cs.meta +11 -11
  104. package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
  105. package/Runtime/Entity/Models/GroupRequestModels.cs.meta +11 -11
  106. package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
  107. package/Runtime/Entity/Models/GroupResponseModels.cs.meta +11 -11
  108. package/Runtime/Entity/Models/InventoryModels.cs +667 -558
  109. package/Runtime/Entity/Models/InventoryModels.cs.meta +11 -11
  110. package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
  111. package/Runtime/Entity/Models/InventoryRequestModels.cs.meta +11 -11
  112. package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
  113. package/Runtime/Entity/Models/InventoryResponseModels.cs.meta +11 -11
  114. package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
  115. package/Runtime/Entity/Models/MasterPlayerModels.cs.meta +11 -11
  116. package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
  117. package/Runtime/Entity/Models/MasterPlayerRequestModels.cs.meta +11 -11
  118. package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
  119. package/Runtime/Entity/Models/MasterPlayerResponseModels.cs.meta +11 -11
  120. package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
  121. package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -11
  122. package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
  123. package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -11
  124. package/Runtime/Entity/Models/MultiplayerResponseModels.cs +59 -49
  125. package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -11
  126. package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
  127. package/Runtime/Entity/Models/StoreInventoryModels.cs.meta +11 -11
  128. package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
  129. package/Runtime/Entity/Models/StoreInventoryRequestModels.cs.meta +11 -11
  130. package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
  131. package/Runtime/Entity/Models/StoreInventoryResponseModels.cs.meta +11 -11
  132. package/Runtime/Entity/Models.meta +8 -8
  133. package/Runtime/Entity/OperationEvent.cs +111 -75
  134. package/Runtime/Entity/OperationEvent.cs.meta +11 -11
  135. package/Runtime/Entity/OperationHelper.cs +51 -35
  136. package/Runtime/Entity/OperationHelper.cs.meta +11 -11
  137. package/Runtime/Entity/OperationRequest.cs +142 -99
  138. package/Runtime/Entity/OperationRequest.cs.meta +11 -11
  139. package/Runtime/Entity/OperationResponse.cs +111 -63
  140. package/Runtime/Entity/OperationResponse.cs.meta +11 -11
  141. package/Runtime/Entity/Request/CustomOperationRequest.cs +112 -61
  142. package/Runtime/Entity/Request/CustomOperationRequest.cs.meta +11 -11
  143. package/Runtime/Entity/Request.meta +8 -8
  144. package/Runtime/Entity/Response/CustomOperationResponse.cs +84 -63
  145. package/Runtime/Entity/Response/CustomOperationResponse.cs.meta +11 -11
  146. package/Runtime/Entity/Response.meta +8 -8
  147. package/Runtime/Entity.meta +8 -8
  148. package/Runtime/GNNetwork.cs +501 -182
  149. package/Runtime/GNNetwork.cs.meta +11 -11
  150. package/Runtime/GNNetworkApi.cs +38 -19
  151. package/Runtime/GNNetworkApi.cs.meta +11 -11
  152. package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
  153. package/Runtime/GNNetworkAuthenticateApi.cs.meta +11 -11
  154. package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
  155. package/Runtime/GNNetworkCharacterPlayerApi.cs.meta +11 -11
  156. package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
  157. package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
  158. package/Runtime/GNNetworkContentApi.cs +238 -132
  159. package/Runtime/GNNetworkContentApi.cs.meta +11 -11
  160. package/Runtime/GNNetworkDashboardApi.cs +278 -117
  161. package/Runtime/GNNetworkDashboardApi.cs.meta +11 -11
  162. package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
  163. package/Runtime/GNNetworkGamePlayerApi.cs.meta +11 -11
  164. package/Runtime/GNNetworkGroupApi.cs +1228 -582
  165. package/Runtime/GNNetworkGroupApi.cs.meta +11 -11
  166. package/Runtime/GNNetworkInventoryApi.cs +1048 -507
  167. package/Runtime/GNNetworkInventoryApi.cs.meta +11 -11
  168. package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
  169. package/Runtime/GNNetworkMasterPlayerApi.cs.meta +11 -11
  170. package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
  171. package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -11
  172. package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
  173. package/Runtime/GNNetworkStoreInventoryApi.cs.meta +11 -11
  174. package/Runtime/Helper/CodeHelper.cs +140 -98
  175. package/Runtime/Helper/CodeHelper.cs.meta +11 -11
  176. package/Runtime/Helper/ConverterService.cs +236 -52
  177. package/Runtime/Helper/ConverterService.cs.meta +11 -11
  178. package/Runtime/Helper/ParseGNHelper.cs +451 -451
  179. package/Runtime/Helper/ParseGNHelper.cs.meta +11 -11
  180. package/Runtime/Helper.meta +8 -8
  181. package/Runtime/Logger/GNDebug.cs +92 -49
  182. package/Runtime/Logger/GNDebug.cs.meta +11 -11
  183. package/Runtime/Logger.meta +8 -8
  184. package/Runtime/Networking/AuthenticateStatus.cs +57 -35
  185. package/Runtime/Networking/AuthenticateStatus.cs.meta +11 -11
  186. package/Runtime/Networking/Handler/IServerEventHandler.cs +25 -25
  187. package/Runtime/Networking/Handler/IServerEventHandler.cs.meta +11 -11
  188. package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +61 -32
  189. package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs.meta +11 -11
  190. package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +54 -33
  191. package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs.meta +11 -11
  192. package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +54 -32
  193. package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs.meta +11 -11
  194. package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +54 -32
  195. package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs.meta +11 -11
  196. package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +48 -29
  197. package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs.meta +11 -11
  198. package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +47 -29
  199. package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs.meta +11 -11
  200. package/Runtime/Networking/Handler.meta +8 -8
  201. package/Runtime/Networking/Http/HttpPeer.cs +68 -25
  202. package/Runtime/Networking/Http/HttpPeer.cs.meta +11 -11
  203. package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +65 -25
  204. package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs.meta +11 -11
  205. package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +513 -486
  206. package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs.meta +11 -11
  207. package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +172 -142
  208. package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs.meta +11 -11
  209. package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +225 -188
  210. package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs.meta +11 -11
  211. package/Runtime/Networking/Http.meta +8 -8
  212. package/Runtime/Networking/IPeer.cs +41 -19
  213. package/Runtime/Networking/IPeer.cs.meta +11 -11
  214. package/Runtime/Networking/NetworkingPeer.cs +198 -144
  215. package/Runtime/Networking/NetworkingPeer.cs.meta +11 -11
  216. package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
  217. package/Runtime/Networking/NetworkingPeerAPI.cs.meta +11 -11
  218. package/Runtime/Networking/OperationPending.cs +159 -95
  219. package/Runtime/Networking/OperationPending.cs.meta +11 -11
  220. package/Runtime/Networking/PeerBase.cs +305 -242
  221. package/Runtime/Networking/PeerBase.cs.meta +11 -11
  222. package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +222 -185
  223. package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs.meta +11 -11
  224. package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +235 -177
  225. package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs.meta +11 -11
  226. package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
  227. package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs.meta +11 -11
  228. package/Runtime/Networking/Socket/SocketPeer.cs +242 -197
  229. package/Runtime/Networking/Socket/SocketPeer.cs.meta +11 -11
  230. package/Runtime/Networking/Socket.meta +8 -8
  231. package/Runtime/Networking.meta +8 -8
  232. package/Runtime/Unity/ServiceCoroutine.cs +10 -0
  233. package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
  234. package/Runtime/Unity/ServiceUpdate.cs +33 -20
  235. package/Runtime/Unity/ServiceUpdate.cs.meta +11 -11
  236. package/Runtime/Unity.meta +8 -8
  237. package/Runtime/XmobiTea.GN.runtime.asmdef +16 -16
  238. package/Runtime/XmobiTea.GN.runtime.asmdef.meta +7 -7
  239. 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
- public int getOperationCode()
30
- {
31
- return this.operationCode;
32
- }
33
-
34
- public int getReturnCode()
35
- {
36
- return this.returnCode;
37
- }
38
-
39
- public GNHashtable getParameters()
40
- {
41
- return this.parameters;
42
- }
43
-
44
- public bool isEncrypted()
45
- {
46
- return this.encrypted;
47
- }
48
-
49
- public int getResponseId()
50
- {
51
- return this.responseId;
52
- }
53
-
54
- public string getDebugMessage()
55
- {
56
- return this.debugMessage;
57
- }
58
-
59
- public InvalidMember[] getInvalidMembers()
60
- {
61
- return this.invalidMembers;
62
- }
63
-
64
- public bool hasError()
65
- {
66
- return this.getReturnCode() != ReturnCode.Ok;
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: " + CodeHelper.getOperationCodeName(this.operationCode) + ", responseId: " + this.responseId + ", returnCode " + CodeHelper.getReturnCodeName(this.returnCode));
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) stringBuilder.Append(", parameters " + this.parameters);
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.Empty;
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 stringBuilder.Append(", invalidMembers " + this.invalidMembers);
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 " + this.encrypted);
181
+ stringBuilder.Append(", encrypted: ").Append(this.encrypted);
133
182
 
134
183
  return stringBuilder.ToString();
135
184
  }
136
185
 
137
- public override string ToString()
138
- {
139
- return this.toString();
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
- public abstract class CustomOperationRequest
7
- {
8
- protected abstract int operationCode { get; }
9
-
10
- protected abstract bool operationEncrypted { get; }
11
-
12
- protected abstract RequestType requestType { get; }
13
-
14
- protected abstract RequestRole requestRole { get; }
15
-
16
- protected int operationTimeout { get; }
17
-
18
- public RequestType getRequestType()
19
- {
20
- return this.requestType;
21
- }
22
-
23
- public RequestRole getRequestRole()
24
- {
25
- return this.requestRole;
26
- }
27
-
28
- public CustomOperationRequest(int timeout)
29
- {
30
- this.operationTimeout = timeout;
31
- }
32
-
33
- public abstract OperationRequest build();
34
- }
35
-
36
- public abstract class CustomOperationRequest<TRequestData> : CustomOperationRequest where TRequestData : new()
37
- {
38
- public TRequestData requestData { get; }
39
-
40
- public CustomOperationRequest(int timeout) : base(timeout)
41
- {
42
- this.requestData = new TRequestData();
43
- }
44
-
45
- public CustomOperationRequest(TRequestData requestData, int timeout) : base(timeout)
46
- {
47
- this.requestData = requestData;
48
- }
49
-
50
- public override OperationRequest build()
51
- {
52
- var request = new OperationRequest(this.operationCode, this.operationEncrypted, this.operationTimeout);
53
-
54
- request.setParameters(ConverterService.serializeObject(this.requestData));
55
-
56
- return request;
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
- public abstract class CustomOperationResponse
8
- {
9
- public int operationCode { get; private set; }
10
- public GNHashtable parameters { get; private set; }
11
- public int returnCode { get; private set; }
12
- public string debugMessage { get; private set; }
13
- public int errorCode { get; private set; }
14
- public InvalidMember[] invalidMembers { get; private set; }
15
-
16
- public bool hasReturnCodeError()
17
- {
18
- return this.returnCode != ReturnCode.Ok;
19
- }
20
-
21
- public virtual void setupOperationResponse(OperationResponse operationResponse)
22
- {
23
- this.operationCode = operationResponse.getOperationCode();
24
- this.returnCode = operationResponse.getReturnCode();
25
- this.debugMessage = operationResponse.getDebugMessage();
26
-
27
- this.parameters = operationResponse.getParameters();
28
- this.invalidMembers = operationResponse.getInvalidMembers();
29
-
30
- if (!this.hasReturnCodeError())
31
- {
32
- this.errorCode = this.parameters.getInt(ParameterCode.ErrorCode);
33
- }
34
- }
35
-
36
- public string toString()
37
- {
38
- return "ReturnCode: " + this.returnCode + " " + (this.parameters != null ? this.parameters.ToString() : this.debugMessage);
39
- }
40
-
41
- public override string ToString()
42
- {
43
- return this.toString();
44
- }
45
- }
46
-
47
- public class CustomOperationResponse<TResponseData> : CustomOperationResponse
48
- {
49
- public TResponseData responseData { get; private set; }
50
-
51
- public override void setupOperationResponse(OperationResponse operationResponse)
52
- {
53
- base.setupOperationResponse(operationResponse);
54
-
55
- if (!this.hasReturnCodeError())
56
- {
57
- this.responseData = ConverterService.deserializeObject<TResponseData>(this.parameters);
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: