123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System.IO;
- using UnityEditor;
- using UnityEngine;
- using GFGGame;
- namespace GFGEditor
- {
- [InitializeOnLoad]
- public class BuildHotfixEditor
- {
- //Unity代码生成dll位置
- private const string ScriptAssembliesDir = "Library/ScriptAssemblies";
- //热更代码dll文件
- private const string HotfixDll = "Game.HotUpdate.dll";
- //热更代码pdb文件
- private const string HotfixPdb = "Game.HotUpdate.pdb";
- //热更代码存放位置
- private const string CodeDir = LauncherConfig.DllDirHotfix;
- //热更代码存放位置
- private const string EditorDllDir = "Assets/Editor/Excel/DLL/";
- static BuildHotfixEditor()
- {
- //CopyCode();
- }
- static void CopyCode()
- {
- Debug.Log($"Copy Hotfix Code");
- if (!Directory.Exists(CodeDir))
- Directory.CreateDirectory(CodeDir);
- var path = Path.Combine(ScriptAssembliesDir, HotfixDll);
- if (File.Exists(path))
- {
- File.Copy(path, Path.Combine(CodeDir, "Game.HotUpdate.dll.bytes"), true);
- //File.Delete(path);
- path = Path.Combine(ScriptAssembliesDir, HotfixPdb);
- File.Copy(path, Path.Combine(CodeDir, "Game.HotUpdate.pdb.bytes"), true);
- //File.Delete(path);
- Debug.Log($"复制Game.HotUpdate.dll, Game.HotUpdate.pdb到Res/Code完成");
- AssetDatabase.Refresh();
- }
- }
- }
- }
|