export-table-pulgin-csharp 1.1.171 → 1.1.173
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/dist/ExportCSPlugin.js
CHANGED
|
@@ -32,7 +32,7 @@ function export_stuff(paras) {
|
|
|
32
32
|
console.log(`map class: ${classNameOrigin}`);
|
|
33
33
|
let classInfo = protoParser.getClassInfo(classNameOrigin);
|
|
34
34
|
if (classInfo != null) {
|
|
35
|
-
extendClass = ` : ${
|
|
35
|
+
extendClass = ` : ${classInfo.name}`;
|
|
36
36
|
usingProtoNamespace = "\nusing DXTS.BattleProto;";
|
|
37
37
|
// for (let f of classInfo.fields) {
|
|
38
38
|
// console.log(`${f.csName}`)
|
|
@@ -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;AAQxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+DnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,
|
|
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;AAQxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+DnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAoJzE;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;CA4C3C"}
|
|
@@ -140,13 +140,8 @@ namespace ${exportNamespace}
|
|
|
140
140
|
var configLiteral = System.IO.File.ReadAllText(loadUrl, System.Text.Encoding.UTF8);
|
|
141
141
|
if (configLiteral != null)
|
|
142
142
|
{
|
|
143
|
-
var obj = new TempA()
|
|
144
|
-
{
|
|
145
|
-
a=${RowClass}.Configs,
|
|
146
|
-
};
|
|
147
143
|
try
|
|
148
144
|
{
|
|
149
|
-
// JsonUtility.FromJsonOverwrite("{\\"a\\":"+configLiteral+"}", obj);
|
|
150
145
|
ConfigAssetLoader.LoadConfigs(configLiteral, Configs);
|
|
151
146
|
}
|
|
152
147
|
catch(System.Exception ex)
|
|
@@ -160,6 +155,41 @@ namespace ${exportNamespace}
|
|
|
160
155
|
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
161
156
|
}
|
|
162
157
|
}
|
|
158
|
+
|
|
159
|
+
public static void SaveInEditor(bool force = false, System.Func<string, string> pathConverter = null)
|
|
160
|
+
{
|
|
161
|
+
if ((!force) && UnityEditor.EditorApplication.isPlaying)
|
|
162
|
+
{
|
|
163
|
+
var tip = $"cannot load ${RowClass}[] with LoadInEditor at runtime";
|
|
164
|
+
Debug.LogError(tip);
|
|
165
|
+
throw new System.Exception(tip);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var loadUrl = pathConverter == null ? LoadUrl : pathConverter(LoadUrl);
|
|
169
|
+
string configLiteral = null;
|
|
170
|
+
try
|
|
171
|
+
{
|
|
172
|
+
configLiteral = ConfigAssetLoader.ToLiteral(Configs);
|
|
173
|
+
}
|
|
174
|
+
catch (System.Exception exception)
|
|
175
|
+
{
|
|
176
|
+
Debug.LogError($"json序列化失败: {loadUrl}");
|
|
177
|
+
throw exception;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (configLiteral != null)
|
|
181
|
+
{
|
|
182
|
+
try
|
|
183
|
+
{
|
|
184
|
+
System.IO.File.WriteAllText(loadUrl, configLiteral, System.Text.Encoding.UTF8);
|
|
185
|
+
}
|
|
186
|
+
catch (System.Exception exception)
|
|
187
|
+
{
|
|
188
|
+
Debug.LogError($"写配置文件失败: {loadUrl}");
|
|
189
|
+
throw exception;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
163
193
|
#endif
|
|
164
194
|
}
|
|
165
195
|
}
|
package/package.json
CHANGED
package/src/ExportCSPlugin.ts
CHANGED
|
@@ -50,7 +50,7 @@ export function export_stuff(paras: HandleSheetParams): string | null {
|
|
|
50
50
|
console.log(`map class: ${classNameOrigin}`)
|
|
51
51
|
let classInfo = protoParser.getClassInfo(classNameOrigin)
|
|
52
52
|
if (classInfo != null) {
|
|
53
|
-
extendClass = ` : ${
|
|
53
|
+
extendClass = ` : ${classInfo.name}`
|
|
54
54
|
usingProtoNamespace = "\nusing DXTS.BattleProto;"
|
|
55
55
|
// for (let f of classInfo.fields) {
|
|
56
56
|
// console.log(`${f.csName}`)
|
|
@@ -164,13 +164,8 @@ namespace ${exportNamespace}
|
|
|
164
164
|
var configLiteral = System.IO.File.ReadAllText(loadUrl, System.Text.Encoding.UTF8);
|
|
165
165
|
if (configLiteral != null)
|
|
166
166
|
{
|
|
167
|
-
var obj = new TempA()
|
|
168
|
-
{
|
|
169
|
-
a=${RowClass}.Configs,
|
|
170
|
-
};
|
|
171
167
|
try
|
|
172
168
|
{
|
|
173
|
-
// JsonUtility.FromJsonOverwrite("{\\"a\\":"+configLiteral+"}", obj);
|
|
174
169
|
ConfigAssetLoader.LoadConfigs(configLiteral, Configs);
|
|
175
170
|
}
|
|
176
171
|
catch(System.Exception ex)
|
|
@@ -184,6 +179,41 @@ namespace ${exportNamespace}
|
|
|
184
179
|
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
185
180
|
}
|
|
186
181
|
}
|
|
182
|
+
|
|
183
|
+
public static void SaveInEditor(bool force = false, System.Func<string, string> pathConverter = null)
|
|
184
|
+
{
|
|
185
|
+
if ((!force) && UnityEditor.EditorApplication.isPlaying)
|
|
186
|
+
{
|
|
187
|
+
var tip = $"cannot load ${RowClass}[] with LoadInEditor at runtime";
|
|
188
|
+
Debug.LogError(tip);
|
|
189
|
+
throw new System.Exception(tip);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
var loadUrl = pathConverter == null ? LoadUrl : pathConverter(LoadUrl);
|
|
193
|
+
string configLiteral = null;
|
|
194
|
+
try
|
|
195
|
+
{
|
|
196
|
+
configLiteral = ConfigAssetLoader.ToLiteral(Configs);
|
|
197
|
+
}
|
|
198
|
+
catch (System.Exception exception)
|
|
199
|
+
{
|
|
200
|
+
Debug.LogError($"json序列化失败: {loadUrl}");
|
|
201
|
+
throw exception;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (configLiteral != null)
|
|
205
|
+
{
|
|
206
|
+
try
|
|
207
|
+
{
|
|
208
|
+
System.IO.File.WriteAllText(loadUrl, configLiteral, System.Text.Encoding.UTF8);
|
|
209
|
+
}
|
|
210
|
+
catch (System.Exception exception)
|
|
211
|
+
{
|
|
212
|
+
Debug.LogError($"写配置文件失败: {loadUrl}");
|
|
213
|
+
throw exception;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
187
217
|
#endif
|
|
188
218
|
}
|
|
189
219
|
}
|