示例#1
0
 public static string GetFilters(ResourceRefList refList)
 {
     foreach (FieldInfo fi in typeof(UrhoConstants).GetFields(BindingFlags.Static | BindingFlags.Public))
     {
         StringHash val = fi.GetValue(null) as StringHash;
         if (val.Value == refList.GetResourceType())
         {
             ResourceExtensions ext = fi.GetCustomAttribute <ResourceExtensions>();
             if (ext != null)
             {
                 return(ext.Filter);
             }
             return(null);
         }
     }
     return(null);
 }
示例#2
0
        public static string GetFilters(string resType)
        {
            StringHash me = new StringHash(resType);

            foreach (FieldInfo fi in typeof(UrhoConstants).GetFields(BindingFlags.Static | BindingFlags.Public))
            {
                StringHash val = fi.GetValue(null) as StringHash;
                if (val.Value == me.Value)
                {
                    ResourceExtensions ext = fi.GetCustomAttribute <ResourceExtensions>();
                    if (ext != null)
                    {
                        return(ext.Filter);
                    }
                    return(null);
                }
            }
            return(null);
        }
示例#3
0
        public static string GetFilters(string[] resTypes)
        {
            StringBuilder ret = new StringBuilder();

            foreach (string s in resTypes)
            {
                StringHash me = new StringHash(s);
                foreach (FieldInfo fi in typeof(UrhoConstants).GetFields(BindingFlags.Static | BindingFlags.Public))
                {
                    StringHash val = fi.GetValue(null) as StringHash;
                    if (val.Value == me.Value)
                    {
                        ResourceExtensions ext = fi.GetCustomAttribute <ResourceExtensions>();
                        if (ret.Length > 0)
                        {
                            ret.Append("|");
                        }
                        ret.Append(ext.Filter);
                    }
                }
            }
            return(ret.ToString());
        }