yyl
2026-03-26 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7
Main/System/AssetVersion/InGameDownTestUtility.cs
@@ -3,6 +3,8 @@
using UnityEngine;
using System.IO;
using System;
using Cysharp.Threading.Tasks;
#if UNITY_EDITOR
using UnityEditor;
#endif
@@ -51,33 +53,40 @@
    [RuntimeInitializeOnLoadMethod]
    public static void Init()
    {
        if (InGameDownTestUtility.enable)
        {
            VersionConfig.Get().assetAccess = InstalledAsset.NullAsset;
        }
        else
        {
            VersionConfig.Get().assetAccess = InstalledAsset.IngoreDownLoad;
        }
        VersionConfig.GetAsync().ContinueWith(config => {
            if (InGameDownTestUtility.enable)
            {
                config.assetAccess = InstalledAsset.NullAsset;
            }
            else
            {
                config.assetAccess = InstalledAsset.IngoreDownLoad;
            }
        VersionConfig.Get().partAssetPackage = InGameDownTestUtility.isPartPackage;
            config.partAssetPackage = InGameDownTestUtility.isPartPackage;
        }).Forget();
    }
#endif
    public static bool GetReadVerionEx()
    {
#if UNITY_EDITOR
        //生成VersionConfigEx.txt 提供给AOT启动时使用
        var json = JsonUtility.ToJson(VersionConfig.Get());
        string versionConfigExFile = Application.dataPath + "/Resources/VersionConfigEx.txt";
        if (File.Exists(versionConfigExFile))
        VersionConfig.GetAsync().ContinueWith(config =>
        {
            File.Delete(versionConfigExFile);
        }
        File.WriteAllText(versionConfigExFile, json);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        Debug.Log("同步VersionConfigEx.txt成功");
            //生成VersionConfigEx.txt 提供给AOT启动时使用
            var json = JsonUtility.ToJson(config);
            string versionConfigExFile = Application.dataPath + "/Resources/VersionConfigEx.txt";
            if (File.Exists(versionConfigExFile))
            {
                File.Delete(versionConfigExFile);
            }
            File.WriteAllText(versionConfigExFile, json);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            Debug.Log("同步VersionConfigEx.txt成功");
        }).Forget();
#endif
        return enable && isReadVesionEx;
    }