【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);
}

View File

@@ -52,7 +52,6 @@ namespace Stary.Evo.Editor
// 添加新模式
defines.Add(mode.ToString());
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, string.Join(";", defines));
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
_hotUpdate = mode;
CustomEditorPrefs.SetString("ChangeHotUpdateSchema", _hotUpdate.ToString());
@@ -61,9 +60,8 @@ namespace Stary.Evo.Editor
// 添加解决方案文件重新生成逻辑
EditorApplication.delayCall += () =>
{
EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
Debug.Log("已强制重新生成解决方案文件");
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
};
}
}

View File

@@ -55,7 +55,6 @@ namespace Stary.Evo.Editor
// 添加新模式
defines.Add(mode.ToString());
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, string.Join(";", defines));
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
_pLayerMode = mode;
CustomEditorPrefs.SetString("ChangePlayerSchema", _pLayerMode.ToString());
ValidateModeMenu();
@@ -65,7 +64,7 @@ namespace Stary.Evo.Editor
{
//EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
Debug.Log("已强制重新生成解决方案文件");
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
};
}
}

View File

@@ -52,7 +52,6 @@ namespace Stary.Evo.Editor
// 添加新模式
defines.Add(mode.ToString());
PlayerSettings.SetScriptingDefineSymbolsForGroup(currentTarget, string.Join(";", defines));
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
_pointClondMode = mode;
CustomEditorPrefs.SetString("ChangePoindClondSchema", _pointClondMode.ToString());
@@ -61,9 +60,8 @@ namespace Stary.Evo.Editor
// 添加解决方案文件重新生成逻辑
EditorApplication.delayCall += () =>
{
EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation();
Debug.Log("已强制重新生成解决方案文件");
Debug.Log($"当前编译符号: {string.Join(";", defines)}"); // 添加调试日志
};
}
}

View File

@@ -64,9 +64,8 @@ namespace Stary.Evo.Editor
{
#if HotUpdate
EditorTools.ClearUnityConsole();
AutoBuildPackage.OneShaderMark(OneKeyBuildEntities);
EditorUtility.DisplayDialog("提示", $"标记所有shader完成", "确定");
AutoBuildPackage.OneShaderMark(OneKeyBuildEntities,(domainName)=>
ShowNotification(new GUIContent($"收集【{domainName}】的shader【材质异常或资源修改】"), 2f));
#endif
}

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.tools",
"version": "1.3.25",
"version": "1.3.26",
"displayName": "00.StaryEvo.Tools",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",