static void GenerateAdaptor() { var generator = new LC_GeneratorManager(); generator.GenerateAdaptor(_adaptorTypes); Debug.LogWarning("== ILRuntime/GenerateAdaptor Complete!!! =="); }
static void GenerateDelegate() { // 委托适配器 将委托实例传给ILRuntime外部使用 //TODO 根据Unity主程序类生成 DelegateConvertor //TOOD 根据IL包生成 DelegateAdapter var generator = new LC_GeneratorManager(); generator.GenerateHelper(); Debug.LogWarning("== ILRuntime/GenerateDelegate Complete!!! =="); }
protected override bool LoadData(string message_name) { string[] mess_array = message_name.Split('|'); int para_count = 0; string name = mess_array[0]; string paras = ""; if (mess_array.Length > 1) { paras = mess_array[1]; } List <string> para_array = LC_GeneratorManager.SplitComplexParameter(paras); para_count = para_array.Count; string args = ""; string args_no_type = ""; for (int i = 0; i < para_count; i++) { string tmp = para_array[i]; string now_arg = " arg" + i + ","; args += tmp + now_arg; args_no_type += now_arg; } if (args_no_type.Length == 0) { args_no_type = "null"; } SetKeyValue("{$args}", args.Trim(',')); SetKeyValue("{$args_no_type}", args_no_type.Trim(',')); SetKeyValue("{$args_count}", para_count); SetKeyValue("{$MethodName}", name); return(true); }
//private Regex _fixedParaRegex = new Regex(@"<.*?>"); protected override bool LoadData(string data) { if (data == null || String.IsNullOrEmpty(Template)) return false; string[] content = data.Split('|'); if (content.Length < 4) { Debug.Log(string.Format("== Delegate Convert Format is Missing Len:[{0}] Content:[{1}] ==", content.Length, data)); } string method = content[0]; string generic = content[1]; string para = content[2]; string ret = content[3]; //if (method.Contains("DG.Tweening.Core.DOGetter")) //{ // int i = 0; //} if (String.IsNullOrEmpty(ret)) { if (_returnRegex.IsMatch(Template)) { Template = _returnRegex.Replace(Template, ""); } SetKeyValue("{$returnType}", ""); SetKeyValue("{$symbol}", ""); } else { if (_voidRegex.IsMatch(Template)) { Template = _voidRegex.Replace(Template, ""); } SetKeyValue("{$returnType}", ret); } int para_count = LC_GeneratorManager.SplitComplexParameter(para).Count; string args = ""; for (int i = 0; i < para_count; i++) { args += "arg" + i + ","; } args = args.Trim(','); string fixed_name = method; if (!string.IsNullOrEmpty(generic)) { fixed_name += "<" + generic + ">"; } SetKeyValue("{$DelegateName}", fixed_name); if (!String.IsNullOrEmpty(para)) { //Debug.Log(string.Format("==LoadData Content:[{0}] Len:[{1}] Ret:[{2}]", para, para.Length, ret)); SetKeyValue("{$symbol}", ", "); } else { SetKeyValue("{$symbol}", ""); } SetKeyValue("{$argsType}", para); if (!String.IsNullOrEmpty(para)) { SetKeyValue("{$angle_left}", "<"); SetKeyValue("{$angle_right}", ">"); } else { SetKeyValue("{$angle_left}", ""); SetKeyValue("{$angle_right}", ""); } SetKeyValue("{$args}", args); ClearDefinedText(); return true; }