export-table-pulgin-csharp 1.1.177 → 1.1.180

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAmD,MAAM,kBAAkB,CAAA;AAMtK,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAkRpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI3C,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
1
+ {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAmD,MAAM,kBAAkB,CAAA;AAMtK,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAyRpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI3C,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
@@ -79,7 +79,8 @@ ${(0, export_table_lib_1.foreach)(datas, data => ` new ${RowClass}(${(0, export
79
79
  `)}
80
80
  };
81
81
 
82
- public static ${RowClass} Head => Configs.Count > 0 ? Configs[0] : null;
82
+ private static ${RowClass} _head;
83
+ public static ${RowClass} Head => _head ??= Configs.Count > 0 ? Configs[0] : null;
83
84
 
84
85
  public ${RowClass}() { }
85
86
  public ${RowClass}(${(0, export_table_lib_1.st)(() => customFields.map(f => `${getFieldType2(f)} ${(0, CSParseTool_1.convVarName)(f.name)}`).join(", "))})
@@ -144,7 +145,10 @@ ${(0, export_table_lib_1.foreach)(fields, f => {
144
145
  for(var i = 0; i < Configs.Count; i++)
145
146
  {
146
147
  var c = Configs[i];
147
- ${tempDictByMemberName}.Add(c.${memberName}, c);
148
+ if(!${tempDictByMemberName}.TryAdd(c.${memberName}, c))
149
+ {
150
+ UnityEngine.Debug.LogError($"重复的配表字段值<${memberName}>: {c.${memberName}}");
151
+ }
148
152
  }
149
153
  }
150
154
  #if UNITY_EDITOR
@@ -177,7 +181,10 @@ ${(0, export_table_lib_1.foreach)(fields, f => {
177
181
  ${tempRecordsDictByMemberName} = new Dictionary<${memberType}, ${RowClass}[]>(Configs.Count);
178
182
  }
179
183
  var records = Configs.Where(c => c.${memberName} == ${paraName}).ToArray();
180
- ${tempRecordsDictByMemberName}.Add(${paraName}, records);
184
+ if(!${tempRecordsDictByMemberName}.Add(${paraName}, records))
185
+ {
186
+ UnityEngine.Debug.LogError($"重复的配表字段值<${paraName}>: {${paraName}}");
187
+ }
181
188
  return records;
182
189
  }
183
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.177",
3
+ "version": "1.1.180",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {},
@@ -99,7 +99,8 @@ ${foreach(datas, data =>
99
99
  `)}
100
100
  };
101
101
 
102
- public static ${RowClass} Head => Configs.Count > 0 ? Configs[0] : null;
102
+ private static ${RowClass} _head;
103
+ public static ${RowClass} Head => _head ??= Configs.Count > 0 ? Configs[0] : null;
103
104
 
104
105
  public ${RowClass}() { }
105
106
  public ${RowClass}(${st(() => customFields.map(f => `${getFieldType2(f)} ${convVarName(f.name)}`).join(", "))})
@@ -173,7 +174,10 @@ ${foreach(fields, f => {
173
174
  for(var i = 0; i < Configs.Count; i++)
174
175
  {
175
176
  var c = Configs[i];
176
- ${tempDictByMemberName}.Add(c.${memberName}, c);
177
+ if(!${tempDictByMemberName}.TryAdd(c.${memberName}, c))
178
+ {
179
+ UnityEngine.Debug.LogError($"重复的配表字段值<${memberName}>: {c.${memberName}}");
180
+ }
177
181
  }
178
182
  }
179
183
  #if UNITY_EDITOR
@@ -205,7 +209,10 @@ ${foreach(fields, f => {
205
209
  ${tempRecordsDictByMemberName} = new Dictionary<${memberType}, ${RowClass}[]>(Configs.Count);
206
210
  }
207
211
  var records = Configs.Where(c => c.${memberName} == ${paraName}).ToArray();
208
- ${tempRecordsDictByMemberName}.Add(${paraName}, records);
212
+ if(!${tempRecordsDictByMemberName}.Add(${paraName}, records))
213
+ {
214
+ UnityEngine.Debug.LogError($"重复的配表字段值<${paraName}>: {${paraName}}");
215
+ }
209
216
  return records;
210
217
  }
211
218
  }