少年修仙传客户端基础资源
dabaoji
2023-11-13 0a23e1b83f8fda8ab9f9e32fe71c26c431faf63a
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
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using System;
[System.Reflection.Obfuscation(Exclude = true)]
public class ILRuntimeCrossBinding : EditorWindow
{
    [MenuItem("ILRuntime/生成跨域继承适配器")]
    public static void ShowWindow()
    {
        EditorWindow.GetWindow<ILRuntimeCrossBinding>("生成跨域继承适配器").Show();
    }
 
    Type type = typeof(IConfigPostProcess);
 
    private void OnGUI()
    {
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        GUILayout.Label(string.Format("类名:{0}", type.Name));
        EditorGUILayout.Space();
 
        if (GUILayout.Button("生成"))
        {
            GenerateCrossbindAdapter();
        }
    }
 
    void GenerateCrossbindAdapter()
    {
        var path = "Assets/ILRuntime/Src/Inheritance/{0}Adapter.cs";
        using (System.IO.StreamWriter sw = new System.IO.StreamWriter(string.Format(path, type.Name)))
        {
            sw.WriteLine(ILRuntime.Runtime.Enviorment.CrossBindingCodeGenerator.GenerateCrossBindingAdapterCode(type, "ILCrossBinding"));
        }
        AssetDatabase.Refresh();
        DebugEx.Log("跨域继承适配生成成功");
    }
}
#endif