com.xmobitea.changx.gn-unity 2.4.10 → 2.4.12

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.
@@ -39,7 +39,7 @@
39
39
  /// <summary>
40
40
  /// Provides utility methods for retrieving names of operation, event, and return codes.
41
41
  /// </summary>
42
- public class CodeHelper
42
+ public static class CodeHelper
43
43
  {
44
44
  private static CodeHelperBase operationCodeHelper;
45
45
  private static CodeHelperBase eventCodeHelper;
@@ -549,7 +549,7 @@
549
549
  /// Service class providing serialization and deserialization functionality.
550
550
  /// Handles conversion of objects to GNHashtable/GNArray and vice versa.
551
551
  /// </summary>
552
- public class ConverterService
552
+ public static class ConverterService
553
553
  {
554
554
  // Private static instances for serialization and deserialization operations.
555
555
  private static SerializeConverter serializeConverter;
@@ -643,9 +643,12 @@
643
643
  return (value is byte
644
644
  || value is sbyte
645
645
  || value is short
646
+ || value is ushort
646
647
  || value is int
648
+ || value is uint
647
649
  || value is float
648
650
  || value is long
651
+ || value is ulong
649
652
  || value is double);
650
653
  }
651
654
 
@@ -0,0 +1,206 @@
1
+ namespace XmobiTea.GN.Helper
2
+ {
3
+ using System.Collections.Generic;
4
+ using XmobiTea.GN.Entity.Models;
5
+
6
+ public static class GNUtils
7
+ {
8
+ public static IDictionary<string, GenericModels.DataItem> toDatasDictionary(IList<GenericModels.DataItem> datas)
9
+ {
10
+ if (datas == null) return null;
11
+
12
+ var answer = new Dictionary<string, GenericModels.DataItem>();
13
+
14
+ for (var i = 0; i < datas.Count; i++)
15
+ {
16
+ var data = datas[i];
17
+
18
+ answer.Add(data.key, data);
19
+ }
20
+
21
+ return answer;
22
+ }
23
+
24
+ public static IDictionary<string, GenericModels.TagItem> toTagsDictionary(IList<GenericModels.TagItem> tags)
25
+ {
26
+ if (tags == null) return null;
27
+
28
+ var answer = new Dictionary<string, GenericModels.TagItem>();
29
+
30
+ for (var i = 0; i < tags.Count; i++)
31
+ {
32
+ var tag = tags[i];
33
+
34
+ answer.Add(tag.key, tag);
35
+ }
36
+
37
+ return answer;
38
+ }
39
+
40
+ public static IDictionary<string, GenericModels.CurrencyItem> toCurrenciesDictionary(IList<GenericModels.CurrencyItem> currencies)
41
+ {
42
+ if (currencies == null) return null;
43
+
44
+ var answer = new Dictionary<string, GenericModels.CurrencyItem>();
45
+
46
+ for (var i = 0; i < currencies.Count; i++)
47
+ {
48
+ var currency = currencies[i];
49
+
50
+ answer.Add(currency.key, currency);
51
+ }
52
+
53
+ return answer;
54
+ }
55
+
56
+ public static IDictionary<string, GenericModels.StatisticsItem> toStatisticsDictionary(IList<GenericModels.StatisticsItem> statistics)
57
+ {
58
+ if (statistics == null) return null;
59
+
60
+ var answer = new Dictionary<string, GenericModels.StatisticsItem>();
61
+
62
+ for (var i = 0; i < statistics.Count; i++)
63
+ {
64
+ var statistic = statistics[i];
65
+
66
+ answer.Add(statistic.key, statistic);
67
+ }
68
+
69
+ return answer;
70
+ }
71
+
72
+ public static IDictionary<string, GenericModels.InventoryItem> toInventoriesDictionary(IList<GenericModels.InventoryItem> inventories)
73
+ {
74
+ if (inventories == null) return null;
75
+
76
+ var answer = new Dictionary<string, GenericModels.InventoryItem>();
77
+
78
+ for (var i = 0; i < inventories.Count; i++)
79
+ {
80
+ var inventory = inventories[i];
81
+
82
+ answer.Add(inventory.itemId, inventory);
83
+ }
84
+
85
+ return answer;
86
+ }
87
+
88
+ public static IDictionary<string, GenericModels.GroupItem> toGroupDictionary(IList<GenericModels.GroupItem> groups)
89
+ {
90
+ if (groups == null) return null;
91
+
92
+ var answer = new Dictionary<string, GenericModels.GroupItem>();
93
+
94
+ for (var i = 0; i < groups.Count; i++)
95
+ {
96
+ var group = groups[i];
97
+
98
+ answer.Add(group.groupId, group);
99
+ }
100
+
101
+ return answer;
102
+ }
103
+
104
+ }
105
+
106
+ public static class GNExtensions
107
+ {
108
+ public static IDictionary<string, GenericModels.DataItem> toDictionary(this IList<GenericModels.DataItem> datas)
109
+ {
110
+ if (datas == null) return null;
111
+
112
+ var answer = new Dictionary<string, GenericModels.DataItem>();
113
+
114
+ for (var i = 0; i < datas.Count; i++)
115
+ {
116
+ var data = datas[i];
117
+
118
+ answer.Add(data.key, data);
119
+ }
120
+
121
+ return answer;
122
+ }
123
+
124
+ public static IDictionary<string, GenericModels.TagItem> toDictionary(this IList<GenericModels.TagItem> tags)
125
+ {
126
+ if (tags == null) return null;
127
+
128
+ var answer = new Dictionary<string, GenericModels.TagItem>();
129
+
130
+ for (var i = 0; i < tags.Count; i++)
131
+ {
132
+ var tag = tags[i];
133
+
134
+ answer.Add(tag.key, tag);
135
+ }
136
+
137
+ return answer;
138
+ }
139
+
140
+ public static IDictionary<string, GenericModels.CurrencyItem> toDictionary(this IList<GenericModels.CurrencyItem> currencies)
141
+ {
142
+ if (currencies == null) return null;
143
+
144
+ var answer = new Dictionary<string, GenericModels.CurrencyItem>();
145
+
146
+ for (var i = 0; i < currencies.Count; i++)
147
+ {
148
+ var currency = currencies[i];
149
+
150
+ answer.Add(currency.key, currency);
151
+ }
152
+
153
+ return answer;
154
+ }
155
+
156
+ public static IDictionary<string, GenericModels.StatisticsItem> toDictionary(this IList<GenericModels.StatisticsItem> statistics)
157
+ {
158
+ if (statistics == null) return null;
159
+
160
+ var answer = new Dictionary<string, GenericModels.StatisticsItem>();
161
+
162
+ for (var i = 0; i < statistics.Count; i++)
163
+ {
164
+ var statistic = statistics[i];
165
+
166
+ answer.Add(statistic.key, statistic);
167
+ }
168
+
169
+ return answer;
170
+ }
171
+
172
+ public static IDictionary<string, GenericModels.InventoryItem> toDictionary(this IList<GenericModels.InventoryItem> inventories)
173
+ {
174
+ if (inventories == null) return null;
175
+
176
+ var answer = new Dictionary<string, GenericModels.InventoryItem>();
177
+
178
+ for (var i = 0; i < inventories.Count; i++)
179
+ {
180
+ var inventory = inventories[i];
181
+
182
+ answer.Add(inventory.itemId, inventory);
183
+ }
184
+
185
+ return answer;
186
+ }
187
+
188
+ public static IDictionary<string, GenericModels.GroupItem> toDictionary(this IList<GenericModels.GroupItem> groups)
189
+ {
190
+ if (groups == null) return null;
191
+
192
+ var answer = new Dictionary<string, GenericModels.GroupItem>();
193
+
194
+ for (var i = 0; i < groups.Count; i++)
195
+ {
196
+ var group = groups[i];
197
+
198
+ answer.Add(group.groupId, group);
199
+ }
200
+
201
+ return answer;
202
+ }
203
+
204
+ }
205
+
206
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 280cba9b5ea015744bd4a74ac744c4de
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.xmobitea.changx.gn-unity",
3
- "version": "2.4.10",
3
+ "version": "2.4.12",
4
4
  "displayName": "XmobiTea GN Unity",
5
5
  "description": "XmobiTea Unity packages",
6
6
  "unity": "2020.3",