/// <summary>
 /// 对象反射
 /// </summary>
 /// <param name="t"></param>
 /// <param name="reflections"></param>
 /// <param name="mod"></param>
 public static void GetObject(TempReflection reflections, ModelElement mod)
 {
     for (int i = 0; i < reflections.Top; i++)
     {
         var m = reflections.All[i];
         if (m.name == mod.name)
         {
             if (m.FieldType == typeof(ModelElement))
             {
                 m.Value = mod;
             }
             else if (typeof(EventCallBack).IsAssignableFrom(m.FieldType))
             {
                 m.Value = EventCallBack.RegEvent(mod, m.FieldType);
             }
             else if (typeof(ModelInital).IsAssignableFrom(m.FieldType))
             {
                 var obj = Activator.CreateInstance(m.FieldType) as ModelInital;
                 obj.Initial(mod);
                 m.Value = obj;
             }
             else if (typeof(DataConversion).IsAssignableFrom(m.FieldType))
             {
                 m.Value = mod.GetComponent(m.FieldType.Name);
             }
             reflections.Top--;
             var j = reflections.Top;
             var a = reflections.All[j];
             reflections.All[i] = a;
             reflections.All[j] = m;
             break;
         }
     }
 }
        public static TempReflection ObjectFelds(object obj)
        {
            var            fs   = obj.GetType().GetFields();
            TempReflection temp = new TempReflection();

            temp.Top = fs.Length;
            ReflectionModel[] reflections = new ReflectionModel[temp.Top];
            for (int i = 0; i < fs.Length; i++)
            {
                ReflectionModel r = new ReflectionModel();
                r.field        = fs[i];
                r.FieldType    = fs[i].FieldType;
                r.name         = fs[i].Name;
                reflections[i] = r;
            }
            temp.All = reflections;
            return(temp);
        }
        public static void LoadToGameR(ModelElement mod, TempReflection reflections, string filter = "mod")
        {
            if (mod == null)
            {
#if DEBUG
                Debug.Log("Mod is null");
#endif
                return;
            }
            if (mod.tag == filter)
            {
                return;
            }
            var c = mod.child;
            for (int i = 0; i < c.Count; i++)
            {
                LoadToGameR(c[i], reflections, filter);
            }
            if (reflections != null)
            {
                GetObject(reflections, mod);
            }
        }