CombineTypeStr() public static method

public static CombineTypeStr ( string space, string name ) : string
space string
name string
return string
コード例 #1
0
ファイル: ToLuaMenu.cs プロジェクト: Yeyunrong/U3d
        public BindType(Type t)
        {
            //if (CustomSettings.staticClassTypes == null)
            //{
            //    Debug.LogError("\nCustomSettings.staticClassTypes is null ! ");
            //    return;
            //}

            if (t == null)
            {
                throw new NotSupportedException("\nBindType Type is null ! ");
            }

            if (typeof(System.MulticastDelegate).IsAssignableFrom(t))
            {
                throw new NotSupportedException(string.Format("\nDon't export Delegate {0} as a class, register it in customDelegateList", LuaMisc.GetTypeName(t)));
            }

            //if (IsObsolete(t))
            //{
            //    throw new Exception(string.Format("\n{0} is obsolete, don't export it!", LuaMisc.GetTypeName(t)));
            //}

            type      = t;
            nameSpace = ToLuaExport.GetNameSpace(t, out libName);
            name      = ToLuaExport.CombineTypeStr(nameSpace, libName);
            libName   = ToLuaExport.ConvertToLibSign(libName);

            if (name == "object")
            {
                wrapName = "System_Object";
                name     = "System.Object";
            }
            else if (name == "string")
            {
                wrapName = "System_String";
                name     = "System.String";
            }
            else
            {
                wrapName = name.Replace('.', '_');
                wrapName = ToLuaExport.ConvertToLibSign(wrapName);
            }

            if ((type.IsAbstract && type.IsSealed))
            {
                IsStatic = true;
            }

            baseType = LuaMisc.GetExportBaseType(type);
        }
コード例 #2
0
        public BindType(Type t)
        {
            // 如果是委托及其衍生类,抛出异常
            if (typeof(System.MulticastDelegate).IsAssignableFrom(t))
            {
                throw new NotSupportedException(string.Format("\nDon't export Delegate {0} as a class, register it in customDelegateList", LuaMisc.GetTypeName(t)));
            }

            //if (IsObsolete(t))
            //{
            //    throw new Exception(string.Format("\n{0} is obsolete, don't export it!", LuaMisc.GetTypeName(t)));
            //}

            type = t;
            // 获取 type 的命名空间,并将 libName 更新为从完全限定名到命名空间后一位(也就是带'.'字符)的字符
            nameSpace = ToLuaExport.GetNameSpace(t, out libName);
            // 用"."字符拼接参数 space 与 name 为一个字符串并返回
            name = ToLuaExport.CombineTypeStr(nameSpace, libName);
            // 过滤、替换字符串中指定的字符并返回
            libName = ToLuaExport.ConvertToLibSign(libName);

            // 按规律设置 name 和 wrapName 的值
            if (name == "object")
            {
                wrapName = "System_Object";
                name     = "System.Object";
            }
            else if (name == "string")
            {
                wrapName = "System_String";
                name     = "System.String";
            }
            else
            {
                wrapName = name.Replace('.', '_');
                wrapName = ToLuaExport.ConvertToLibSign(wrapName);
            }

            // 获取 CustomSettings.staticClassTypes(静态类型)中 type 的 index
            int index = CustomSettings.staticClassTypes.IndexOf(type);

            // 如果大等于 0(代表没有这个类型)或 type 是虚类、密封类,设置 IsStatic 为真
            if (index >= 0 || (type.IsAbstract && type.IsSealed))
            {
                IsStatic = true;
            }

            // 获取导出文件的基类
            baseType = LuaMisc.GetExportBaseType(type);
        }
コード例 #3
0
ファイル: ToLuaMenu.cs プロジェクト: lingyun5905/Record
        public BindType(Type t)
        {
            if (typeof(System.MulticastDelegate).IsAssignableFrom(t))
            {
                string ex = string.Format("\nDon't export Delegate {0} as a class, register it in customDelegateList",
                                          LuaMisc.GetTypeName(t));
                throw new NotSupportedException(ex);
            }

            if (IsObsolete(t))
            {
                throw new Exception(string.Format("\n{0} is obsolete, don't export it!", LuaMisc.GetTypeName(t)));
            }

            type      = t;
            nameSpace = ToLuaExport.GetNameSpace(t, out libName);
            name      = ToLuaExport.CombineTypeStr(nameSpace, libName);
            libName   = ToLuaExport.ConvertToLibSign(libName);

            if (name == "object")
            {
                wrapName = "System_Object";
                name     = "System.Object";
            }
            else if (name == "string")
            {
                wrapName = "System_String";
                name     = "System.String";
            }
            else
            {
                wrapName = name.Replace('.', '_');
                wrapName = ToLuaExport.ConvertToLibSign(wrapName);
            }

            int index = CustomSettings.staticClassTypes.IndexOf(type);

            if (index >= 0 || (type.IsAbstract && type.IsSealed))
            {
                IsStatic = true;
            }

            baseType = LuaMisc.GetExportBaseType(type);
        }
コード例 #4
0
ファイル: ToLuaMenu.cs プロジェクト: 737871854/ToLua_Study
        public BindType(Type t)
        {
            if (typeof(System.MulticastDelegate).IsAssignableFrom(t))
            {
                throw new NotSupportedException(string.Format("\nDon't export Delegate {0} as a class, register it in customDelegateList", LuaMisc.GetTypeName(t)));
            }

            type      = t;
            nameSpace = ToLuaExport.GetNameSpace(t, out libName);
            name      = ToLuaExport.CombineTypeStr(nameSpace, libName);
            libName   = ToLuaExport.ConvertToLibSign(libName);

            if (name == "object")
            {
                wrapName = "System_Object";
                name     = "System.Object";
            }
            else if (name == "string")
            {
                wrapName = "System_String";
                name     = "System.String";
            }
            else
            {
                wrapName = name.Replace('.', '_');
                wrapName = ToLuaExport.ConvertToLibSign(wrapName);
            }

            if (type.BaseType != null && type.BaseType != typeof(ValueType))
            {
                baseType = type.BaseType;
            }

            int index = CustomSettings.staticClassTypes.IndexOf(type);

            if (index >= 0 || (type.GetConstructor(Type.EmptyTypes) == null && type.IsAbstract && type.IsSealed))
            {
                IsStatic = true;
                baseType = baseType == typeof(object) ? null : baseType;
            }
        }
コード例 #5
0
        public string nameSpace = null;     //注册到lua的table层级

        public BindType(Type t)
        {
            type      = t;
            nameSpace = ToLuaExport.GetNameSpace(t, out libName);
            name      = ToLuaExport.CombineTypeStr(nameSpace, libName);
            //nameSpace = ToLuaExport.ConvertToLibSign(nameSpace);
            libName = ToLuaExport.ConvertToLibSign(libName);

            if (name == "object")
            {
                wrapName = "System_Object";
                name     = "System.Object";
            }
            else if (name == "string")
            {
                wrapName = "System_String";
                name     = "System.String";
            }
            else
            {
                wrapName = name.Replace('.', '_');
                wrapName = ToLuaExport.ConvertToLibSign(wrapName);
            }

            if (t.BaseType != null && t.BaseType != typeof(ValueType))
            {
                baseType = t.BaseType;
            }

            int index = CustomSettings.staticClassTypes.IndexOf(t);

            if (index >= 0 || (t.GetConstructor(Type.EmptyTypes) == null && t.IsAbstract && t.IsSealed))
            {
                IsStatic = true;
                baseType = baseType == typeof(object) ?  null : baseType;
            }
        }
コード例 #6
0
            public BindType(Type t)
            {
                type      = t;
                nameSpace = ToLuaExport.GetNameSpace(t, out libName);
                className = ToLuaExport.CombineTypeStr(nameSpace, libName);
                libName   = ToLuaExport.ConvertToLibSign(libName);

                if (typeof(System.Delegate).IsAssignableFrom(t) || typeof(System.MulticastDelegate).IsAssignableFrom(t))
                {
                    isDelegate   = true;
                    typeClassify = "delegate";
                }
                else
                {
                    if (className == "object")
                    {
                        wrapName  = "System_Object";
                        className = "System.Object";
                    }
                    else if (className == "string")
                    {
                        wrapName  = "System_String";
                        className = "System.String";
                    }
                    else
                    {
                        wrapName = className.Replace('.', '_');
                        wrapName = ToLuaExport.ConvertToLibSign(wrapName);
                    }
                    wrapName += "Wrap";
                    if (t.BaseType != null && t.BaseType != typeof(ValueType))
                    {
                        baseClass = t.BaseType.AssemblyQualifiedName;
                    }

                    if ((t.GetConstructor(Type.EmptyTypes) == null && t.IsAbstract && t.IsSealed))
                    {
                        isStatic  = true;
                        baseClass = baseClass == typeof(object).AssemblyQualifiedName ? null : baseClass;
                    }
                    if (t.IsAbstract)
                    {
                        typeClassify = "abstract";
                    }
                    else if (t.IsInterface)
                    {
                        typeClassify = "interface";
                    }
                    else if (t.IsEnum)
                    {
                        typeClassify = "enum";
                    }
                    else if (t.IsClass && isStatic)
                    {
                        typeClassify = "static class";
                    }
                    else
                    {
                        typeClassify = "class";
                    }
                }
            }