export-table-pulgin-csharp 1.0.60 → 1.0.62
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"}
|
|
@@ -76,28 +76,59 @@ function exportUJsonLoader(paras) {
|
|
|
76
76
|
using UnityEngine.AddressableAssets;
|
|
77
77
|
using System.Threading.Tasks;
|
|
78
78
|
using UnityEngine;
|
|
79
|
+
using lang.json;
|
|
79
80
|
|
|
80
81
|
namespace MEEC.ExportedConfigs
|
|
81
82
|
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
public partial class ${RowClass}
|
|
84
|
+
{
|
|
85
|
+
public static async Task Load()
|
|
86
|
+
{
|
|
86
87
|
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
87
|
-
|
|
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
|
|
88
94
|
if (configJson != null)
|
|
89
|
-
|
|
90
|
-
var jsonObjs =
|
|
95
|
+
{
|
|
96
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
91
97
|
var configs = ${RowClass}.Configs;
|
|
92
98
|
configs.Clear();
|
|
93
99
|
configs.AddRange(jsonObjs);
|
|
94
100
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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 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
|
+
}
|
|
101
132
|
}
|
|
102
133
|
`;
|
|
103
134
|
return temp;
|
package/package.json
CHANGED
|
@@ -70,28 +70,59 @@ export function exportUJsonLoader(paras: HandleSheetParams): string | null {
|
|
|
70
70
|
using UnityEngine.AddressableAssets;
|
|
71
71
|
using System.Threading.Tasks;
|
|
72
72
|
using UnityEngine;
|
|
73
|
+
using lang.json;
|
|
73
74
|
|
|
74
75
|
namespace MEEC.ExportedConfigs
|
|
75
76
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
public partial class ${RowClass}
|
|
78
|
+
{
|
|
79
|
+
public static async Task Load()
|
|
80
|
+
{
|
|
80
81
|
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
81
|
-
|
|
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
|
|
82
88
|
if (configJson != null)
|
|
83
|
-
|
|
84
|
-
var jsonObjs =
|
|
89
|
+
{
|
|
90
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
85
91
|
var configs = ${RowClass}.Configs;
|
|
86
92
|
configs.Clear();
|
|
87
93
|
configs.AddRange(jsonObjs);
|
|
88
94
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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 Exception(tip);
|
|
109
|
+
}
|
|
110
|
+
var loadUrl="Assets/Bundles/GameConfigs/Auto/${fullName}.json";
|
|
111
|
+
var configJson = UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(loadUrl);
|
|
112
|
+
if (configJson != null)
|
|
113
|
+
{
|
|
114
|
+
var jsonObjs = JSON.parse<${RowClass}[]>(configJson.text);
|
|
115
|
+
var configs = ${RowClass}.Configs;
|
|
116
|
+
configs.Clear();
|
|
117
|
+
configs.AddRange(jsonObjs);
|
|
118
|
+
}
|
|
119
|
+
else
|
|
120
|
+
{
|
|
121
|
+
Debug.LogError($"配表资源缺失: {loadUrl}");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
#endif
|
|
125
|
+
}
|
|
95
126
|
}
|
|
96
127
|
`
|
|
97
128
|
return temp
|