|
@@ -1,5 +1,7 @@
|
1
|
|
-using HybridCLR.Editor;
|
|
1
|
+#if HybridCLR
|
2
|
2
|
using HybridCLR.Editor.Commands;
|
|
3
|
+using HybridCLR.Editor;
|
|
4
|
+#endif
|
3
|
5
|
using Newtonsoft.Json;
|
4
|
6
|
using System;
|
5
|
7
|
using System.Collections;
|
|
@@ -16,17 +18,17 @@ namespace TModule.Editor
|
16
|
18
|
{
|
17
|
19
|
public class AssetBudleTool : EditorWindow
|
18
|
20
|
{
|
19
|
|
- private string AssetBudleConfigName= "AssetBundleConfig.asset";
|
|
21
|
+ private string AssetBudleConfigName = "AssetBundleConfig.asset";
|
20
|
22
|
private string AssetBudleConfigPath;
|
21
|
23
|
private string AssetbudleToolConfigName = "BudleToolConfig.asset";
|
22
|
|
- private string AssetbudleToolConfigPath;
|
|
24
|
+ private string AssetbudleToolConfigPath;
|
23
|
25
|
private AssetBudleConfig _list;
|
24
|
26
|
private AssetBudleConfig BudleConfig
|
25
|
27
|
{
|
26
|
28
|
get
|
27
|
29
|
{
|
28
|
30
|
_list = _list ?? AssetDatabase.LoadAssetAtPath<AssetBudleConfig>(AssetBudleConfigPath);
|
29
|
|
- if(_list==null)
|
|
31
|
+ if (_list == null)
|
30
|
32
|
{
|
31
|
33
|
_list = CreateInstance<AssetBudleConfig>();
|
32
|
34
|
AssetDatabase.CreateAsset(_list, AssetBudleConfigPath);
|
|
@@ -43,7 +45,7 @@ namespace TModule.Editor
|
43
|
45
|
get
|
44
|
46
|
{
|
45
|
47
|
_toolConfig = _toolConfig ?? AssetDatabase.LoadAssetAtPath<AssetBudleToolConfig>(AssetbudleToolConfigPath);
|
46
|
|
- if(_toolConfig==null)
|
|
48
|
+ if (_toolConfig == null)
|
47
|
49
|
{
|
48
|
50
|
_toolConfig = CreateInstance<AssetBudleToolConfig>();
|
49
|
51
|
AssetDatabase.CreateAsset(_toolConfig, AssetbudleToolConfigPath);
|
|
@@ -172,9 +174,12 @@ namespace TModule.Editor
|
172
|
174
|
SetABName();
|
173
|
175
|
BuildPipeline.BuildAssetBundles(tartgetPath, BuildAssetBundleOptions.None, _buildTarget);
|
174
|
176
|
|
|
177
|
+#if HybridCLR
|
175
|
178
|
CompileDllCommand.CompileDll(_buildTarget);
|
|
179
|
+
|
176
|
180
|
CopyAOTAssembliesToPath(tartgetPath);
|
177
|
181
|
CopyHotUpdateAssembliesToPath(tartgetPath);
|
|
182
|
+#endif
|
178
|
183
|
if (BudleToolConfig.m_copyToStreamingAssets)
|
179
|
184
|
CopyToStreamingAssets();
|
180
|
185
|
|
|
@@ -189,7 +194,7 @@ namespace TModule.Editor
|
189
|
194
|
AssetBundleEntity assetBudle = BudleConfig.m_AB[i];
|
190
|
195
|
if (assetBudle.m_isFolder)
|
191
|
196
|
{
|
192
|
|
- string[] floderArr = new string[] {GetAbsolutePath(assetBudle.m_name) };
|
|
197
|
+ string[] floderArr = new string[] { GetAbsolutePath(assetBudle.m_name) };
|
193
|
198
|
SaveFolderSettings(floderArr);
|
194
|
199
|
}
|
195
|
200
|
else
|
|
@@ -230,7 +235,7 @@ namespace TModule.Editor
|
230
|
235
|
string variant = file.Extension.Equals(".unity", StringComparison.CurrentCultureIgnoreCase) ? "unity3d" : "assetbundle";
|
231
|
236
|
|
232
|
237
|
AssetImporter importer = AssetImporter.GetAtPath(newPath);
|
233
|
|
- if(importer.assetBundleName=="None" || string.IsNullOrEmpty(importer.assetBundleName))
|
|
238
|
+ if (importer.assetBundleName == "None" || string.IsNullOrEmpty(importer.assetBundleName))
|
234
|
239
|
{
|
235
|
240
|
importer.SetAssetBundleNameAndVariant(fileName, variant);
|
236
|
241
|
importer.SaveAndReimport();
|
|
@@ -242,7 +247,7 @@ namespace TModule.Editor
|
242
|
247
|
{
|
243
|
248
|
string toPath = Application.streamingAssetsPath;
|
244
|
249
|
string tartgetPath = BudleToolConfig.m_savePath + "/" + _buildTarget.ToString();
|
245
|
|
- CopyDirectory(tartgetPath, toPath,true);
|
|
250
|
+ CopyDirectory(tartgetPath, toPath, true);
|
246
|
251
|
AssetDatabase.Refresh();
|
247
|
252
|
}
|
248
|
253
|
|
|
@@ -380,11 +385,12 @@ namespace TModule.Editor
|
380
|
385
|
}
|
381
|
386
|
}
|
382
|
387
|
|
|
388
|
+#if HybridCLR
|
383
|
389
|
public void CopyAOTAssembliesToPath(string path)
|
384
|
390
|
{
|
385
|
391
|
string aotAssembliesSrcDir = SettingsUtil.GetAssembliesPostIl2CppStripDir(_buildTarget);
|
386
|
|
- List<string> aotMetaAssemblyFiles = Resources.Load<HotfixConfig>("HotfixUpdate/ÈȸüÅäÖñí").m_hotfixUpdateAotDlls;
|
387
|
|
- foreach (var dll in aotMetaAssemblyFiles)
|
|
392
|
+
|
|
393
|
+ foreach (var dll in Resources.Load<HotfixConfig>("HotfixUpdate/ÈȸüÅäÖñí").m_hotfixUpdateAotDlls)
|
388
|
394
|
{
|
389
|
395
|
string srcDllPath = $"{aotAssembliesSrcDir}/{dll}";
|
390
|
396
|
if (!File.Exists(srcDllPath))
|
|
@@ -414,5 +420,6 @@ namespace TModule.Editor
|
414
|
420
|
}
|
415
|
421
|
AssetDatabase.Refresh();
|
416
|
422
|
}
|
|
423
|
+#endif
|
417
|
424
|
}
|
418
|
425
|
}
|