GetTypeStr() public static method

public static GetTypeStr ( Type t ) : string
t Type
return string
コード例 #1
0
    static string GetTypeStr(Type type)
    {
        Type trueType = GetType(type);

        if (trueType == typeof(void))
        {
            return("void");
        }
        else
        {
            return(ToLuaExport.GetTypeStr(trueType));
        }
    }
コード例 #2
0
		public DelegateType(Type t)
		{
			this.type = t;
			this.strType = ToLuaExport.GetTypeStr(t);
			if (t.get_IsGenericType())
			{
				this.name = ToLuaExport.GetGenericLibName(t);
			}
			else
			{
				this.name = ToLuaExport.GetTypeStr(t);
				this.name = this.name.Replace(".", "_");
			}
		}
コード例 #3
0
ファイル: LuaBindingMaker.cs プロジェクト: frozen4/UnityPlus
        private static string[] GetGenericName(Type[] types)
        {
            string[] results = new string[types.Length];

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].IsGenericType)
                {
                    results[i] = GetGenericName(types[i]);
                }
                else
                {
                    results[i] = ToLuaExport.GetTypeStr(types[i]);
                }
            }

            return(results);
        }
コード例 #4
0
    static string GetNameSpace(Type t, out string libName)
    {
        if (t.IsGenericType)
        {
            string space = t.Namespace;

            if (t.FullName.Contains("+"))
            {
                space = ToLuaExport.GetTypeStr(t);
                int len = t.Namespace == null ? 0 : t.Namespace.Length;
                space = space.Remove(0, len);
                space = RemoveTemplateSign(space);
                int index = space.LastIndexOf('.');
                libName = space.Substring(index + 1);
                space   = space.Substring(0, index);
                space   = t.Namespace + space;
            }
            else
            {
                libName = ToLuaExport.GetTypeStr(t);
                libName = space == null ? libName : libName.Substring(space.Length + 1);
                libName = RemoveTemplateSign(libName);
            }

            return(space);
        }
        else
        {
            string space = t.FullName;

            if (space.Contains("+"))
            {
                space = space.Replace('+', '.');
                int index = space.LastIndexOf('.');
                libName = space.Substring(index + 1);
                return(space.Substring(0, index));
            }
            else
            {
                libName = t.Namespace == null ? space : space.Substring(t.Namespace.Length + 1);
                return(t.Namespace);
            }
        }
    }
コード例 #5
0
ファイル: LuaBindingMaker.cs プロジェクト: frozen4/UnityPlus
        public BindType(Type t)
        {
            type = t;

            name = ToLuaExport.GetTypeStr(t);

            if (t.IsGenericType)
            {
                libName  = ToLuaExport.GetGenericLibName(t);
                wrapName = ToLuaExport.GetGenericLibName(t);
            }
            else
            {
                libName  = t.FullName.Replace("+", ".");
                wrapName = name.Replace('.', '_');

                if (name == "object")
                {
                    wrapName = "System_Object";
                }
            }

            if (t.BaseType != null)
            {
                baseName = ToLuaExport.GetTypeStr(t.BaseType);

                if (baseName == "ValueType")
                {
                    baseName = null;
                }
            }

            if (t.GetConstructor(Type.EmptyTypes) == null && t.IsAbstract && t.IsSealed)
            {
                baseName = null;
                IsStatic = true;
            }
        }
コード例 #6
0
 public DelegateType(Type t)
 {
     type    = t;
     strType = ToLuaExport.GetTypeStr(t);
     name    = ToLuaExport.ConvertToLibSign(strType);
 }