export-table-pulgin-csharp 1.0.61 → 1.0.63
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;AAMlI,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+CnE;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,EAAe,MAAM,kBAAkB,CAAA;AAMlI,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+CnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAyEzE;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"}
|
|
@@ -80,25 +80,55 @@ using lang.json;
|
|
|
80
80
|
|
|
81
81
|
namespace MEEC.ExportedConfigs
|
|
82
82
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
public partial class ${RowClass}
|
|
84
|
+
{
|
|
85
|
+
public static async Task Load()
|
|
86
|
+
{
|
|
87
87
|
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
88
|
-
|
|
88
|
+
var configJson =
|
|
89
|
+
#if UNITY_EDITOR
|
|
90
|
+
Application.isPlaying ? await Addressables.LoadAssetAsync<TextAsset>(loadUrl).Task : UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(loadUrl);
|
|
91
|
+
#else
|
|
92
|
+
await Addressables.LoadAssetAsync<TextAsset>(loadUrl).Task;
|
|
93
|
+
#endif
|
|
89
94
|
if (configJson != null)
|
|
90
|
-
|
|
95
|
+
{
|
|
91
96
|
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
92
97
|
var configs = ${RowClass}.Configs;
|
|
93
98
|
configs.Clear();
|
|
94
99
|
configs.AddRange(jsonObjs);
|
|
95
100
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
else
|
|
102
|
+
{
|
|
103
|
+
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#if UNITY_EDITOR
|
|
108
|
+
public static void LoadInEditor()
|
|
109
|
+
{
|
|
110
|
+
if (Application.isPlaying)
|
|
111
|
+
{
|
|
112
|
+
var tip = $"cannot load ${RowClass}[] with LoadInEditor at runtime";
|
|
113
|
+
Debug.LogError(tip);
|
|
114
|
+
throw new System.Exception(tip);
|
|
115
|
+
}
|
|
116
|
+
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
117
|
+
var configJson = UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(loadUrl);
|
|
118
|
+
if (configJson != null)
|
|
119
|
+
{
|
|
120
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
121
|
+
var configs = ${RowClass}.Configs;
|
|
122
|
+
configs.Clear();
|
|
123
|
+
configs.AddRange(jsonObjs);
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
{
|
|
127
|
+
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
#endif
|
|
131
|
+
}
|
|
102
132
|
}
|
|
103
133
|
`;
|
|
104
134
|
return temp;
|
package/package.json
CHANGED
|
@@ -74,25 +74,55 @@ using lang.json;
|
|
|
74
74
|
|
|
75
75
|
namespace MEEC.ExportedConfigs
|
|
76
76
|
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
public partial class ${RowClass}
|
|
78
|
+
{
|
|
79
|
+
public static async Task Load()
|
|
80
|
+
{
|
|
81
|
+
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
82
|
+
var configJson =
|
|
83
|
+
#if UNITY_EDITOR
|
|
84
|
+
Application.isPlaying ? await Addressables.LoadAssetAsync<TextAsset>(loadUrl).Task : UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(loadUrl);
|
|
85
|
+
#else
|
|
86
|
+
await Addressables.LoadAssetAsync<TextAsset>(loadUrl).Task;
|
|
87
|
+
#endif
|
|
88
|
+
if (configJson != null)
|
|
89
|
+
{
|
|
90
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
91
|
+
var configs = ${RowClass}.Configs;
|
|
92
|
+
configs.Clear();
|
|
93
|
+
configs.AddRange(jsonObjs);
|
|
94
|
+
}
|
|
95
|
+
else
|
|
96
|
+
{
|
|
97
|
+
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#if UNITY_EDITOR
|
|
102
|
+
public static void LoadInEditor()
|
|
103
|
+
{
|
|
104
|
+
if (Application.isPlaying)
|
|
105
|
+
{
|
|
106
|
+
var tip = $"cannot load ${RowClass}[] with LoadInEditor at runtime";
|
|
107
|
+
Debug.LogError(tip);
|
|
108
|
+
throw new System.Exception(tip);
|
|
109
|
+
}
|
|
81
110
|
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
82
|
-
|
|
111
|
+
var configJson = UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(loadUrl);
|
|
83
112
|
if (configJson != null)
|
|
84
|
-
|
|
113
|
+
{
|
|
85
114
|
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
86
115
|
var configs = ${RowClass}.Configs;
|
|
87
116
|
configs.Clear();
|
|
88
117
|
configs.AddRange(jsonObjs);
|
|
89
118
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
119
|
+
else
|
|
120
|
+
{
|
|
121
|
+
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
#endif
|
|
125
|
+
}
|
|
96
126
|
}
|
|
97
127
|
`
|
|
98
128
|
return temp
|