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
|
@@ -5,65 +5,61 @@
|
|
|
5
5
|
using System.Text;
|
|
6
6
|
|
|
7
7
|
/// <summary>
|
|
8
|
-
///
|
|
8
|
+
/// Represents a GNData array, which can be used for request or response data.
|
|
9
9
|
/// </summary>
|
|
10
10
|
public class GNArray : GNData
|
|
11
11
|
{
|
|
12
12
|
/// <summary>
|
|
13
|
-
///
|
|
13
|
+
/// A builder class to help construct a GNArray.
|
|
14
14
|
/// </summary>
|
|
15
15
|
public class Builder
|
|
16
16
|
{
|
|
17
17
|
/// <summary>
|
|
18
|
-
/// The
|
|
18
|
+
/// The internal list representing the array.
|
|
19
19
|
/// </summary>
|
|
20
20
|
private List<object> array;
|
|
21
21
|
|
|
22
22
|
/// <summary>
|
|
23
|
-
///
|
|
23
|
+
/// Adds a value to the internal array.
|
|
24
24
|
/// </summary>
|
|
25
|
-
/// <param name="value">The value
|
|
26
|
-
/// <returns
|
|
25
|
+
/// <param name="value">The value to add, must be a supported type.</param>
|
|
26
|
+
/// <returns>The current Builder instance.</returns>
|
|
27
27
|
public Builder add(object value)
|
|
28
28
|
{
|
|
29
29
|
this.array.Add(value);
|
|
30
|
-
|
|
31
30
|
return this;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/// <summary>
|
|
35
|
-
///
|
|
34
|
+
/// Adds a collection of values to the internal array.
|
|
36
35
|
/// </summary>
|
|
37
|
-
/// <param name="list">The
|
|
38
|
-
/// <returns
|
|
36
|
+
/// <param name="list">The list of values to add.</param>
|
|
37
|
+
/// <returns>The current Builder instance.</returns>
|
|
39
38
|
public Builder addAll(System.Collections.IList list)
|
|
40
39
|
{
|
|
41
40
|
foreach (var o in list)
|
|
42
41
|
{
|
|
43
42
|
this.add(o);
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
return this;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
/// <summary>
|
|
50
|
-
///
|
|
48
|
+
/// Builds and returns the GNArray.
|
|
51
49
|
/// </summary>
|
|
52
|
-
/// <returns
|
|
50
|
+
/// <returns>The constructed GNArray instance.</returns>
|
|
53
51
|
public GNArray build()
|
|
54
52
|
{
|
|
55
|
-
var
|
|
56
|
-
|
|
53
|
+
var answer = new GNArray();
|
|
57
54
|
foreach (var o in this.array)
|
|
58
55
|
{
|
|
59
|
-
|
|
56
|
+
answer.add(o);
|
|
60
57
|
}
|
|
61
|
-
|
|
62
|
-
return awnser;
|
|
58
|
+
return answer;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
/// <summary>
|
|
66
|
-
///
|
|
62
|
+
/// Initializes a new instance of the Builder class.
|
|
67
63
|
/// </summary>
|
|
68
64
|
public Builder()
|
|
69
65
|
{
|
|
@@ -72,12 +68,12 @@
|
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
/// <summary>
|
|
75
|
-
/// The
|
|
71
|
+
/// The internal array storing the data.
|
|
76
72
|
/// </summary>
|
|
77
73
|
private List<object> array;
|
|
78
74
|
|
|
79
75
|
/// <summary>
|
|
80
|
-
///
|
|
76
|
+
/// Initializes a new instance of the GNArray class.
|
|
81
77
|
/// </summary>
|
|
82
78
|
public GNArray()
|
|
83
79
|
{
|
|
@@ -85,76 +81,114 @@
|
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
/// <summary>
|
|
88
|
-
///
|
|
84
|
+
/// Adds a value to the GNArray.
|
|
89
85
|
/// </summary>
|
|
90
|
-
/// <param name="value">The
|
|
86
|
+
/// <param name="value">The value to add.</param>
|
|
91
87
|
public void add(object value)
|
|
92
88
|
{
|
|
93
89
|
this.array.Add(GNData.createUseDataFromOriginData(value));
|
|
94
90
|
}
|
|
95
91
|
|
|
92
|
+
/// <summary>
|
|
93
|
+
/// Gets or sets a value in the GNArray by index.
|
|
94
|
+
/// </summary>
|
|
95
|
+
/// <param name="index">The index of the value.</param>
|
|
96
|
+
/// <returns>The value at the specified index.</returns>
|
|
97
|
+
public object this[int index]
|
|
98
|
+
{
|
|
99
|
+
get => this.get<object>(index);
|
|
100
|
+
set => this.array[index] = GNData.createUseDataFromOriginData(value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// Gets all values in the GNArray as a collection.
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <returns>A collection of all values in the GNArray.</returns>
|
|
96
107
|
public ICollection<object> values()
|
|
97
108
|
{
|
|
98
109
|
return this.array;
|
|
99
110
|
}
|
|
100
111
|
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// Clears all elements in the GNArray.
|
|
114
|
+
/// </summary>
|
|
101
115
|
public void clear()
|
|
102
116
|
{
|
|
103
117
|
this.array.Clear();
|
|
104
118
|
}
|
|
105
119
|
|
|
120
|
+
/// <summary>
|
|
121
|
+
/// Removes a value at the specified index.
|
|
122
|
+
/// </summary>
|
|
123
|
+
/// <param name="index">The index of the value to remove.</param>
|
|
124
|
+
/// <returns>True if the value was removed.</returns>
|
|
106
125
|
public bool remove(int index)
|
|
107
126
|
{
|
|
108
127
|
this.array.RemoveAt(index);
|
|
109
|
-
|
|
110
128
|
return true;
|
|
111
129
|
}
|
|
112
130
|
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// Gets the number of elements in the GNArray.
|
|
133
|
+
/// </summary>
|
|
134
|
+
/// <returns>The number of elements.</returns>
|
|
113
135
|
public int count()
|
|
114
136
|
{
|
|
115
137
|
return this.array.Count;
|
|
116
138
|
}
|
|
117
139
|
|
|
140
|
+
/// <summary>
|
|
141
|
+
/// Gets a value at the specified index.
|
|
142
|
+
/// </summary>
|
|
143
|
+
/// <typeparam name="T">The expected type of the value.</typeparam>
|
|
144
|
+
/// <param name="k">The index.</param>
|
|
145
|
+
/// <param name="defaultValue">The default value to return if the index is invalid.</param>
|
|
146
|
+
/// <returns>The value at the index or the default value.</returns>
|
|
118
147
|
protected object get<T>(int k, T defaultValue = default(T))
|
|
119
148
|
{
|
|
120
149
|
if (k < 0 || k > this.array.Count - 1) return defaultValue;
|
|
121
150
|
|
|
122
151
|
var value = this.array[k];
|
|
123
|
-
|
|
124
152
|
if (value == null) return defaultValue;
|
|
125
153
|
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
return t;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return value;
|
|
154
|
+
return value is T t ? t : value;
|
|
132
155
|
}
|
|
133
156
|
|
|
157
|
+
/// <summary>
|
|
158
|
+
/// Converts the GNArray to an array of the specified type.
|
|
159
|
+
/// </summary>
|
|
160
|
+
/// <typeparam name="T">The target type.</typeparam>
|
|
161
|
+
/// <returns>An array of the target type.</returns>
|
|
134
162
|
public T[] toArray<T>()
|
|
135
163
|
{
|
|
136
164
|
var answer = new T[this.array.Count];
|
|
137
|
-
|
|
138
165
|
for (var i = 0; i < this.array.Count; i++)
|
|
139
166
|
{
|
|
140
167
|
answer[i] = (T)this.customGet(i);
|
|
141
168
|
}
|
|
142
|
-
|
|
143
169
|
return answer;
|
|
144
170
|
}
|
|
145
171
|
|
|
172
|
+
/// <summary>
|
|
173
|
+
/// Converts the GNArray to a list of the specified type.
|
|
174
|
+
/// </summary>
|
|
175
|
+
/// <typeparam name="T">The target type.</typeparam>
|
|
176
|
+
/// <returns>A list of the target type.</returns>
|
|
146
177
|
public IList<T> toList<T>()
|
|
147
178
|
{
|
|
148
179
|
var answer = new List<T>();
|
|
149
|
-
|
|
150
180
|
for (var i = 0; i < this.array.Count; i++)
|
|
151
181
|
{
|
|
152
182
|
answer.Add((T)this.customGet(i));
|
|
153
183
|
}
|
|
154
|
-
|
|
155
184
|
return answer;
|
|
156
185
|
}
|
|
157
186
|
|
|
187
|
+
/// <summary>
|
|
188
|
+
/// Helper method to retrieve and convert a value at a specified index based on its type.
|
|
189
|
+
/// </summary>
|
|
190
|
+
/// <param name="k">The index of the value.</param>
|
|
191
|
+
/// <returns>The converted value or null if the index is invalid.</returns>
|
|
158
192
|
private object customGet(int k)
|
|
159
193
|
{
|
|
160
194
|
var obj = this.get<object>(k);
|
|
@@ -176,56 +210,89 @@
|
|
|
176
210
|
return obj;
|
|
177
211
|
}
|
|
178
212
|
|
|
213
|
+
/// <summary>
|
|
214
|
+
/// Retrieves a byte value at the specified index.
|
|
215
|
+
/// </summary>
|
|
179
216
|
public byte getByte(int k, byte defaultValue = 0)
|
|
180
217
|
{
|
|
181
218
|
return Convert.ToByte(this.get(k, defaultValue));
|
|
182
219
|
}
|
|
183
220
|
|
|
221
|
+
/// <summary>
|
|
222
|
+
/// Retrieves an sbyte value at the specified index.
|
|
223
|
+
/// </summary>
|
|
184
224
|
public sbyte getSByte(int k, sbyte defaultValue = 0)
|
|
185
225
|
{
|
|
186
226
|
return Convert.ToSByte(this.get(k, defaultValue));
|
|
187
227
|
}
|
|
188
228
|
|
|
229
|
+
/// <summary>
|
|
230
|
+
/// Retrieves a short value at the specified index.
|
|
231
|
+
/// </summary>
|
|
189
232
|
public short getShort(int k, short defaultValue = 0)
|
|
190
233
|
{
|
|
191
234
|
return Convert.ToInt16(this.get(k, defaultValue));
|
|
192
235
|
}
|
|
193
236
|
|
|
237
|
+
/// <summary>
|
|
238
|
+
/// Retrieves an int value at the specified index.
|
|
239
|
+
/// </summary>
|
|
194
240
|
public int getInt(int k, int defaultValue = 0)
|
|
195
241
|
{
|
|
196
242
|
return Convert.ToInt32(this.get(k, defaultValue));
|
|
197
243
|
}
|
|
198
244
|
|
|
245
|
+
/// <summary>
|
|
246
|
+
/// Retrieves a float value at the specified index.
|
|
247
|
+
/// </summary>
|
|
199
248
|
public float getFloat(int k, float defaultValue = 0)
|
|
200
249
|
{
|
|
201
250
|
return Convert.ToSingle(this.get(k, defaultValue));
|
|
202
251
|
}
|
|
203
252
|
|
|
253
|
+
/// <summary>
|
|
254
|
+
/// Retrieves a long value at the specified index.
|
|
255
|
+
/// </summary>
|
|
204
256
|
public long getLong(int k, long defaultValue = 0)
|
|
205
257
|
{
|
|
206
258
|
return Convert.ToInt64(this.get(k, defaultValue));
|
|
207
259
|
}
|
|
208
260
|
|
|
261
|
+
/// <summary>
|
|
262
|
+
/// Retrieves a double value at the specified index.
|
|
263
|
+
/// </summary>
|
|
209
264
|
public double getDouble(int k, double defaultValue = 0)
|
|
210
265
|
{
|
|
211
266
|
return Convert.ToDouble(this.get(k, defaultValue));
|
|
212
267
|
}
|
|
213
268
|
|
|
269
|
+
/// <summary>
|
|
270
|
+
/// Retrieves a bool value at the specified index.
|
|
271
|
+
/// </summary>
|
|
214
272
|
public bool getBool(int k, bool defaultValue = false)
|
|
215
273
|
{
|
|
216
274
|
return Convert.ToBoolean(this.get(k, defaultValue));
|
|
217
275
|
}
|
|
218
276
|
|
|
277
|
+
/// <summary>
|
|
278
|
+
/// Retrieves a string value at the specified index.
|
|
279
|
+
/// </summary>
|
|
219
280
|
public string getString(int k, string defaultValue = null)
|
|
220
281
|
{
|
|
221
282
|
return Convert.ToString(this.get(k, defaultValue));
|
|
222
283
|
}
|
|
223
284
|
|
|
285
|
+
/// <summary>
|
|
286
|
+
/// Retrieves an object value at the specified index.
|
|
287
|
+
/// </summary>
|
|
224
288
|
public object getObject(int k, object defaultValue = null)
|
|
225
289
|
{
|
|
226
290
|
return this.get(k, defaultValue);
|
|
227
291
|
}
|
|
228
292
|
|
|
293
|
+
/// <summary>
|
|
294
|
+
/// Retrieves an array of the specified type at the specified index.
|
|
295
|
+
/// </summary>
|
|
229
296
|
public T[] getArray<T>(int k, T[] defaultValue = null)
|
|
230
297
|
{
|
|
231
298
|
var value0 = this.getGNArray(k);
|
|
@@ -237,6 +304,9 @@
|
|
|
237
304
|
return defaultValue;
|
|
238
305
|
}
|
|
239
306
|
|
|
307
|
+
/// <summary>
|
|
308
|
+
/// Retrieves a list of the specified type at the specified index.
|
|
309
|
+
/// </summary>
|
|
240
310
|
public IList<T> getList<T>(int k, IList<T> defaultValue = null)
|
|
241
311
|
{
|
|
242
312
|
var value0 = this.getGNArray(k);
|
|
@@ -248,16 +318,25 @@
|
|
|
248
318
|
return defaultValue;
|
|
249
319
|
}
|
|
250
320
|
|
|
321
|
+
/// <summary>
|
|
322
|
+
/// Retrieves a GNArray value at the specified index.
|
|
323
|
+
/// </summary>
|
|
251
324
|
public GNArray getGNArray(int k, GNArray defaultValue = null)
|
|
252
325
|
{
|
|
253
326
|
return (GNArray)this.get(k, defaultValue);
|
|
254
327
|
}
|
|
255
328
|
|
|
329
|
+
/// <summary>
|
|
330
|
+
/// Retrieves a GNHashtable value at the specified index.
|
|
331
|
+
/// </summary>
|
|
256
332
|
public GNHashtable getGNHashtable(int k, GNHashtable defaultValue = null)
|
|
257
333
|
{
|
|
258
334
|
return (GNHashtable)this.get(k, defaultValue);
|
|
259
335
|
}
|
|
260
336
|
|
|
337
|
+
/// <summary>
|
|
338
|
+
/// Converts the GNArray into a data object suitable for serialization.
|
|
339
|
+
/// </summary>
|
|
261
340
|
public override object toData()
|
|
262
341
|
{
|
|
263
342
|
var answer = new List<object>();
|
|
@@ -270,6 +349,9 @@
|
|
|
270
349
|
return answer;
|
|
271
350
|
}
|
|
272
351
|
|
|
352
|
+
/// <summary>
|
|
353
|
+
/// Converts the GNArray into a string representation.
|
|
354
|
+
/// </summary>
|
|
273
355
|
public override string toString()
|
|
274
356
|
{
|
|
275
357
|
var stringBuilder = new StringBuilder();
|
|
@@ -292,6 +374,9 @@
|
|
|
292
374
|
return stringBuilder.ToString();
|
|
293
375
|
}
|
|
294
376
|
|
|
377
|
+
/// <summary>
|
|
378
|
+
/// Returns the string representation of the GNArray.
|
|
379
|
+
/// </summary>
|
|
295
380
|
public override string ToString()
|
|
296
381
|
{
|
|
297
382
|
return this.toString();
|
package/Runtime/Common/GNData.cs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Common
|
|
2
2
|
{
|
|
3
|
-
|
|
4
3
|
/// <summary>
|
|
5
|
-
/// The base class for GNData
|
|
4
|
+
/// The base class for GNData, providing core functionalities for handling GNData structures.
|
|
6
5
|
/// </summary>
|
|
7
6
|
public abstract class GNData : IGNData
|
|
8
7
|
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Converts origin data (e.g., list or dictionary) into a GNData structure.
|
|
10
|
+
/// </summary>
|
|
11
|
+
/// <param name="value">The value to convert. It can be a list, dictionary, or any other object.</param>
|
|
12
|
+
/// <returns>A GNArray, GNHashtable, or the original value depending on the input type.</returns>
|
|
9
13
|
protected static object createUseDataFromOriginData(object value)
|
|
10
14
|
{
|
|
11
15
|
if (value == null) return null;
|
|
@@ -13,20 +17,23 @@
|
|
|
13
17
|
if (value is System.Collections.IList list)
|
|
14
18
|
{
|
|
15
19
|
var answer = new GNArray.Builder().addAll(list).build();
|
|
16
|
-
|
|
17
20
|
return answer;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
if (value is System.Collections.IDictionary dict)
|
|
21
24
|
{
|
|
22
25
|
var answer = new GNHashtable.Builder().addAll(dict).build();
|
|
23
|
-
|
|
24
26
|
return answer;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
return value;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Converts GNData structures (GNArray, GNHashtable) into a serializable data format.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <param name="value">The GNData object to convert.</param>
|
|
36
|
+
/// <returns>A serialized representation of the GNData object or the original value.</returns>
|
|
30
37
|
protected static object createDataFromUseData(object value)
|
|
31
38
|
{
|
|
32
39
|
if (value == null) return null;
|
|
@@ -39,10 +46,16 @@
|
|
|
39
46
|
return value;
|
|
40
47
|
}
|
|
41
48
|
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// Converts the current GNData object into a serializable data format.
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <returns>A serializable representation of the GNData object.</returns>
|
|
42
53
|
public abstract object toData();
|
|
43
54
|
|
|
55
|
+
/// <summary>
|
|
56
|
+
/// Converts the current GNData object into a string representation.
|
|
57
|
+
/// </summary>
|
|
58
|
+
/// <returns>A string representation of the GNData object.</returns>
|
|
44
59
|
public abstract string toString();
|
|
45
|
-
|
|
46
60
|
}
|
|
47
|
-
|
|
48
61
|
}
|