add
This commit is contained in:
34
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.cs
Executable file
34
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.cs
Executable file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using XLua;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using CSObjectWrapEditor;
|
||||
|
||||
public class LinkXmlGen : ScriptableObject
|
||||
{
|
||||
public TextAsset Template;
|
||||
|
||||
public static IEnumerable<CustomGenTask> GetTasks(LuaEnv lua_env, UserConfig user_cfg)
|
||||
{
|
||||
LuaTable data = lua_env.NewTable();
|
||||
var assembly_infos = (from type in (user_cfg.ReflectionUse.Concat(user_cfg.LuaCallCSharp))
|
||||
group type by type.Assembly.GetName().Name into assembly_info
|
||||
select new { FullName = assembly_info.Key, Types = assembly_info.ToList()}).ToList();
|
||||
data.Set("assembly_infos", assembly_infos);
|
||||
|
||||
yield return new CustomGenTask
|
||||
{
|
||||
Data = data,
|
||||
Output = new StreamWriter(GeneratorConfig.common_path + "/link.xml",
|
||||
false, Encoding.UTF8)
|
||||
};
|
||||
}
|
||||
|
||||
[GenCodeMenu]//加到Generate Code菜单里头
|
||||
public static void GenLinkXml()
|
||||
{
|
||||
Generator.CustomGen(ScriptableObject.CreateInstance<LinkXmlGen>().Template.text, GetTasks);
|
||||
}
|
||||
}
|
||||
13
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.cs.meta
Executable file
13
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.cs.meta
Executable file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fa8c6bd6daed854c98654418f48a830
|
||||
timeCreated: 1482482561
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- Template: {fileID: 4900000, guid: 384feb229d259f549bbbac9e910b782b, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.tpl.txt
Executable file
13
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.tpl.txt
Executable file
@@ -0,0 +1,13 @@
|
||||
<%
|
||||
require "TemplateCommon"
|
||||
%>
|
||||
|
||||
<linker>
|
||||
<%ForEachCsList(assembly_infos, function(assembly_info)%>
|
||||
<assembly fullname="<%=assembly_info.FullName%>">
|
||||
<%ForEachCsList(assembly_info.Types, function(type)
|
||||
%><type fullname="<%=type:ToString()%>" preserve="all"/>
|
||||
<%end)%>
|
||||
</assembly>
|
||||
<%end)%>
|
||||
</linker>
|
||||
8
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.tpl.txt.meta
Executable file
8
Assets/XLua/Src/Editor/LinkXmlGen/LinkXmlGen.tpl.txt.meta
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 384feb229d259f549bbbac9e910b782b
|
||||
timeCreated: 1481621844
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user