void OnEnable() { _selectNamespace = XLuaExportSettings.GetNamespaces(); _customAssembly = XLuaExportSettings.GetAssemblies(); //XLuaExportSettings.GetExcludeTypes(); //XLuaExportSettings.GetDoNotGen(); //XLuaExportSettings.GetBlackList(); _allUnityNamespaces.Clear(); var unityNamespaces = (from assembly in AppDomain.CurrentDomain.GetAssemblies() where !(assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder) from type in assembly.GetExportedTypes() where type.Namespace != null select type.Namespace); foreach (var item in unityNamespaces) { _allUnityNamespaces.Add(item); } // var temp = from assembly in AppDomain.CurrentDomain.GetAssemblies() // where !(assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder) && !assembly.FullName.StartsWith("Unity") // select assembly; _allCustomAssembly.Clear(); var compilationAssemblies = UnityEditor.Compilation.CompilationPipeline.GetAssemblies(); foreach (var item in compilationAssemblies) { if (item.flags != UnityEditor.Compilation.AssemblyFlags.EditorAssembly) { _allCustomAssembly.Add(item.name); } } }
void OnGUI() { //xlua的生成工具 GUILayout.BeginHorizontal(); if (GUILayout.Button("Clear Generated Code")) { CSObjectWrapEditor.Generator.ClearAll(); } if (GUILayout.Button("Generate Code")) { CSObjectWrapEditor.Generator.GenAll(); } GUILayout.EndHorizontal(); //保存数据 GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Apply", GUILayout.Width(100))) { XLuaExportSettings.UpdateNamespaces(_selectNamespace); XLuaExportSettings.UpdateAssemblies(_customAssembly); XLuaExportSettings.Save(); EditorUtility.DisplayDialog("Tip", "Save data", "OK"); } GUILayout.EndHorizontal(); GUILayout.BeginVertical(); //xlua生成筛选 GUILayout.BeginHorizontal(); //需要包含的命名空间 NamespaceDraw(); //自定义的程序集 CustomAssemblyDraw(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUILayout.Height(Screen.height * 0.33f)); //排除类型 ExcludeTypesDraw(); //xlua DoNotGen XLuaDoNotGenDraw(); //xlua BlackList XLuaBlackListDraw(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }