hch
19 分钟以前 39e8090ed6471b2f95743681d89fb524eea8e00a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
 
public class InGameDownTestUtility
{
 
    public static bool enable
    {
        get { return LocalSave.GetBool("InGameDownLoadTestEanble", false); }
        set { LocalSave.SetBool("InGameDownLoadTestEanble", value); }
    }
 
    public static bool isWifi
    {
        get { return LocalSave.GetBool("InGameDownLoadWifi", true); }
        set { LocalSave.SetBool("InGameDownLoadWifi", value); }
    }
 
    public static bool isReadStreamingAssets
    {
        get { return LocalSave.GetBool("isReadStreamingAssets", false); }
        set { LocalSave.SetBool("isReadStreamingAssets", value); }
    }
 
    public static bool isReadVesionEx
    {
        get { return LocalSave.GetBool("isReadVesionEx", false); }
        set { LocalSave.SetBool("isReadVesionEx", value); }
    }
 
 
    public static bool isPartPackage
    {
        get { return LocalSave.GetBool("InGameDownLoadPartPackage", false); }
        set { LocalSave.SetBool("InGameDownLoadPartPackage", value); }
    }
 
    public static void ClearAssets()
    {
        Directory.Delete(Application.persistentDataPath, true);
        LocalSave.DeleteKey("HasDownLoadFullAsset");
    }
 
#if UNITY_EDITOR
    [RuntimeInitializeOnLoadMethod]
    public static void Init()
    {
        if (InGameDownTestUtility.enable)
        {
            VersionConfig.Get().assetAccess = InstalledAsset.NullAsset;
        }
        else
        {
            VersionConfig.Get().assetAccess = InstalledAsset.IngoreDownLoad;
        }
 
        VersionConfig.Get().partAssetPackage = InGameDownTestUtility.isPartPackage;
    }
#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))
        {
            File.Delete(versionConfigExFile);
        }
        File.WriteAllText(versionConfigExFile, json);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        Debug.Log("同步VersionConfigEx.txt成功");
#endif
        return enable && isReadVesionEx;
    }
}