void MakeMethod() { MethodInfo[] allMethods = FCValueType.GetMethods(m_nClassType, m_bOnlyThisAPI);// m_nClassType.GetMethods(); // 函数+get/set方法 if (allMethods == null) { return; } m_CurMethods.Clear(); m_CurValidMethods.Clear(); string szDeclareName = string.Empty; foreach (MethodInfo method in allMethods) { if (!IsNeedExportMember(method.Name)) { continue; } // 去掉参数都一样的,因为FC脚本中 []与List是一个数据类型 szDeclareName = FCValueType.GetMethodDeclare(method); if (m_CurValidMethods.ContainsKey(szDeclareName)) { // 必要的话,这里做个替换 FCValueType.ReplaceMethod(m_CurValidMethods, m_CurMethods, szDeclareName, method); continue; } m_CurValidMethods[szDeclareName] = method; m_CurMethods.Add(method); } foreach (MethodInfo method in m_CurMethods) { PushMethodInfo(method); } }
void MakeMethod() { MethodInfo[] allMethods = FCValueType.GetMethods(m_nClassType, m_bOnlyThisAPI);// m_nClassType.GetMethods(); // 函数+get/set方法 if (allMethods == null) { return; } m_CurMethods.Clear(); m_CurValidMethods.Clear(); string szDeclareName = string.Empty; bool bNeedExport = false; foreach (MethodInfo method in allMethods) { if (!IsNeedExportMember(method.Name)) { continue; } if (m_CurDontWrapName.ContainsKey(method.Name)) { continue; } if (FCExclude.IsDontExportMethod(method)) { continue; } bNeedExport = true; // 去掉参数都一样的,因为FC脚本中 []与List是一个数据类型 szDeclareName = FCValueType.GetMethodDeclare(method, ref bNeedExport); if (!bNeedExport) { continue; } if (m_CurValidMethods.ContainsKey(szDeclareName)) { // 必要的话,这里做个替换 FCValueType.ReplaceMethod(m_CurValidMethods, m_CurMethods, szDeclareName, method); continue; } m_CurValidMethods[szDeclareName] = method; m_CurMethods.Add(method); } foreach (MethodInfo method in m_CurMethods) { PushMethodInfo(method); } // 特殊导出UnityEvent<T>模板类 Type nBaseType = m_nClassType.BaseType; if (nBaseType != null && nBaseType.Name == "UnityEvent`1") { PushUnityEventTemplateFunc(m_nClassType); } }
void MakeMethod() { MethodInfo[] allMethods = FCValueType.GetMethods(m_nClassType, m_bOnlyThisAPI);// m_nClassType.GetMethods(); // 函数+get/set方法 if (allMethods == null) { return; } foreach (MethodInfo method in allMethods) { PushMethodInfo(method); } }
void WrapSubClass(StringBuilder fileData, Type nClassType) { string szWrapName = FCValueType.GetClassName(nClassType) + "_wrap"; m_CurClassFunc.Clear(); m_CurSameName.Clear(); m_CurRefNameSpace.Clear(); m_CurRefNameSpacesFlags.Clear(); PushNameSpace("System"); PushNameSpace("System.Collections.Generic"); PushNameSpace("System.Text"); PushNameSpace("UnityEngine"); PushNameSpace("UnityObject = UnityEngine.Object"); // 给这个家伙换个名字吧 //PushNameSpace("UnityEngine.Rendering"); // 先生成init函数 FieldInfo[] allFields = FCValueType.GetFields(nClassType, m_bOnlyThisAPI); PropertyInfo[] allProperties = FCValueType.GetProperties(nClassType, m_bOnlyThisAPI); MethodInfo[] allMethods = FCValueType.GetMethods(nClassType, m_bOnlyThisAPI); if (allFields != null) { foreach (FieldInfo field in allFields) { PushFieldInfo(field); } } if (allProperties != null) { foreach (PropertyInfo property in allProperties) { PushPropertyInfo(property); } } if (allMethods != null) { m_CurFuncCount.Clear(); string szFuncName = string.Empty; int nFuncCount = 0; foreach (MethodInfo method in allMethods) { szFuncName = method.Name; nFuncCount = 0; m_CurFuncCount.TryGetValue(szFuncName, out nFuncCount); m_CurFuncCount[szFuncName] = nFuncCount + 1; } foreach (MethodInfo method in allMethods) { PushMethodInfo(method); } } MakeEqual(); MakeHash(); MakeReleaseRef(); MakeDel(); MakeNew(); // 生成Init函数 MakeInitFunc(FCValueType.GetClassName(nClassType)); MakeGetObj(); // 生成 _Ty get_obj()函数 MakeWrapClass(szWrapName); }