Ejemplo n.º 1
0
        /// <summary>
        /// 获取反射DLL后的类型集合DataTable
        /// </summary>
        /// <param name="assemblyPath"></param>
        /// <param name="lstTypes"></param>
        /// <param name="platform"></param>
        /// <returns></returns>
        public static DataTable GetTypeDataTable(string assemblyPath, ref List <Type> lstTypes, int platform = 1)
        {
            DataTable dt = new DataTable();

            lstTypes = ReflectHandler.GetTypeList(assemblyPath);
            List <TypeReflectDto> lstDto = new List <TypeReflectDto>();

            if (platform != 1 && platform != 2)
            {
                throw new Exception($"无效的入参[{nameof(platform)}]");
            }
            for (int i = 0; i < lstTypes.Count; i++)
            {
                if (platform == 1)
                {
                    Air.CodeGeneration.Data.Core.Attribute.DataBaseTableRuleAttribute attr = lstTypes[i].GetCustomAttribute <Air.CodeGeneration.Data.Core.Attribute.DataBaseTableRuleAttribute>();
                    if (attr == null)
                    {
                        continue;
                    }
                    if (attr.IsCreateGnore)
                    {
                        continue;
                    }
                }
                if (platform == 2)
                {
                    Air.CodeGeneration.Data.Attribute.DataBaseTableRuleAttribute attr = lstTypes[i].GetCustomAttribute <Air.CodeGeneration.Data.Attribute.DataBaseTableRuleAttribute>();
                    if (attr == null)
                    {
                        continue;
                    }
                    if (attr.IsCreateGnore)
                    {
                        continue;
                    }
                }
                TypeReflectDto item = new TypeReflectDto();
                item.Sort       = i + 1;
                item.Name       = lstTypes[i].Name;
                item.FieldCount = lstTypes[i].GetProperties().Count().ToString();
                item.IsSel      = true;
                lstDto.Add(item);
            }

            if (lstDto != null && lstDto.Count > 1)
            {
                lstDto.Add(new TypeReflectDto()
                {
                    FieldCount = "",
                    IsSel      = true,
                    Sort       = lstDto.Count + 1,
                    Name       = "全选"
                });
            }

            dt = lstDto.ToDataTable();
            return(dt);
        }
Ejemplo n.º 2
0
    // Update is called once per frame
    void OnTriggerEnter(Collider collider)
    {
        ReflectHandler reflectHandler = collider.GetComponent <ReflectHandler> ();

        if (reflectHandler)
        {
            // not exactly accurate
            Vector3 normal = collider.transform.position - transform.position;
            reflectHandler.onReflectHandler(normal);
        }
    }