export-table-pulgin-csharp 1.0.52 → 1.0.53
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":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAe,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"ExportUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAe,MAAM,kBAAkB,CAAA;AAMlI,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA6CnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA2CzE;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;CAsB3C"}
|
|
@@ -26,11 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ExportUJsonPlugin = exports.exportUJsonLoader = exports.exportUJson = void 0;
|
|
27
27
|
const export_table_lib_1 = require("export-table-lib");
|
|
28
28
|
const fs = __importStar(require("fs-extra"));
|
|
29
|
+
let firstLetterUpper = function (str) {
|
|
30
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
31
|
+
};
|
|
29
32
|
function exportUJson(paras) {
|
|
30
33
|
let { datas, fields, name, objects, table, } = paras;
|
|
31
|
-
let firstLetterUpper = function (str) {
|
|
32
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
33
|
-
};
|
|
34
34
|
let firstLetterLower = function (str) {
|
|
35
35
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
36
36
|
};
|
|
@@ -68,6 +68,7 @@ MonoBehaviour:
|
|
|
68
68
|
exports.exportUJson = exportUJson;
|
|
69
69
|
function exportUJsonLoader(paras) {
|
|
70
70
|
let { datas, fields, name, objects, table, } = paras;
|
|
71
|
+
let RowClass = firstLetterUpper(name);
|
|
71
72
|
var fullName = `${table.workbookName}-${name}`;
|
|
72
73
|
// !!!必须开头没有空格
|
|
73
74
|
let temp = `
|
|
@@ -78,7 +79,7 @@ using UnityEngine;
|
|
|
78
79
|
|
|
79
80
|
namespace MEEC.ExportedConfigs
|
|
80
81
|
{
|
|
81
|
-
public partial class ${
|
|
82
|
+
public partial class ${RowClass}
|
|
82
83
|
{
|
|
83
84
|
public static async Task Load()
|
|
84
85
|
{
|
|
@@ -86,8 +87,8 @@ namespace MEEC.ExportedConfigs
|
|
|
86
87
|
var configJson = await Addressables.LoadAssetAsync<ExcelConfigJson>(loadUrl).Task;
|
|
87
88
|
if (configJson != null)
|
|
88
89
|
{
|
|
89
|
-
var jsonObjs = JSON.parse<${
|
|
90
|
-
var configs = ${
|
|
90
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.JsonText);
|
|
91
|
+
var configs = ${RowClass}.Configs;
|
|
91
92
|
configs.Clear();
|
|
92
93
|
configs.AddRange(jsonObjs);
|
|
93
94
|
}
|
package/package.json
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { cmm, HandleSheetParams, Field, foreach, IPlugin, st, PluginBase, HandleBatchParams, OutFilePath } from "export-table-lib"
|
|
3
3
|
import * as fs from "fs-extra"
|
|
4
4
|
|
|
5
|
+
let firstLetterUpper = function (str: string) {
|
|
6
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
7
|
+
};
|
|
5
8
|
export function exportUJson(paras: HandleSheetParams): string | null {
|
|
6
9
|
let {
|
|
7
10
|
datas,
|
|
@@ -11,9 +14,6 @@ export function exportUJson(paras: HandleSheetParams): string | null {
|
|
|
11
14
|
table,
|
|
12
15
|
} = paras;
|
|
13
16
|
|
|
14
|
-
let firstLetterUpper = function (str: string) {
|
|
15
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
16
|
-
};
|
|
17
17
|
let firstLetterLower = function (str: string) {
|
|
18
18
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
19
19
|
};
|
|
@@ -61,6 +61,7 @@ export function exportUJsonLoader(paras: HandleSheetParams): string | null {
|
|
|
61
61
|
table,
|
|
62
62
|
} = paras;
|
|
63
63
|
|
|
64
|
+
let RowClass = firstLetterUpper(name)
|
|
64
65
|
var fullName = `${table.workbookName}-${name}`
|
|
65
66
|
// !!!必须开头没有空格
|
|
66
67
|
let temp = `
|
|
@@ -71,7 +72,7 @@ using UnityEngine;
|
|
|
71
72
|
|
|
72
73
|
namespace MEEC.ExportedConfigs
|
|
73
74
|
{
|
|
74
|
-
public partial class ${
|
|
75
|
+
public partial class ${RowClass}
|
|
75
76
|
{
|
|
76
77
|
public static async Task Load()
|
|
77
78
|
{
|
|
@@ -79,8 +80,8 @@ namespace MEEC.ExportedConfigs
|
|
|
79
80
|
var configJson = await Addressables.LoadAssetAsync<ExcelConfigJson>(loadUrl).Task;
|
|
80
81
|
if (configJson != null)
|
|
81
82
|
{
|
|
82
|
-
var jsonObjs = JSON.parse<${
|
|
83
|
-
var configs = ${
|
|
83
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.JsonText);
|
|
84
|
+
var configs = ${RowClass}.Configs;
|
|
84
85
|
configs.Clear();
|
|
85
86
|
configs.AddRange(jsonObjs);
|
|
86
87
|
}
|