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
|
@@ -1,25 +1,73 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Constant
|
|
2
2
|
{
|
|
3
|
+
/// <summary>
|
|
4
|
+
/// Defines constant return codes used to represent various operation outcomes.
|
|
5
|
+
/// </summary>
|
|
3
6
|
public class ReturnCode
|
|
4
7
|
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Indicates that the provided secret is invalid.
|
|
10
|
+
/// </summary>
|
|
5
11
|
public const int SecretInvalid = -10;
|
|
12
|
+
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Indicates that the request was rejected due to exceeding the maximum allowed size.
|
|
15
|
+
/// </summary>
|
|
6
16
|
public const int MaxSizeRequestReject = -9;
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// Indicates that the request was rejected due to exceeding the maximum allowed request limit.
|
|
20
|
+
/// </summary>
|
|
7
21
|
public const int MaxRequestReject = -8;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// Indicates that the request was rejected due to exceeding the maximum concurrent users limit.
|
|
25
|
+
/// </summary>
|
|
8
26
|
public const int MaxCCUReject = -7;
|
|
9
27
|
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Indicates that the operation is not authorized.
|
|
30
|
+
/// </summary>
|
|
10
31
|
public const int OperationNotAuthorized = -6;
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Indicates that the request contains invalid parameters.
|
|
35
|
+
/// </summary>
|
|
11
36
|
public const int InvalidRequestParameters = -5;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Indicates that the operation is invalid.
|
|
40
|
+
/// </summary>
|
|
12
41
|
public const int OperationInvalid = -4;
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Indicates an internal server error.
|
|
45
|
+
/// </summary>
|
|
13
46
|
public const int InternalServerError = -3;
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
/// Indicates that the operation is not allowed.
|
|
50
|
+
/// </summary>
|
|
14
51
|
public const int OperationNotAllow = -2;
|
|
52
|
+
|
|
53
|
+
/// <summary>
|
|
54
|
+
/// Indicates that the operation timed out.
|
|
55
|
+
/// </summary>
|
|
15
56
|
public const int OperationTimeout = -1;
|
|
16
57
|
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// Indicates an unknown error occurred.
|
|
60
|
+
/// </summary>
|
|
17
61
|
public const int UnknownError = 0;
|
|
18
62
|
|
|
63
|
+
/// <summary>
|
|
64
|
+
/// Indicates that the operation completed successfully.
|
|
65
|
+
/// </summary>
|
|
19
66
|
public const int Ok = 1;
|
|
20
67
|
|
|
68
|
+
/// <summary>
|
|
69
|
+
/// Private constructor to prevent instantiation of this utility class.
|
|
70
|
+
/// </summary>
|
|
21
71
|
private ReturnCode() { }
|
|
22
|
-
|
|
23
72
|
}
|
|
24
|
-
|
|
25
73
|
}
|
|
@@ -4,121 +4,339 @@ using XmobiTea.GN.Common;
|
|
|
4
4
|
|
|
5
5
|
namespace XmobiTea.GN.Entity
|
|
6
6
|
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Enhanced metadata for an object field in the GN system.
|
|
9
|
+
/// </summary>
|
|
7
10
|
public interface IGNEnhancedObjectFieldMetadata : GNObjectFieldMetadata
|
|
8
11
|
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Gets or sets the code associated with the field.
|
|
14
|
+
/// </summary>
|
|
9
15
|
string code { get; set; }
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// Gets or sets whether the field is optional.
|
|
19
|
+
/// </summary>
|
|
10
20
|
bool isOptional { get; set; }
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Gets or sets the data type of the field.
|
|
24
|
+
/// </summary>
|
|
11
25
|
GNFieldDataType gnFieldType { get; set; }
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Gets or sets the default value of the field.
|
|
29
|
+
/// </summary>
|
|
12
30
|
object defaultValue { get; set; }
|
|
13
31
|
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets or sets whether the active condition validation is valid.
|
|
34
|
+
/// </summary>
|
|
14
35
|
bool activeConditionValid { get; set; }
|
|
15
36
|
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Gets or sets whether the field must be non-null.
|
|
39
|
+
/// </summary>
|
|
16
40
|
bool? mustNonNull { get; set; }
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Gets or sets the minimum length for the field's value, if applicable.
|
|
44
|
+
/// </summary>
|
|
17
45
|
int? minLength { get; set; }
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Gets or sets the maximum length for the field's value, if applicable.
|
|
49
|
+
/// </summary>
|
|
18
50
|
int? maxLength { get; set; }
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Gets or sets the minimum value for the field, if applicable.
|
|
54
|
+
/// </summary>
|
|
19
55
|
double? minValue { get; set; }
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Gets or sets the maximum value for the field, if applicable.
|
|
59
|
+
/// </summary>
|
|
20
60
|
double? maxValue { get; set; }
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Gets or sets whether the field's value must be an integer.
|
|
64
|
+
/// </summary>
|
|
21
65
|
bool? mustInt { get; set; }
|
|
22
66
|
}
|
|
23
67
|
|
|
68
|
+
/// <summary>
|
|
69
|
+
/// Implementation of the enhanced metadata for an object field in the GN system.
|
|
70
|
+
/// </summary>
|
|
24
71
|
public class GNEnhancedObjectFieldMetadata : IGNEnhancedObjectFieldMetadata
|
|
25
72
|
{
|
|
73
|
+
/// <inheritdoc/>
|
|
26
74
|
public string code { get; set; }
|
|
75
|
+
|
|
76
|
+
/// <inheritdoc/>
|
|
27
77
|
public bool isOptional { get; set; }
|
|
78
|
+
|
|
79
|
+
/// <inheritdoc/>
|
|
28
80
|
public GNFieldDataType gnFieldType { get; set; }
|
|
81
|
+
|
|
82
|
+
/// <inheritdoc/>
|
|
29
83
|
public object defaultValue { get; set; }
|
|
84
|
+
|
|
85
|
+
/// <inheritdoc/>
|
|
30
86
|
public bool activeConditionValid { get; set; }
|
|
87
|
+
|
|
88
|
+
/// <inheritdoc/>
|
|
31
89
|
public bool? mustNonNull { get; set; }
|
|
90
|
+
|
|
91
|
+
/// <inheritdoc/>
|
|
32
92
|
public int? minLength { get; set; }
|
|
93
|
+
|
|
94
|
+
/// <inheritdoc/>
|
|
33
95
|
public int? maxLength { get; set; }
|
|
96
|
+
|
|
97
|
+
/// <inheritdoc/>
|
|
34
98
|
public double? minValue { get; set; }
|
|
99
|
+
|
|
100
|
+
/// <inheritdoc/>
|
|
35
101
|
public double? maxValue { get; set; }
|
|
102
|
+
|
|
103
|
+
/// <inheritdoc/>
|
|
36
104
|
public bool? mustInt { get; set; }
|
|
37
105
|
|
|
106
|
+
/// <inheritdoc/>
|
|
38
107
|
public string name { get; }
|
|
108
|
+
|
|
109
|
+
/// <inheritdoc/>
|
|
39
110
|
public FieldDataType fieldType { get; }
|
|
111
|
+
|
|
112
|
+
/// <inheritdoc/>
|
|
40
113
|
public Type cls { get; }
|
|
41
114
|
|
|
115
|
+
/// <inheritdoc/>
|
|
42
116
|
public FieldInfo fieldInfo { get; }
|
|
43
117
|
|
|
118
|
+
/// <summary>
|
|
119
|
+
/// Initializes a new instance of the <see cref="GNEnhancedObjectFieldMetadata"/> class.
|
|
120
|
+
/// </summary>
|
|
121
|
+
/// <param name="name">The name of the field.</param>
|
|
122
|
+
/// <param name="fieldType">The type of data stored in the field.</param>
|
|
123
|
+
/// <param name="cls">The class type associated with the field.</param>
|
|
124
|
+
/// <param name="fieldInfo">The reflection field information for the field.</param>
|
|
44
125
|
public GNEnhancedObjectFieldMetadata(string name, FieldDataType fieldType, Type cls, FieldInfo fieldInfo)
|
|
45
126
|
{
|
|
46
127
|
this.name = name;
|
|
47
128
|
this.fieldType = fieldType;
|
|
48
129
|
this.cls = cls;
|
|
49
|
-
|
|
50
130
|
this.fieldInfo = fieldInfo;
|
|
51
131
|
}
|
|
52
132
|
}
|
|
53
133
|
|
|
134
|
+
/// <summary>
|
|
135
|
+
/// Enumeration of GN field data types.
|
|
136
|
+
/// </summary>
|
|
54
137
|
public enum GNFieldDataType
|
|
55
138
|
{
|
|
139
|
+
/// <summary>
|
|
140
|
+
/// Represents an undefined or other data type.
|
|
141
|
+
/// </summary>
|
|
56
142
|
Other = 0,
|
|
143
|
+
|
|
144
|
+
/// <summary>
|
|
145
|
+
/// Represents numeric data types (e.g., int, float, double).
|
|
146
|
+
/// </summary>
|
|
57
147
|
Number = 1,
|
|
148
|
+
|
|
149
|
+
/// <summary>
|
|
150
|
+
/// Represents string data types.
|
|
151
|
+
/// </summary>
|
|
58
152
|
String = 2,
|
|
153
|
+
|
|
154
|
+
/// <summary>
|
|
155
|
+
/// Represents boolean data types.
|
|
156
|
+
/// </summary>
|
|
59
157
|
Boolean = 3,
|
|
158
|
+
|
|
159
|
+
/// <summary>
|
|
160
|
+
/// Represents GNHashtable data types.
|
|
161
|
+
/// </summary>
|
|
60
162
|
GNHashtable = 4,
|
|
61
|
-
GNArray = 5,
|
|
62
163
|
|
|
164
|
+
/// <summary>
|
|
165
|
+
/// Represents GNArray data types.
|
|
166
|
+
/// </summary>
|
|
167
|
+
GNArray = 5,
|
|
63
168
|
}
|
|
64
169
|
|
|
170
|
+
/// <summary>
|
|
171
|
+
/// Base attribute for data member fields with optional metadata.
|
|
172
|
+
/// </summary>
|
|
65
173
|
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
|
|
66
174
|
public class DataMemberAttribute : Attribute
|
|
67
175
|
{
|
|
176
|
+
/// <summary>
|
|
177
|
+
/// Gets the field data type, defaults to Other.
|
|
178
|
+
/// </summary>
|
|
68
179
|
public virtual GNFieldDataType gnFieldType => GNFieldDataType.Other;
|
|
69
180
|
|
|
181
|
+
/// <summary>
|
|
182
|
+
/// Gets or sets the code associated with the field.
|
|
183
|
+
/// </summary>
|
|
70
184
|
public string code { get; set; }
|
|
185
|
+
|
|
186
|
+
/// <summary>
|
|
187
|
+
/// Gets or sets whether the field is optional. Default is false.
|
|
188
|
+
/// </summary>
|
|
71
189
|
public bool isOptional { get; set; } = false;
|
|
72
190
|
|
|
191
|
+
/// <summary>
|
|
192
|
+
/// Gets or sets the default value for the field.
|
|
193
|
+
/// </summary>
|
|
73
194
|
public object defaultValue { get; set; } = null;
|
|
74
195
|
}
|
|
75
196
|
|
|
197
|
+
/// <summary>
|
|
198
|
+
/// Attribute for string data member fields with additional constraints.
|
|
199
|
+
/// </summary>
|
|
76
200
|
public class StringDataMemberAttribute : DataMemberAttribute
|
|
77
201
|
{
|
|
202
|
+
/// <summary>
|
|
203
|
+
/// Overrides the field data type to String.
|
|
204
|
+
/// </summary>
|
|
78
205
|
public override GNFieldDataType gnFieldType => GNFieldDataType.String;
|
|
79
206
|
|
|
207
|
+
/// <summary>
|
|
208
|
+
/// Gets or sets the default value for the string field.
|
|
209
|
+
/// </summary>
|
|
80
210
|
public new string defaultValue { get; set; }
|
|
81
211
|
|
|
212
|
+
/// <summary>
|
|
213
|
+
/// Gets or sets whether the string must be non-null. Default is false.
|
|
214
|
+
/// </summary>
|
|
82
215
|
public bool mustNonNull { get; set; } = false;
|
|
216
|
+
|
|
217
|
+
/// <summary>
|
|
218
|
+
/// Gets or sets the minimum length for the string. Default is -1 (no constraint).
|
|
219
|
+
/// </summary>
|
|
83
220
|
public int minLength { get; set; } = -1;
|
|
221
|
+
|
|
222
|
+
/// <summary>
|
|
223
|
+
/// Gets or sets the maximum length for the string. Default is -1 (no constraint).
|
|
224
|
+
/// </summary>
|
|
84
225
|
public int maxLength { get; set; } = -1;
|
|
85
226
|
}
|
|
86
227
|
|
|
228
|
+
/// <summary>
|
|
229
|
+
/// Attribute for boolean data member fields with additional constraints.
|
|
230
|
+
/// </summary>
|
|
87
231
|
public class BooleanDataMemberAttribute : DataMemberAttribute
|
|
88
232
|
{
|
|
233
|
+
/// <summary>
|
|
234
|
+
/// Overrides the field data type to Boolean.
|
|
235
|
+
/// </summary>
|
|
89
236
|
public override GNFieldDataType gnFieldType => GNFieldDataType.Boolean;
|
|
90
237
|
|
|
238
|
+
/// <summary>
|
|
239
|
+
/// Gets or sets the default value for the boolean field. Default is false.
|
|
240
|
+
/// </summary>
|
|
91
241
|
public new bool defaultValue { get; set; } = false;
|
|
92
242
|
}
|
|
93
243
|
|
|
244
|
+
/// <summary>
|
|
245
|
+
/// Attribute for GNHashtable data member fields with additional constraints.
|
|
246
|
+
/// </summary>
|
|
94
247
|
public class GNHashtableDataMemberAttribute : DataMemberAttribute
|
|
95
248
|
{
|
|
249
|
+
/// <summary>
|
|
250
|
+
/// Overrides the field data type to GNHashtable.
|
|
251
|
+
/// </summary>
|
|
96
252
|
public override GNFieldDataType gnFieldType => GNFieldDataType.GNHashtable;
|
|
97
253
|
|
|
254
|
+
/// <summary>
|
|
255
|
+
/// Gets or sets the default value for the GNHashtable field.
|
|
256
|
+
/// </summary>
|
|
98
257
|
public new GNHashtable defaultValue { get; set; } = null;
|
|
258
|
+
|
|
259
|
+
/// <summary>
|
|
260
|
+
/// Gets or sets whether the GNHashtable must be non-null. Default is false.
|
|
261
|
+
/// </summary>
|
|
99
262
|
public bool mustNonNull { get; set; } = false;
|
|
263
|
+
|
|
264
|
+
/// <summary>
|
|
265
|
+
/// Gets or sets the minimum length for the GNHashtable. Default is -1 (no constraint).
|
|
266
|
+
/// </summary>
|
|
100
267
|
public int minLength { get; set; } = -1;
|
|
268
|
+
|
|
269
|
+
/// <summary>
|
|
270
|
+
/// Gets or sets the maximum length for the GNHashtable. Default is -1 (no constraint).
|
|
271
|
+
/// </summary>
|
|
101
272
|
public int maxLength { get; set; } = -1;
|
|
102
273
|
}
|
|
103
274
|
|
|
275
|
+
/// <summary>
|
|
276
|
+
/// Attribute for GNArray data member fields with additional constraints.
|
|
277
|
+
/// </summary>
|
|
104
278
|
public class GNArrayDataMemberAttribute : DataMemberAttribute
|
|
105
279
|
{
|
|
280
|
+
/// <summary>
|
|
281
|
+
/// Overrides the field data type to GNArray.
|
|
282
|
+
/// </summary>
|
|
106
283
|
public override GNFieldDataType gnFieldType => GNFieldDataType.GNArray;
|
|
107
284
|
|
|
285
|
+
/// <summary>
|
|
286
|
+
/// Gets or sets the default value for the GNArray field.
|
|
287
|
+
/// </summary>
|
|
108
288
|
public new GNArray defaultValue { get; set; } = null;
|
|
289
|
+
|
|
290
|
+
/// <summary>
|
|
291
|
+
/// Gets or sets whether the GNArray must be non-null. Default is false.
|
|
292
|
+
/// </summary>
|
|
109
293
|
public bool mustNonNull { get; set; } = false;
|
|
294
|
+
|
|
295
|
+
/// <summary>
|
|
296
|
+
/// Gets or sets the minimum length for the GNArray. Default is -1 (no constraint).
|
|
297
|
+
/// </summary>
|
|
110
298
|
public int minLength { get; set; } = -1;
|
|
299
|
+
|
|
300
|
+
/// <summary>
|
|
301
|
+
/// Gets or sets the maximum length for the GNArray. Default is -1 (no constraint).
|
|
302
|
+
/// </summary>
|
|
111
303
|
public int maxLength { get; set; } = -1;
|
|
304
|
+
|
|
305
|
+
/// <summary>
|
|
306
|
+
/// Gets or sets the type of elements in the GNArray.
|
|
307
|
+
/// </summary>
|
|
112
308
|
public Type elementCls { get; set; } = null;
|
|
113
309
|
}
|
|
114
310
|
|
|
311
|
+
/// <summary>
|
|
312
|
+
/// Attribute for numeric data member fields with additional constraints.
|
|
313
|
+
/// </summary>
|
|
115
314
|
public class NumberDataMemberAttribute : DataMemberAttribute
|
|
116
315
|
{
|
|
316
|
+
/// <summary>
|
|
317
|
+
/// Overrides the field data type to Number.
|
|
318
|
+
/// </summary>
|
|
117
319
|
public override GNFieldDataType gnFieldType => GNFieldDataType.Number;
|
|
118
320
|
|
|
119
|
-
|
|
321
|
+
/// <summary>
|
|
322
|
+
/// Gets or sets the default value for the numeric field.
|
|
323
|
+
/// </summary>
|
|
324
|
+
public new double defaultValue { get; set; }
|
|
325
|
+
|
|
326
|
+
/// <summary>
|
|
327
|
+
/// Gets or sets the minimum value for the numeric field. Default is -1 (no constraint).
|
|
328
|
+
/// </summary>
|
|
120
329
|
public double minValue { get; set; } = -1;
|
|
330
|
+
|
|
331
|
+
/// <summary>
|
|
332
|
+
/// Gets or sets the maximum value for the numeric field. Default is -1 (no constraint).
|
|
333
|
+
/// </summary>
|
|
121
334
|
public double maxValue { get; set; } = -1;
|
|
335
|
+
|
|
336
|
+
/// <summary>
|
|
337
|
+
/// Gets or sets whether the numeric field must be an integer. Default is false.
|
|
338
|
+
/// </summary>
|
|
122
339
|
public bool mustInt { get; set; } = false;
|
|
123
340
|
}
|
|
341
|
+
|
|
124
342
|
}
|
|
@@ -2,26 +2,71 @@
|
|
|
2
2
|
{
|
|
3
3
|
using System;
|
|
4
4
|
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Enum representing the various data types for object fields.
|
|
7
|
+
/// </summary>
|
|
5
8
|
public enum FieldDataType
|
|
6
9
|
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Boolean data type.
|
|
12
|
+
/// </summary>
|
|
7
13
|
Boolean = 0,
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// Numeric data type.
|
|
17
|
+
/// </summary>
|
|
8
18
|
Number = 1,
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// String data type.
|
|
22
|
+
/// </summary>
|
|
9
23
|
String = 2,
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// Array data type.
|
|
27
|
+
/// </summary>
|
|
10
28
|
Array = 3,
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Object data type.
|
|
32
|
+
/// </summary>
|
|
11
33
|
Object = 4,
|
|
12
34
|
}
|
|
13
35
|
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Metadata describing a field in a GN object.
|
|
38
|
+
/// </summary>
|
|
14
39
|
public interface GNObjectFieldMetadata
|
|
15
40
|
{
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Gets the name of the field.
|
|
43
|
+
/// </summary>
|
|
16
44
|
string name { get; }
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// Gets the type of the field.
|
|
48
|
+
/// </summary>
|
|
17
49
|
FieldDataType fieldType { get; }
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
/// Gets the class type of the field, if applicable.
|
|
53
|
+
/// </summary>
|
|
18
54
|
Type cls { get; }
|
|
19
55
|
}
|
|
20
56
|
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Metadata describing a GN object.
|
|
59
|
+
/// </summary>
|
|
21
60
|
public interface GNObjectMetadata
|
|
22
61
|
{
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Gets the unique identifier for the GN object.
|
|
64
|
+
/// </summary>
|
|
23
65
|
string id { get; }
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// Gets an array of field metadata for the GN object.
|
|
69
|
+
/// </summary>
|
|
24
70
|
GNObjectFieldMetadata[] fields { get; }
|
|
25
71
|
}
|
|
26
|
-
|
|
27
72
|
}
|
|
@@ -3,31 +3,50 @@
|
|
|
3
3
|
using System.Text;
|
|
4
4
|
using XmobiTea.GN.Constant;
|
|
5
5
|
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Represents an invalid member with its code and type of invalidation.
|
|
8
|
+
/// </summary>
|
|
6
9
|
public struct InvalidMember
|
|
7
10
|
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// Gets the code identifying the invalid member.
|
|
13
|
+
/// </summary>
|
|
8
14
|
public string code { get; private set; }
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Gets the type of invalidation for the member.
|
|
18
|
+
/// </summary>
|
|
9
19
|
public InvalidMemberType invalidMemberType { get; private set; }
|
|
10
20
|
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Initializes a new instance of the <see cref="InvalidMember"/> struct.
|
|
23
|
+
/// </summary>
|
|
24
|
+
/// <param name="code">The code identifying the invalid member.</param>
|
|
25
|
+
/// <param name="invalidMemberType">The type of invalidation.</param>
|
|
11
26
|
public InvalidMember(string code, InvalidMemberType invalidMemberType)
|
|
12
27
|
{
|
|
13
28
|
this.code = code;
|
|
14
29
|
this.invalidMemberType = invalidMemberType;
|
|
15
30
|
}
|
|
16
31
|
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Converts the invalid member to a string representation.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <returns>A string describing the invalid member.</returns>
|
|
17
36
|
public string toString()
|
|
18
37
|
{
|
|
19
38
|
var stringBuilder = new StringBuilder();
|
|
20
|
-
|
|
21
|
-
stringBuilder.Append("Code: " + this.code + ", InvalidMemberType " + this.invalidMemberType);
|
|
22
|
-
|
|
39
|
+
stringBuilder.Append("Code: " + this.code + ", InvalidMemberType: " + this.invalidMemberType);
|
|
23
40
|
return stringBuilder.ToString();
|
|
24
41
|
}
|
|
25
42
|
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Overrides the default ToString method.
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <returns>A string describing the invalid member.</returns>
|
|
26
47
|
public override string ToString()
|
|
27
48
|
{
|
|
28
49
|
return this.toString();
|
|
29
50
|
}
|
|
30
|
-
|
|
31
51
|
}
|
|
32
|
-
|
|
33
52
|
}
|