public HotfixLoaderRequest Load(string rHotfixModuleName) { var rRequest = new HotfixLoaderRequest(rHotfixModuleName); rRequest.Start(Load_Async(rRequest)); return(rRequest); }
public async Task <HotfixLoaderRequest> Load(string rABPath, string rHotfixModuleName) { var rRequest = new HotfixLoaderRequest(rABPath, rHotfixModuleName); string rDLLPath = mHotfixDllDir + rRequest.ModuleName + ".bytes"; string rPDBPath = mHotfixDllDir + rRequest.ModuleName + "_PDB.bytes"; #if UNITY_EDITOR // 编辑器下的HotfixDebug模式直接加载DLL文件,方便做断点调试 if (HotfixManager.Instance.IsHotfixDebugMode()) { rDLLPath = mHotfixDebugDllDir + rRequest.ModuleName + ".dll"; rPDBPath = mHotfixDebugDllDir + rRequest.ModuleName + ".pdb"; Debug.Log("---Simulate load hotfix dll: " + rDLLPath); rRequest.DLLPath = rDLLPath; rRequest.PDBPath = rPDBPath; return(rRequest); } #endif if (ABPlatform.Instance.IsSumilateMode_Script()) { Debug.Log("---Simulate load ab: " + rRequest.ABPath); rRequest.DllBytes = File.ReadAllBytes(rDLLPath); rRequest.PdbBytes = File.ReadAllBytes(rPDBPath); } else { var rDLLAssetRequest = await ABLoader.Instance.LoadAsset(rRequest.ABPath, rDLLPath, false); if (rDLLAssetRequest.Asset != null) { var rTextAsset = rDLLAssetRequest.Asset as TextAsset; if (rTextAsset != null) { rRequest.DllBytes = rTextAsset.bytes; } } ABLoader.Instance.UnloadAsset(rRequest.ABPath); var rPDBAssetRequest = await ABLoader.Instance.LoadAsset(rRequest.ABPath, rPDBPath, false); if (rPDBAssetRequest.Asset != null) { var rTextAsset = rPDBAssetRequest.Asset as TextAsset; if (rTextAsset != null) { rRequest.PdbBytes = rTextAsset.bytes; } } ABLoader.Instance.UnloadAsset(rRequest.ABPath); } return(rRequest); }
/// <summary> /// @TODO: 暂时使用读取本地文件的方式加载,后期做好完整的资源管理之后再来改为 /// Assetbundle加载和本地AssetDataBase加载来回切换。 /// </summary> public IEnumerator Load_Async(HotfixLoaderRequest rRequest) { string rDLLPath = mHotfixDllDir + rRequest.hotfixModuleName + ".bytes"; string rPDBPath = mHotfixDllDir + rRequest.hotfixModuleName + "_PDB.bytes"; rRequest.dllBytes = File.ReadAllBytes(Path.GetFullPath(rDLLPath)); rRequest.pdbBytes = File.ReadAllBytes(Path.GetFullPath(rPDBPath)); yield return(0); }
public IEnumerator Load_Async(HotfixLoaderRequest rRequest) { string rDLLPath = mHotfixDllDir + rRequest.hotfixModuleName + ".bytes"; string rPDBPath = mHotfixDllDir + rRequest.hotfixModuleName + "_PDB.bytes"; if (ABPlatform.Instance.IsSumilateMode_Script()) { Debug.Log("---Simulate load ab: " + rRequest.ABPath); rRequest.dllBytes = File.ReadAllBytes(rDLLPath); rRequest.pdbBytes = File.ReadAllBytes(rPDBPath); } else { var rDLLAssetRequest = ABLoader.Instance.LoadAsset(rRequest.ABPath, rDLLPath, false); yield return(rDLLAssetRequest); if (rDLLAssetRequest.Asset != null) { var rTextAsset = rDLLAssetRequest.Asset as TextAsset; if (rTextAsset != null) { rRequest.dllBytes = rTextAsset.bytes; } } ABLoader.Instance.UnloadAsset(rRequest.ABPath); var rPDBAssetRequest = ABLoader.Instance.LoadAsset(rRequest.ABPath, rPDBPath, false); yield return(rPDBAssetRequest); if (rPDBAssetRequest.Asset != null) { var rTextAsset = rPDBAssetRequest.Asset as TextAsset; if (rTextAsset != null) { rRequest.pdbBytes = rTextAsset.bytes; } } ABLoader.Instance.UnloadAsset(rRequest.ABPath); } }