【m】资源拷贝修改

This commit is contained in:
zhangzheng
2026-03-25 14:05:21 +08:00
parent 561672ad69
commit 2b9f4e78b6
8 changed files with 23 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using HybridCLR.Editor.Commands;
@@ -47,16 +48,16 @@ namespace Stary.Evo.Editor
#endif
}
public static void OneShaderMark()
public static void OneShaderMark(Action<string> complete)
{
OneShaderMark(GetOneKeyBuildEntities());
OneShaderMark(GetOneKeyBuildEntities(),complete);
}
/// <summary>
/// (一键)收集shader【材质异常或资源修改】
/// </summary>
/// <param name="oneKeyBuildEntities"></param>
public static void OneShaderMark(List<OneKeyBuildEntity> oneKeyBuildEntities)
public static void OneShaderMark(List<OneKeyBuildEntity> oneKeyBuildEntities,Action<string> complete)
{
#if HotUpdate
//标记全部资源
@@ -65,7 +66,10 @@ namespace Stary.Evo.Editor
if (oneKeyBUildEntity.isRaw)
{
MarkAdressable.CollectSvc(MarkAdressable.DomainRoot, oneKeyBUildEntity.DomainName,
() => { EditorUtility.DisplayDialog("收集shader【材质异常或资源修改】", "收集成功", "确定"); });
() =>
{
complete?.Invoke(oneKeyBUildEntity.DomainName);
});
}
}

View File

@@ -70,6 +70,7 @@ namespace Stary.Evo.Editor
StreamingAssetsFilter.KeepFiles=new string[0];
StreamingAssetsFilter.OnPreprocessBuild();
}
ShowNotification(new GUIContent("拷贝完成!"), 2f);
}
[ButtonGroup]
[Button("$GetBuildAPKName", ButtonSizes.Large, ButtonStyle.FoldoutButton)]

View File

@@ -44,7 +44,8 @@ public static class StreamingAssetsFilter
// 移动到临时目录
string backupPath = Path.Combine(tempBackupPath, relativePath);
Directory.CreateDirectory(Path.GetDirectoryName(backupPath));
File.Move(file, backupPath);
File.Copy(file, backupPath,true);
File.Delete(file);
}
}
@@ -72,7 +73,12 @@ public static class StreamingAssetsFilter
string relativePath = file.Replace(tempBackupPath + Path.DirectorySeparatorChar, "")
.Replace(tempBackupPath, "");
string originalPath = Path.Combine(streamingAssetsPath, relativePath);
// 检查目标文件是否已存在
if (File.Exists(originalPath))
{
Debug.Log($"跳过恢复: {originalPath} (文件已存在)");
return;
}
Directory.CreateDirectory(Path.GetDirectoryName(originalPath));
File.Move(file, originalPath);
}