コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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);
        }
    }