com.xmobitea.changx.gn-unity 2.0.2 → 2.3.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 (112) hide show
  1. package/Editor/GNServerSettingsEditor.cs +42 -322
  2. package/Runtime/Common/GNArray.cs +120 -35
  3. package/Runtime/Common/GNData.cs +19 -6
  4. package/Runtime/Common/GNHashtable.cs +174 -11
  5. package/Runtime/Common/IGNData.cs +11 -2
  6. package/Runtime/Config/GNServerSettings.cs +136 -92
  7. package/Runtime/Constant/Commands.cs +82 -19
  8. package/Runtime/Constant/EnumType/GoogleLoginType.cs +5 -5
  9. package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
  10. package/Runtime/Constant/EnumType/ItemType.cs +5 -5
  11. package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
  12. package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
  13. package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
  14. package/Runtime/Constant/EnumType/PushPlatformType.cs +10 -0
  15. package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
  16. package/Runtime/Constant/EnumType/RequestType.cs +1 -0
  17. package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
  18. package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
  19. package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
  20. package/Runtime/Constant/EventCode.cs +29 -2
  21. package/Runtime/Constant/OperationCode.cs +249 -211
  22. package/Runtime/Constant/ParameterCode/GNParameterCode.cs +610 -466
  23. package/Runtime/Constant/ReturnCode.cs +50 -2
  24. package/Runtime/Entity/DataMember.cs +221 -3
  25. package/Runtime/Entity/GNMetadata.cs +46 -1
  26. package/Runtime/Entity/InvalidMember.cs +24 -5
  27. package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
  28. package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
  29. package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
  30. package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
  31. package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
  32. package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
  33. package/Runtime/Entity/Models/CloudScriptModels.cs +185 -0
  34. package/Runtime/Entity/Models/CloudScriptModels.cs.meta +11 -0
  35. package/Runtime/Entity/Models/CloudScriptRequestModels.cs +134 -0
  36. package/Runtime/Entity/Models/CloudScriptRequestModels.cs.meta +11 -0
  37. package/Runtime/Entity/Models/CloudScriptResponseModels.cs +34 -0
  38. package/Runtime/Entity/Models/CloudScriptResponseModels.cs.meta +11 -0
  39. package/Runtime/Entity/Models/ContentModels.cs +150 -153
  40. package/Runtime/Entity/Models/ContentRequestModels.cs +129 -129
  41. package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
  42. package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
  43. package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
  44. package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
  45. package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
  46. package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
  47. package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
  48. package/Runtime/Entity/Models/GenericModels.cs +102 -102
  49. package/Runtime/Entity/Models/GroupModels.cs +812 -676
  50. package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
  51. package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
  52. package/Runtime/Entity/Models/InventoryModels.cs +667 -558
  53. package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
  54. package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
  55. package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
  56. package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
  57. package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
  58. package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
  59. package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
  60. package/Runtime/Entity/Models/MultiplayerResponseModels.cs +10 -0
  61. package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
  62. package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
  63. package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
  64. package/Runtime/Entity/OperationEvent.cs +43 -7
  65. package/Runtime/Entity/OperationHelper.cs +18 -2
  66. package/Runtime/Entity/OperationRequest.cs +80 -37
  67. package/Runtime/Entity/OperationResponse.cs +111 -63
  68. package/Runtime/Entity/Request/CustomOperationRequest.cs +53 -2
  69. package/Runtime/Entity/Response/CustomOperationResponse.cs +25 -4
  70. package/Runtime/GNNetwork.cs +333 -21
  71. package/Runtime/GNNetworkApi.cs +25 -13
  72. package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
  73. package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
  74. package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
  75. package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
  76. package/Runtime/GNNetworkContentApi.cs +238 -132
  77. package/Runtime/GNNetworkDashboardApi.cs +278 -117
  78. package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
  79. package/Runtime/GNNetworkGroupApi.cs +1228 -582
  80. package/Runtime/GNNetworkInventoryApi.cs +1048 -507
  81. package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
  82. package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
  83. package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
  84. package/Runtime/Helper/CodeHelper.cs +45 -3
  85. package/Runtime/Helper/ConverterService.cs +240 -85
  86. package/Runtime/Logger/GNDebug.cs +46 -3
  87. package/Runtime/Networking/AuthenticateStatus.cs +30 -8
  88. package/Runtime/Networking/Handler/IServerEventHandler.cs +8 -8
  89. package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +31 -2
  90. package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +24 -3
  91. package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +24 -2
  92. package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +24 -2
  93. package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +21 -2
  94. package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +20 -2
  95. package/Runtime/Networking/Http/HttpPeer.cs +68 -25
  96. package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +44 -4
  97. package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +63 -40
  98. package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +43 -13
  99. package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +72 -39
  100. package/Runtime/Networking/IPeer.cs +24 -2
  101. package/Runtime/Networking/NetworkingPeer.cs +64 -10
  102. package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
  103. package/Runtime/Networking/OperationPending.cs +79 -15
  104. package/Runtime/Networking/PeerBase.cs +86 -23
  105. package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +57 -18
  106. package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +70 -10
  107. package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
  108. package/Runtime/Networking/Socket/SocketPeer.cs +63 -12
  109. package/Runtime/Unity/ServiceCoroutine.cs +10 -0
  110. package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
  111. package/Runtime/Unity/ServiceUpdate.cs +14 -1
  112. package/package.json +1 -1
@@ -3,59 +3,110 @@
3
3
  using XmobiTea.GN.Constant;
4
4
  using XmobiTea.GN.Helper;
5
5
 
6
+ /// <summary>
7
+ /// Base class for creating custom operation requests.
8
+ /// </summary>
6
9
  public abstract class CustomOperationRequest
7
10
  {
11
+ /// <summary>
12
+ /// The operation code for the request.
13
+ /// </summary>
8
14
  protected abstract int operationCode { get; }
9
15
 
16
+ /// <summary>
17
+ /// Specifies if the request should be encrypted.
18
+ /// </summary>
10
19
  protected abstract bool operationEncrypted { get; }
11
20
 
21
+ /// <summary>
22
+ /// The type of request (e.g., Socket, HTTP).
23
+ /// </summary>
12
24
  protected abstract RequestType requestType { get; }
13
25
 
26
+ /// <summary>
27
+ /// The role of the request (e.g., Client, Admin, Server).
28
+ /// </summary>
14
29
  protected abstract RequestRole requestRole { get; }
15
30
 
31
+ /// <summary>
32
+ /// Timeout value for the operation request.
33
+ /// </summary>
16
34
  protected int operationTimeout { get; }
17
35
 
36
+ /// <summary>
37
+ /// Gets the request type for the operation.
38
+ /// </summary>
18
39
  public RequestType getRequestType()
19
40
  {
20
41
  return this.requestType;
21
42
  }
22
43
 
44
+ /// <summary>
45
+ /// Gets the request role for the operation.
46
+ /// </summary>
23
47
  public RequestRole getRequestRole()
24
48
  {
25
49
  return this.requestRole;
26
50
  }
27
51
 
52
+ /// <summary>
53
+ /// Constructor to initialize the operation timeout.
54
+ /// </summary>
55
+ /// <param name="timeout">Timeout in seconds for the operation.</param>
28
56
  public CustomOperationRequest(int timeout)
29
57
  {
30
58
  this.operationTimeout = timeout;
31
59
  }
32
60
 
61
+ /// <summary>
62
+ /// Builds the operation request with the provided data and settings.
63
+ /// </summary>
64
+ /// <returns>An `OperationRequest` object.</returns>
33
65
  public abstract OperationRequest build();
34
66
  }
35
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>
36
72
  public abstract class CustomOperationRequest<TRequestData> : CustomOperationRequest where TRequestData : new()
37
73
  {
74
+ /// <summary>
75
+ /// Data associated with the request.
76
+ /// </summary>
38
77
  public TRequestData requestData { get; }
39
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>
40
83
  public CustomOperationRequest(int timeout) : base(timeout)
41
84
  {
42
85
  this.requestData = new TRequestData();
43
86
  }
44
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>
45
93
  public CustomOperationRequest(TRequestData requestData, int timeout) : base(timeout)
46
94
  {
47
95
  this.requestData = requestData;
48
96
  }
49
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>
50
102
  public override OperationRequest build()
51
103
  {
52
104
  var request = new OperationRequest(this.operationCode, this.operationEncrypted, this.operationTimeout);
53
105
 
106
+ // Serialize the requestData into the parameters of the request.
54
107
  request.setParameters(ConverterService.serializeObject(this.requestData));
55
108
 
56
109
  return request;
57
110
  }
58
-
59
111
  }
60
-
61
112
  }
@@ -4,6 +4,9 @@
4
4
  using XmobiTea.GN.Constant;
5
5
  using XmobiTea.GN.Helper;
6
6
 
7
+ /// <summary>
8
+ /// Base class for handling custom operation responses.
9
+ /// </summary>
7
10
  public abstract class CustomOperationResponse
8
11
  {
9
12
  public int operationCode { get; private set; }
@@ -13,29 +16,40 @@
13
16
  public int errorCode { get; private set; }
14
17
  public InvalidMember[] invalidMembers { get; private set; }
15
18
 
19
+ /// <summary>
20
+ /// Checks if the response contains a return code indicating an error.
21
+ /// </summary>
16
22
  public bool hasReturnCodeError()
17
23
  {
18
24
  return this.returnCode != ReturnCode.Ok;
19
25
  }
20
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>
21
31
  public virtual void setupOperationResponse(OperationResponse operationResponse)
22
32
  {
23
33
  this.operationCode = operationResponse.getOperationCode();
24
34
  this.returnCode = operationResponse.getReturnCode();
25
35
  this.debugMessage = operationResponse.getDebugMessage();
26
-
27
36
  this.parameters = operationResponse.getParameters();
28
37
  this.invalidMembers = operationResponse.getInvalidMembers();
29
38
 
39
+ // Extract error code if the return code does not indicate an error.
30
40
  if (!this.hasReturnCodeError())
31
41
  {
32
42
  this.errorCode = this.parameters.getInt(ParameterCode.ErrorCode);
33
43
  }
34
44
  }
35
45
 
46
+ /// <summary>
47
+ /// Returns a string representation of the response.
48
+ /// </summary>
36
49
  public string toString()
37
50
  {
38
- return "ReturnCode: " + this.returnCode + " " + (this.parameters != null ? this.parameters.ToString() : this.debugMessage);
51
+ return "ReturnCode: " + this.returnCode + " " +
52
+ (this.parameters != null ? this.parameters.ToString() : this.debugMessage);
39
53
  }
40
54
 
41
55
  public override string ToString()
@@ -44,20 +58,27 @@
44
58
  }
45
59
  }
46
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>
47
65
  public class CustomOperationResponse<TResponseData> : CustomOperationResponse
48
66
  {
49
67
  public TResponseData responseData { get; private set; }
50
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>
51
73
  public override void setupOperationResponse(OperationResponse operationResponse)
52
74
  {
53
75
  base.setupOperationResponse(operationResponse);
54
76
 
55
77
  if (!this.hasReturnCodeError())
56
78
  {
79
+ // Deserialize the parameters into the specified response data type.
57
80
  this.responseData = ConverterService.deserializeObject<TResponseData>(this.parameters);
58
81
  }
59
82
  }
60
-
61
83
  }
62
-
63
84
  }