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.
- package/Editor/GNServerSettingsEditor.cs +42 -322
- package/Runtime/Common/GNArray.cs +120 -35
- package/Runtime/Common/GNData.cs +19 -6
- package/Runtime/Common/GNHashtable.cs +174 -11
- package/Runtime/Common/IGNData.cs +11 -2
- package/Runtime/Config/GNServerSettings.cs +136 -92
- package/Runtime/Constant/Commands.cs +82 -19
- package/Runtime/Constant/EnumType/GoogleLoginType.cs +5 -5
- package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
- package/Runtime/Constant/EnumType/ItemType.cs +5 -5
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
- package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
- package/Runtime/Constant/EnumType/PushPlatformType.cs +10 -0
- package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
- package/Runtime/Constant/EnumType/RequestType.cs +1 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
- package/Runtime/Constant/EventCode.cs +29 -2
- package/Runtime/Constant/OperationCode.cs +249 -211
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs +610 -466
- package/Runtime/Constant/ReturnCode.cs +50 -2
- package/Runtime/Entity/DataMember.cs +221 -3
- package/Runtime/Entity/GNMetadata.cs +46 -1
- package/Runtime/Entity/InvalidMember.cs +24 -5
- package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
- package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
- 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/ContentRequestModels.cs +129 -129
- package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
- package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
- package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
- package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
- package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
- package/Runtime/Entity/Models/GenericModels.cs +102 -102
- package/Runtime/Entity/Models/GroupModels.cs +812 -676
- package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
- package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
- package/Runtime/Entity/Models/InventoryModels.cs +667 -558
- package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
- package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
- package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
- package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +10 -0
- package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
- package/Runtime/Entity/OperationEvent.cs +43 -7
- package/Runtime/Entity/OperationHelper.cs +18 -2
- package/Runtime/Entity/OperationRequest.cs +80 -37
- package/Runtime/Entity/OperationResponse.cs +111 -63
- package/Runtime/Entity/Request/CustomOperationRequest.cs +53 -2
- package/Runtime/Entity/Response/CustomOperationResponse.cs +25 -4
- package/Runtime/GNNetwork.cs +333 -21
- package/Runtime/GNNetworkApi.cs +25 -13
- package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
- package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
- package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
- package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
- package/Runtime/GNNetworkContentApi.cs +238 -132
- package/Runtime/GNNetworkDashboardApi.cs +278 -117
- package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
- package/Runtime/GNNetworkGroupApi.cs +1228 -582
- package/Runtime/GNNetworkInventoryApi.cs +1048 -507
- package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
- package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
- package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
- package/Runtime/Helper/CodeHelper.cs +45 -3
- package/Runtime/Helper/ConverterService.cs +240 -85
- package/Runtime/Logger/GNDebug.cs +46 -3
- package/Runtime/Networking/AuthenticateStatus.cs +30 -8
- package/Runtime/Networking/Handler/IServerEventHandler.cs +8 -8
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +31 -2
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +24 -3
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +24 -2
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +24 -2
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +21 -2
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +20 -2
- package/Runtime/Networking/Http/HttpPeer.cs +68 -25
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +44 -4
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +63 -40
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +43 -13
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +72 -39
- package/Runtime/Networking/IPeer.cs +24 -2
- package/Runtime/Networking/NetworkingPeer.cs +64 -10
- package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
- package/Runtime/Networking/OperationPending.cs +79 -15
- package/Runtime/Networking/PeerBase.cs +86 -23
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +57 -18
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +70 -10
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
- package/Runtime/Networking/Socket/SocketPeer.cs +63 -12
- package/Runtime/Unity/ServiceCoroutine.cs +10 -0
- package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
- package/Runtime/Unity/ServiceUpdate.cs +14 -1
- 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 + " " +
|
|
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
|
}
|