Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Assets/Slua/Editor/ICustomExportPost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using UnityEngine;
using System.Collections;

namespace SLua{
public interface ICustomExportPost {

}
}
12 changes: 12 additions & 0 deletions Assets/Slua/Editor/ICustomExportPost.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions Assets/Slua/Editor/LuaCodeGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ static public void Custom()
}

CustomExport.OnAddCustomClass(fun);

//detect interface ICustomExportPost,and call OnAddCustomClass
assembly = System.Reflection.Assembly.Load("Assembly-CSharp-Editor");
types = assembly.GetExportedTypes();
foreach (Type t in types)
{
if(typeof(ICustomExportPost).IsAssignableFrom(t)){
System.Reflection.MethodInfo method = t.GetMethod("OnAddCustomClass",System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
if(method != null){
method.Invoke(null,new object[]{fun});
}
}
}

GenerateBind(exports, "BindCustom", 3, path);
if(autoRefresh)
Expand Down Expand Up @@ -1472,7 +1485,7 @@ bool isUsefullMethod(MethodInfo method)
if (method.Name != "GetType" && method.Name != "GetHashCode" && method.Name != "Equals" &&
method.Name != "ToString" && method.Name != "Clone" &&
method.Name != "GetEnumerator" && method.Name != "CopyTo" &&
method.Name != "op_Implicit" &&
method.Name != "op_Implicit" && method.Name != "op_Explicit" &&
!method.Name.StartsWith("get_", StringComparison.Ordinal) &&
!method.Name.StartsWith("set_", StringComparison.Ordinal) &&
!method.Name.StartsWith("add_", StringComparison.Ordinal) &&
Expand Down Expand Up @@ -1729,12 +1742,15 @@ void Write(StreamWriter file, string fmt, params object[] args)
file.Write("\t");


if (args.Length == 0)
file.WriteLine(fmt);
if (args.Length == 0){
file.Write(fmt);
file.Write("\r\n"); //TODO add by zilch,try to make win&mac generate same files.
}
else
{
string line = string.Format(fmt, args);
file.WriteLine(line);
file.Write(line);
file.Write("\r\n");
}

if (fmt.EndsWith("{")) indent++;
Expand Down