export-table-pulgin-csharp 1.1.87 → 1.1.89

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,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAMpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAwCjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAuD5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+RpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
1
+ {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAMpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CA0D5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAmSpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
@@ -42,10 +42,13 @@ function ConvValue(value, t, f) {
42
42
  else if (t == "object[]") {
43
43
  return JSON.parse(value);
44
44
  }
45
- else if (t == "number" || t == "int" || t == "long") {
45
+ else if (t == "number" || t == "float") {
46
46
  return JSON.parse(value);
47
47
  }
48
- else if (t == "number[]") {
48
+ else if (t == "int" || t == "long") {
49
+ return parseInt(value);
50
+ }
51
+ else if (t == "number[]" || t == "float[]") {
49
52
  return JSON.parse(value);
50
53
  }
51
54
  else if (t == "int[]") {
@@ -120,6 +123,10 @@ function ConvValue2Literal(value, t, f) {
120
123
  let values = value;
121
124
  return `new double[]{${values.join(", ")}}`;
122
125
  }
126
+ else if (t == "float[]") {
127
+ let values = value;
128
+ return `new float[]{${values.join(", ")}}`;
129
+ }
123
130
  else if (t == "int[]") {
124
131
  let values = value;
125
132
  return `new int[]{${values.join(", ")}}`;
@@ -200,6 +207,12 @@ function export_stuff(paras) {
200
207
  else if (t == "number[]") {
201
208
  return "double[]";
202
209
  }
210
+ else if (t == "float") {
211
+ return "float";
212
+ }
213
+ else if (t == "float[]") {
214
+ return "float[]";
215
+ }
203
216
  else if (t == "int") {
204
217
  return "int";
205
218
  }
@@ -345,7 +358,7 @@ ${(0, export_table_lib_1.foreach)(fields, f => {
345
358
  }
346
359
  `;
347
360
  }
348
- else if (f.type == "number" || f.type == "int" || f.type == "long" || f.type == "string") {
361
+ else if (f.type == "number" || f.type == "float" || f.type == "int" || f.type == "long" || f.type == "string") {
349
362
  let memberName = convMemberName(f.name);
350
363
  let tempRecordsDictByMemberName = `tempRecordsDictBy${memberName}`;
351
364
  let memberType = getFieldType(f);
@@ -1 +1 @@
1
- {"version":3,"file":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAOxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAiFnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFzE;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAChD,IAAI,SAAU;IACd,IAAI,EAAE,MAAM,EAAE,CAAY;IAE1B,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAmBpC,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAmC3C"}
1
+ {"version":3,"file":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAOxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA0FnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFzE;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAChD,IAAI,SAAU;IACd,IAAI,EAAE,MAAM,EAAE,CAAY;IAE1B,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAmBpC,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAmC3C"}
@@ -44,7 +44,7 @@ function exportUJson(paras) {
44
44
  let key = f.name;
45
45
  var newKey = convMemberName(key);
46
46
  newObj[newKey] = obj[key];
47
- let m = f.rawType.match(/\@\((\w+),(\w+)\)\[\]/);
47
+ let m = f.rawType.match(/\@\((\w+),(\w+)\)(\[\])?/);
48
48
  if (m != null) {
49
49
  // [{"Item1":99,"Item2":"klwjefl"}]
50
50
  let content = obj[key];
@@ -71,7 +71,16 @@ function exportUJson(paras) {
71
71
  Item2: (0, ExportCSPlugin_1.TryConvValue)(ssStr, t2, f),
72
72
  });
73
73
  }
74
- newObj[newKey + "Obj"] = objs;
74
+ let isArray = m[3] == "[]";
75
+ if (isArray) {
76
+ newObj[newKey + "Obj"] = objs;
77
+ }
78
+ else {
79
+ if (objs.length > 1) {
80
+ console.log(`配置错误,过多的条目数量: ${content}`);
81
+ }
82
+ newObj[newKey + "Obj"] = objs[0] ?? null;
83
+ }
75
84
  }
76
85
  }
77
86
  // Object.keys(obj).forEach(key => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "@types/node": "^17.0.18",
16
- "export-table-lib": "^1.0.56",
16
+ "export-table-lib": "^1.0.58",
17
17
  "fs": "^0.0.1-security",
18
18
  "fs-extra": "^10.0.0",
19
19
  "fse": "^4.0.1"
@@ -15,9 +15,11 @@ export function ConvValue(value: any, t: FieldType, f: Field): any {
15
15
  return JSON.parse(value)
16
16
  } else if (t == "object[]") {
17
17
  return JSON.parse(value)
18
- } else if (t == "number" || t == "int" || t == "long") {
18
+ } else if (t == "number" || t == "float") {
19
19
  return JSON.parse(value)
20
- } else if (t == "number[]") {
20
+ } else if (t == "int" || t == "long") {
21
+ return parseInt(value)
22
+ } else if (t == "number[]" || t == "float[]") {
21
23
  return JSON.parse(value)
22
24
  } else if (t == "int[]") {
23
25
  return JSON.parse(value)
@@ -75,6 +77,9 @@ export function ConvValue2Literal(value: any, t: FieldType, f: Field): string {
75
77
  } else if (t == "number[]") {
76
78
  let values = value as number[]
77
79
  return `new double[]{${values.join(", ")}}`
80
+ } else if (t == "float[]") {
81
+ let values = value as number[]
82
+ return `new float[]{${values.join(", ")}}`
78
83
  } else if (t == "int[]") {
79
84
  let values = value as number[]
80
85
  return `new int[]{${values.join(", ")}}`
@@ -158,6 +163,10 @@ export function export_stuff(paras: HandleSheetParams): string | null {
158
163
  return "double";
159
164
  } else if (t == "number[]") {
160
165
  return "double[]";
166
+ } else if (t == "float") {
167
+ return "float";
168
+ } else if (t == "float[]") {
169
+ return "float[]";
161
170
  } else if (t == "int") {
162
171
  return "int";
163
172
  } else if (t == "int[]") {
@@ -305,7 +314,7 @@ ${foreach(fields, f => {
305
314
  return ${tempDictByMemberName}.GetValueOrDefault(${memberName});
306
315
  }
307
316
  `
308
- } else if (f.type == "number" || f.type == "int" || f.type == "long" || f.type == "string") {
317
+ } else if (f.type == "number" || f.type == "float" || f.type == "int" || f.type == "long" || f.type == "string") {
309
318
  let memberName = convMemberName(f.name);
310
319
  let tempRecordsDictByMemberName = `tempRecordsDictBy${memberName}`;
311
320
  let memberType = getFieldType(f);
@@ -30,7 +30,7 @@ export function exportUJson(paras: HandleSheetParams): string | null {
30
30
  var newKey = convMemberName(key);
31
31
  newObj[newKey] = obj[key];
32
32
 
33
- let m = f.rawType.match(/\@\((\w+),(\w+)\)\[\]/)
33
+ let m = f.rawType.match(/\@\((\w+),(\w+)\)(\[\])?/)
34
34
  if (m != null) {
35
35
  // [{"Item1":99,"Item2":"klwjefl"}]
36
36
  let content = obj[key] as string;
@@ -56,7 +56,16 @@ export function exportUJson(paras: HandleSheetParams): string | null {
56
56
  Item2: TryConvValue(ssStr, t2 as any, f),
57
57
  })
58
58
  }
59
- newObj[newKey + "Obj"] = objs
59
+
60
+ let isArray = m[3] == "[]"
61
+ if (isArray) {
62
+ newObj[newKey + "Obj"] = objs
63
+ } else {
64
+ if (objs.length > 1) {
65
+ console.log(`配置错误,过多的条目数量: ${content}`)
66
+ }
67
+ newObj[newKey + "Obj"] = objs[0] ?? null
68
+ }
60
69
  }
61
70
  }
62
71
  // Object.keys(obj).forEach(key => {