Ejemplo n.º 1
0
    //分为3部分:System(不会变),Unity(更新Unity版本时变),Custom(Assembly-CSharp里,每次改代码时变)
    public static string[] RegisterTypeToString(List <Type> systemTypes, List <Type> unityTypes, List <Type> customTypes)
    {
        string systemType = "";
        string unityType  = "";
        string customType = "";

        for (int i = 0; i < systemTypes.Count; i++)
        {
            string trueName = WrapReflectionTools.GetTrueName(systemTypes[i]);

            if (WrapReflectionTools.IsStaticClass(systemTypes[i]))
            {
                systemType += "CQuark.AppDomain.RegisterType (typeof(" + trueName + "), \"" + trueName + "\");";
            }
            else
            {
                systemType += "CQuark.AppDomain.RegisterType<" + trueName + "> ();";
            }
            systemType += "\n";
        }
        for (int i = 0; i < unityTypes.Count; i++)
        {
            string trueName = WrapReflectionTools.GetTrueName(unityTypes[i]);

            if (WrapReflectionTools.IsStaticClass(unityTypes[i]))
            {
                unityType += "CQuark.AppDomain.RegisterType (typeof(" + trueName + "), \"" + trueName + "\");";
            }
            else
            {
                unityType += "CQuark.AppDomain.RegisterType<" + trueName + "> ();";
            }
            unityType += "\n";
        }
        for (int i = 0; i < customTypes.Count; i++)
        {
            string trueName = WrapReflectionTools.GetTrueName(customTypes[i]);

            if (WrapReflectionTools.IsStaticClass(customTypes[i]))
            {
                customType += "CQuark.AppDomain.RegisterType (typeof(" + trueName + "), \"" + trueName + "\");";
            }
            else
            {
                customType += "CQuark.AppDomain.RegisterType<" + trueName + "> ();";
            }
            customType += "\n";
        }
        return(new string[] { systemType, unityType, customType });
    }