Ejemplo n.º 1
0
 void MakeProperty()
 {
     FieldInfo[]    allFields     = FCValueType.GetFields(m_nClassType, m_bOnlyThisAPI);
     PropertyInfo[] allProperties = FCValueType.GetProperties(m_nClassType, m_bOnlyThisAPI);
     if (allFields != null)
     {
         foreach (FieldInfo field in allFields)
         {
             if (IsNeedExportMember(field.Name))
             {
                 PushFieldInfo(field);
             }
         }
     }
     if (allProperties != null)
     {
         foreach (PropertyInfo property in allProperties)
         {
             if (IsNeedExportMember(property.Name))
             {
                 PushPropertyInfo(property);
             }
         }
     }
 }
Ejemplo n.º 2
0
    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);
    }