少年修仙传客户端基础资源
lwb
2021-01-22 8153a3d3c3b1132fd36f453c57141074e1a41dfc
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
using System.IO;
using ILRuntime.Mono.Cecil.Pdb;
using ILRuntime.Runtime.Enviorment;
 
class ILRuntimeUtility : SingletonMonobehaviour<ILRuntimeUtility>
{
    private AppDomain appdomain;
 
    public void Init()
    {
        LoadILRuntime();
    }
 
    void LoadILRuntime()
    {
        appdomain = new AppDomain();
        var dllPath = string.Empty;
        var pdbPath = string.Empty;
        if (AssetSource.refdataFromEditor)
        {
            dllPath = ResourcesPath.ResourcesOutAssetPath + "logic/Logic.dll.bytes";
            pdbPath = ResourcesPath.ResourcesOutAssetPath + "logic/Logic.pdb";
        }
        else
        {
            dllPath = AssetVersionUtility.GetAssetFilePath("logic/Logic.dll.bytes");
            pdbPath = AssetVersionUtility.GetAssetFilePath("logic/Logic.pdb");
        }
        var fs = new FileStream(dllPath, FileMode.Open);
        var p = new FileStream(pdbPath, FileMode.Open);
        appdomain.LoadAssembly(fs, p, new PdbReaderProvider());
    }
 
    public void LaunchStart()
    {
        appdomain.Invoke("GameLogicMgr", "Init", null, null);
    }
 
}