少年修仙传客户端基础资源
hch
2024-04-11 5485af23b421d1a47bed3770f99523a67f03f7f0
0312 修复加载问题,优化内存释放
2个文件已修改
14 ■■■■■ 已修改文件
Assets/Launch/LoadDll.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/ResourcesModel.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/LoadDll.cs
@@ -111,8 +111,7 @@
                    if (asset == "Assembly-CSharp.dll.bytes")
                    {
                        assetData = new byte[www.downloadHandler.data.Length - 3];
                        Array.Copy(assetData, 3, www.downloadHandler.data, 0, www.downloadHandler.data.Length);
                        Array.Copy(www.downloadHandler.data, 3, assetData, 0, assetData.Length);
                    }
                    else
                    { 
@@ -145,9 +144,8 @@
            {
                if (aotDllName == "Assembly-CSharp.dll.bytes")
                    continue;
                byte[] dllBytes = ReadBytesFromStreamingAssets(aotDllName);
                // 加载assembly对应的dll,会自动为它hook。一旦aot泛型函数的native函数不存在,用解释器版本代码
                LoadImageErrorCode err = RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, mode);
                LoadImageErrorCode err = RuntimeApi.LoadMetadataForAOTAssembly(ReadBytesFromStreamingAssets(aotDllName), mode);
                Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. mode:{mode} ret:{err}");
            }
        }
@@ -157,7 +155,7 @@
#if !UNITY_EDITOR
        LoadMetadataForAOTAssemblies();
        _hotUpdateAss = Assembly.Load(ReadBytesFromStreamingAssets("Assembly-CSharp.dll.bytes"));
        s_assetDatas.Clear();
        s_assetDatas = null;
#else
            if (_hotUpdateAss == null)
                _hotUpdateAss = System.AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "Assembly-CSharp");
Assets/Launch/ResourcesModel.cs
@@ -157,8 +157,8 @@
        {
            spriteBundle?.Unload(true);  //true完全卸载,更新后重新加载
            prefabBundle?.Unload(true);
            assetVersions.Clear();
            localAssetVersions.Clear();
            assetVersions = null;
            localAssetVersions = null;
            Debug.Log("提前ResourcesModel.Destroy资源");
        }
@@ -439,7 +439,7 @@
                    if (isOK)
                        InitLocalLogicbytes(value);
                    else
                        Debug.LogError("InitTable logicbytes error");
                        Debug.LogWarning("InitTable logicbytes error");
                }, StreamingAssetPath));
            }
        }