update extension sample

pull/134/head
hevinci 2023-07-05 15:20:34 +08:00
parent 2643ab81ed
commit a7d9a4ecbc
1 changed files with 7 additions and 5 deletions

View File

@ -20,6 +20,7 @@ namespace YooAsset.Editor
} }
private string _manifestPath = string.Empty; private string _manifestPath = string.Empty;
private string _packageName = "DefaultPackage";
private void OnGUI() private void OnGUI()
{ {
@ -39,7 +40,8 @@ namespace YooAsset.Editor
{ {
if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150))) if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150)))
{ {
AssetBundleBuilderHelper.ClearStreamingAssetsFolder(); string streamingAssetsRoot = AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot();
EditorTools.ClearFolder(streamingAssetsRoot);
CopyPackageFiles(_manifestPath); CopyPackageFiles(_manifestPath);
} }
} }
@ -57,18 +59,18 @@ namespace YooAsset.Editor
// 拷贝核心文件 // 拷贝核心文件
{ {
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes"; string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{manifestFileName}.bytes"; string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.bytes";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }
{ {
string sourcePath = $"{outputDirectory}/{manifestFileName}.hash"; string sourcePath = $"{outputDirectory}/{manifestFileName}.hash";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{manifestFileName}.hash"; string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{manifestFileName}.hash";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }
{ {
string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName); string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
string sourcePath = $"{outputDirectory}/{fileName}"; string sourcePath = $"{outputDirectory}/{fileName}";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{fileName}"; string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }
@ -78,7 +80,7 @@ namespace YooAsset.Editor
{ {
fileCount++; fileCount++;
string sourcePath = $"{outputDirectory}/{packageBundle.FileName}"; string sourcePath = $"{outputDirectory}/{packageBundle.FileName}";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{packageBundle.FileName}"; string destPath = $"{AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot()}/{_packageName}/{packageBundle.FileName}";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }