#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("生成跨域继承适配器").Show(); } Type type = typeof(Snxxz.UI.OperationBase); 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