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
|
@@ -2,48 +2,91 @@ namespace XmobiTea.GN.Logger
|
|
|
2
2
|
{
|
|
3
3
|
using System;
|
|
4
4
|
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Enum defining different log levels for GNDebug.
|
|
7
|
+
/// </summary>
|
|
5
8
|
public enum LogType
|
|
6
9
|
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// No logging.
|
|
12
|
+
/// </summary>
|
|
7
13
|
Off,
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// Logs exceptions only.
|
|
17
|
+
/// </summary>
|
|
8
18
|
Exception,
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Logs errors and exceptions.
|
|
22
|
+
/// </summary>
|
|
9
23
|
Error,
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// Logs warnings, errors, and exceptions.
|
|
27
|
+
/// </summary>
|
|
10
28
|
Warning,
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Logs all messages, including general logs, warnings, errors, and exceptions.
|
|
32
|
+
/// </summary>
|
|
11
33
|
All,
|
|
12
34
|
}
|
|
13
35
|
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Utility class for handling logging in the GN framework.
|
|
38
|
+
/// </summary>
|
|
14
39
|
internal class GNDebug
|
|
15
40
|
{
|
|
16
|
-
private static LogType _logType;
|
|
41
|
+
private static LogType _logType; // Current log level.
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Gets or sets the current log level for GNDebug.
|
|
45
|
+
/// </summary>
|
|
17
46
|
public static LogType logType
|
|
18
47
|
{
|
|
19
48
|
get => _logType;
|
|
20
49
|
set => _logType = value;
|
|
21
50
|
}
|
|
22
51
|
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Logs a general message if the log level includes general logs.
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <param name="message">The message to log.</param>
|
|
23
56
|
public static void log(object message)
|
|
24
57
|
{
|
|
25
58
|
if (_logType >= LogType.All)
|
|
26
59
|
UnityEngine.Debug.Log(message);
|
|
27
60
|
}
|
|
28
61
|
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Logs an exception if the log level includes exceptions.
|
|
64
|
+
/// </summary>
|
|
65
|
+
/// <param name="exception">The exception to log.</param>
|
|
29
66
|
public static void logException(Exception exception)
|
|
30
67
|
{
|
|
31
68
|
if (_logType >= LogType.Exception)
|
|
32
69
|
UnityEngine.Debug.LogException(exception);
|
|
33
70
|
}
|
|
34
71
|
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// Logs a warning message if the log level includes warnings.
|
|
74
|
+
/// </summary>
|
|
75
|
+
/// <param name="message">The warning message to log.</param>
|
|
35
76
|
public static void logWarning(object message)
|
|
36
77
|
{
|
|
37
78
|
if (_logType >= LogType.Warning)
|
|
38
79
|
UnityEngine.Debug.LogWarning(message);
|
|
39
80
|
}
|
|
40
81
|
|
|
82
|
+
/// <summary>
|
|
83
|
+
/// Logs an error message if the log level includes errors.
|
|
84
|
+
/// </summary>
|
|
85
|
+
/// <param name="message">The error message to log.</param>
|
|
41
86
|
public static void logError(object message)
|
|
42
87
|
{
|
|
43
88
|
if (_logType >= LogType.Error)
|
|
44
89
|
UnityEngine.Debug.LogError(message);
|
|
45
90
|
}
|
|
46
|
-
|
|
47
91
|
}
|
|
48
|
-
|
|
49
92
|
}
|
|
@@ -1,35 +1,57 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Networking
|
|
2
2
|
{
|
|
3
|
+
/// <summary>
|
|
4
|
+
/// Represents the authentication status of a user.
|
|
5
|
+
/// </summary>
|
|
3
6
|
public class AuthenticateStatus
|
|
4
7
|
{
|
|
5
|
-
private string authToken;
|
|
6
|
-
private string userId;
|
|
8
|
+
private string authToken; // Stores the authentication token.
|
|
9
|
+
private string userId; // Stores the user ID.
|
|
7
10
|
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// Gets the authentication token.
|
|
13
|
+
/// </summary>
|
|
14
|
+
/// <returns>The current authentication token.</returns>
|
|
8
15
|
public string getAuthToken()
|
|
9
16
|
{
|
|
10
17
|
return this.authToken;
|
|
11
18
|
}
|
|
12
19
|
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Sets the authentication token.
|
|
22
|
+
/// </summary>
|
|
23
|
+
/// <param name="authToken">The authentication token to set.</param>
|
|
13
24
|
internal void setAuthToken(string authToken)
|
|
14
25
|
{
|
|
15
26
|
this.authToken = authToken;
|
|
16
27
|
}
|
|
17
28
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
29
|
+
// Uncomment this method if needed in the future to validate login and token expiry.
|
|
30
|
+
// /// <summary>
|
|
31
|
+
// /// Checks if the user is logged in and the authentication token is valid.
|
|
32
|
+
// /// </summary>
|
|
33
|
+
// /// <returns>True if logged in and valid, otherwise false.</returns>
|
|
34
|
+
// public bool isLoginAndValid()
|
|
35
|
+
// {
|
|
36
|
+
// return string.IsNullOrEmpty(this.authToken) && (authTokenTsExpire == -1 || GNNetwork.getServerTimestamp() < authTokenTsExpire);
|
|
37
|
+
// }
|
|
22
38
|
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// Gets the user ID.
|
|
41
|
+
/// </summary>
|
|
42
|
+
/// <returns>The current user ID.</returns>
|
|
23
43
|
public string getUserId()
|
|
24
44
|
{
|
|
25
45
|
return this.userId;
|
|
26
46
|
}
|
|
27
47
|
|
|
48
|
+
/// <summary>
|
|
49
|
+
/// Sets the user ID.
|
|
50
|
+
/// </summary>
|
|
51
|
+
/// <param name="userId">The user ID to set.</param>
|
|
28
52
|
internal void setUserId(string userId)
|
|
29
53
|
{
|
|
30
54
|
this.userId = userId;
|
|
31
55
|
}
|
|
32
|
-
|
|
33
56
|
}
|
|
34
|
-
|
|
35
57
|
}
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
using XmobiTea.GN.Entity;
|
|
4
4
|
|
|
5
5
|
/// <summary>
|
|
6
|
-
///
|
|
6
|
+
/// Defines an interface for handling server events.
|
|
7
|
+
/// Classes that implement this interface must define how to handle specific events.
|
|
7
8
|
/// </summary>
|
|
8
9
|
public interface IServerEventHandler
|
|
9
10
|
{
|
|
10
11
|
/// <summary>
|
|
11
|
-
///
|
|
12
|
+
/// Gets the event code associated with the handler.
|
|
13
|
+
/// The event codes should be defined in the EventCode file.
|
|
12
14
|
/// </summary>
|
|
13
|
-
/// <returns
|
|
15
|
+
/// <returns>An integer representing the event code.</returns>
|
|
14
16
|
int getEventCode();
|
|
15
17
|
|
|
16
18
|
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
///
|
|
19
|
+
/// Handles the specified operation event.
|
|
20
|
+
/// This method defines how to process the provided event.
|
|
19
21
|
/// </summary>
|
|
20
|
-
/// <param name="operationEvent">
|
|
22
|
+
/// <param name="operationEvent">The operation event that needs to be handled.</param>
|
|
21
23
|
void handle(OperationEvent operationEvent);
|
|
22
|
-
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
}
|
|
@@ -7,26 +7,55 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a character's player friend list.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class CharacterPlayerFriendUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID.
|
|
17
|
+
/// </summary>
|
|
12
18
|
[StringDataMember(code = GNParameterCode.CharacterId)]
|
|
13
19
|
public string characterId;
|
|
14
20
|
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player friends associated with the character.
|
|
23
|
+
/// </summary>
|
|
15
24
|
[GNArrayDataMember(code = GNParameterCode.PlayerFriends, elementCls = typeof(GenericModels.FriendItem))]
|
|
16
25
|
public List<GenericModels.FriendItem> playerFriends;
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnCharacterPlayerFriendUpdate" event.
|
|
30
|
+
/// This handler processes the event and triggers the corresponding update logic.
|
|
31
|
+
/// </summary>
|
|
19
32
|
public class OnCharacterPlayerFriendUpdateEventHandler : IServerEventHandler
|
|
20
33
|
{
|
|
34
|
+
/// <summary>
|
|
35
|
+
/// Event triggered when a character's player friend list is updated.
|
|
36
|
+
/// Subscribing to this action allows handling the update logic.
|
|
37
|
+
/// </summary>
|
|
21
38
|
public static Action<CharacterPlayerFriendUpdate> onUpdate;
|
|
22
39
|
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// Gets the event code associated with this handler.
|
|
42
|
+
/// </summary>
|
|
43
|
+
/// <returns>
|
|
44
|
+
/// The event code for "OnCharacterPlayerFriendUpdate".
|
|
45
|
+
/// </returns>
|
|
23
46
|
public int getEventCode() => EventCode.OnCharacterPlayerFriendUpdate;
|
|
24
47
|
|
|
48
|
+
/// <summary>
|
|
49
|
+
/// Handles the "OnCharacterPlayerFriendUpdate" operation event.
|
|
50
|
+
/// This method deserializes the event parameters and invokes the update action.
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <param name="operationEvent">
|
|
53
|
+
/// The operation event containing the parameters for the character player friend update.
|
|
54
|
+
/// </param>
|
|
25
55
|
public void handle(OperationEvent operationEvent)
|
|
26
56
|
{
|
|
57
|
+
// Deserialize the event parameters and invoke the onUpdate action.
|
|
27
58
|
OnCharacterPlayerFriendUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<CharacterPlayerFriendUpdate>(operationEvent.getParameters()));
|
|
28
59
|
}
|
|
29
|
-
|
|
30
60
|
}
|
|
31
|
-
|
|
32
61
|
}
|
|
@@ -7,27 +7,48 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a character's player group list.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class CharacterPlayerGroupUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID.
|
|
17
|
+
/// </summary>
|
|
12
18
|
[StringDataMember(code = GNParameterCode.CharacterId)]
|
|
13
19
|
public string characterId;
|
|
14
20
|
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player groups associated with the character.
|
|
23
|
+
/// </summary>
|
|
15
24
|
[GNArrayDataMember(code = GNParameterCode.PlayerGroups, elementCls = typeof(GenericModels.GroupItem))]
|
|
16
25
|
public List<GenericModels.GroupItem> playerGroups;
|
|
17
|
-
|
|
18
26
|
}
|
|
19
27
|
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnCharacterPlayerGroupUpdate" event.
|
|
30
|
+
/// </summary>
|
|
20
31
|
public class OnCharacterPlayerGroupUpdateEventHandler : IServerEventHandler
|
|
21
32
|
{
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Event triggered when a character's player group list is updated.
|
|
35
|
+
/// </summary>
|
|
22
36
|
public static Action<CharacterPlayerGroupUpdate> onUpdate;
|
|
23
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the event code associated with this handler.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>The event code for "OnCharacterPlayerGroupUpdate".</returns>
|
|
24
42
|
public int getEventCode() => EventCode.OnCharacterPlayerGroupUpdate;
|
|
25
43
|
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Handles the "OnCharacterPlayerGroupUpdate" operation event.
|
|
46
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="operationEvent">The operation event containing the parameters for the group update.</param>
|
|
26
49
|
public void handle(OperationEvent operationEvent)
|
|
27
50
|
{
|
|
28
51
|
OnCharacterPlayerGroupUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<CharacterPlayerGroupUpdate>(operationEvent.getParameters()));
|
|
29
52
|
}
|
|
30
|
-
|
|
31
53
|
}
|
|
32
|
-
|
|
33
54
|
}
|
|
@@ -7,26 +7,48 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a player's friend list in the game.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class GamePlayerFriendUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID (optional).
|
|
17
|
+
/// </summary>
|
|
12
18
|
[StringDataMember(code = GNParameterCode.CharacterId, isOptional = true)]
|
|
13
19
|
public string? characterId;
|
|
14
20
|
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player friends associated with the game player.
|
|
23
|
+
/// </summary>
|
|
15
24
|
[GNArrayDataMember(code = GNParameterCode.PlayerFriends, elementCls = typeof(GenericModels.FriendItem))]
|
|
16
25
|
public List<GenericModels.FriendItem> playerFriends;
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnGamePlayerFriendUpdate" event.
|
|
30
|
+
/// </summary>
|
|
19
31
|
public class OnGamePlayerFriendUpdateEventHandler : IServerEventHandler
|
|
20
32
|
{
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Event triggered when a game player's friend list is updated.
|
|
35
|
+
/// </summary>
|
|
21
36
|
public static Action<GamePlayerFriendUpdate> onUpdate;
|
|
22
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the event code associated with this handler.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>The event code for "OnGamePlayerFriendUpdate".</returns>
|
|
23
42
|
public int getEventCode() => EventCode.OnGamePlayerFriendUpdate;
|
|
24
43
|
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Handles the "OnGamePlayerFriendUpdate" operation event.
|
|
46
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="operationEvent">The operation event containing the parameters for the friend update.</param>
|
|
25
49
|
public void handle(OperationEvent operationEvent)
|
|
26
50
|
{
|
|
27
51
|
OnGamePlayerFriendUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GamePlayerFriendUpdate>(operationEvent.getParameters()));
|
|
28
52
|
}
|
|
29
|
-
|
|
30
53
|
}
|
|
31
|
-
|
|
32
54
|
}
|
|
@@ -7,26 +7,48 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating a player's group list in the game.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class GamePlayerGroupUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// The character ID (optional).
|
|
17
|
+
/// </summary>
|
|
12
18
|
[StringDataMember(code = GNParameterCode.CharacterId, isOptional = true)]
|
|
13
19
|
public string? characterId;
|
|
14
20
|
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// A list of player groups associated with the game player.
|
|
23
|
+
/// </summary>
|
|
15
24
|
[GNArrayDataMember(code = GNParameterCode.PlayerGroups, elementCls = typeof(GenericModels.GroupItem))]
|
|
16
25
|
public List<GenericModels.GroupItem> playerGroups;
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Handles the "OnGamePlayerGroupUpdate" event.
|
|
30
|
+
/// </summary>
|
|
19
31
|
public class OnGamePlayerGroupUpdateEventHandler : IServerEventHandler
|
|
20
32
|
{
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Event triggered when a game player's group list is updated.
|
|
35
|
+
/// </summary>
|
|
21
36
|
public static Action<GamePlayerGroupUpdate> onUpdate;
|
|
22
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the event code associated with this handler.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <returns>The event code for "OnGamePlayerGroupUpdate".</returns>
|
|
23
42
|
public int getEventCode() => EventCode.OnGamePlayerGroupUpdate;
|
|
24
43
|
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Handles the "OnGamePlayerGroupUpdate" operation event.
|
|
46
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
47
|
+
/// </summary>
|
|
48
|
+
/// <param name="operationEvent">The operation event containing the parameters for the group update.</param>
|
|
25
49
|
public void handle(OperationEvent operationEvent)
|
|
26
50
|
{
|
|
27
51
|
OnGamePlayerGroupUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GamePlayerGroupUpdate>(operationEvent.getParameters()));
|
|
28
52
|
}
|
|
29
|
-
|
|
30
53
|
}
|
|
31
|
-
|
|
32
54
|
}
|
|
@@ -7,23 +7,42 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents the data structure for updating group members.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class GroupMemberUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A list of members associated with the group.
|
|
17
|
+
/// </summary>
|
|
12
18
|
[GNArrayDataMember(code = GNParameterCode.Members, elementCls = typeof(GenericModels.FriendItem))]
|
|
13
19
|
public List<GenericModels.MemberItem> members;
|
|
14
20
|
}
|
|
15
21
|
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Handles the "OnGroupMemberUpdate" event.
|
|
24
|
+
/// </summary>
|
|
16
25
|
public class OnGroupMemberUpdateEventHandler : IServerEventHandler
|
|
17
26
|
{
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Event triggered when group members are updated.
|
|
29
|
+
/// </summary>
|
|
18
30
|
public static Action<GroupMemberUpdate> onUpdate;
|
|
19
31
|
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the event code associated with this handler.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <returns>The event code for "OnGroupMemberUpdate".</returns>
|
|
20
36
|
public int getEventCode() => EventCode.OnGroupMemberUpdate;
|
|
21
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Handles the "OnGroupMemberUpdate" operation event.
|
|
40
|
+
/// Deserializes the event parameters and invokes the update action.
|
|
41
|
+
/// </summary>
|
|
42
|
+
/// <param name="operationEvent">The operation event containing the parameters for the group member update.</param>
|
|
22
43
|
public void handle(OperationEvent operationEvent)
|
|
23
44
|
{
|
|
24
45
|
OnGroupMemberUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GroupMemberUpdate>(operationEvent.getParameters()));
|
|
25
46
|
}
|
|
26
|
-
|
|
27
47
|
}
|
|
28
|
-
|
|
29
48
|
}
|
|
@@ -7,23 +7,41 @@
|
|
|
7
7
|
using XmobiTea.GN.Entity.Models;
|
|
8
8
|
using XmobiTea.GN.Helper;
|
|
9
9
|
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Represents an update for group messages.
|
|
12
|
+
/// </summary>
|
|
10
13
|
public class GroupMessageUpdate
|
|
11
14
|
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A list of updated group messages.
|
|
17
|
+
/// </summary>
|
|
12
18
|
[GNArrayDataMember(code = GNParameterCode.GroupMessages, elementCls = typeof(GroupModels.GroupMessageResponseData))]
|
|
13
19
|
public List<GroupModels.GroupMessageResponseData> groupMessages;
|
|
14
20
|
}
|
|
15
21
|
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Event handler for handling updates to group messages.
|
|
24
|
+
/// </summary>
|
|
16
25
|
public class OnGroupMessageUpdateEventHandler : IServerEventHandler
|
|
17
26
|
{
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// An action to be invoked when a group message update occurs.
|
|
29
|
+
/// </summary>
|
|
18
30
|
public static Action<GroupMessageUpdate> onUpdate;
|
|
19
31
|
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the event code associated with the group message update.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <returns>The event code for group message updates.</returns>
|
|
20
36
|
public int getEventCode() => EventCode.OnGroupMessageUpdate;
|
|
21
37
|
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Handles the group message update event.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <param name="operationEvent">The operation event containing the update data.</param>
|
|
22
42
|
public void handle(OperationEvent operationEvent)
|
|
23
43
|
{
|
|
24
44
|
OnGroupMessageUpdateEventHandler.onUpdate?.Invoke(ConverterService.deserializeObject<GroupMessageUpdate>(operationEvent.getParameters()));
|
|
25
45
|
}
|
|
26
|
-
|
|
27
46
|
}
|
|
28
|
-
|
|
29
47
|
}
|