internal void OnEnable() { this._target_object = (ComponentFixture3)this.target; _lst_info = this._target_object.ListFiledInfo; _script_name_property = serializedObject.FindProperty("_cshap_file_name"); GetFieldList(_script_name_property.stringValue); }
static object ConvertItem(object o, Type t) { if (IsNull(o)) { return(null); } Type type_obj = typeof(Object); if (t.IsSubclassOf(type_obj)) { return(o); } ComponentFixture3 com = o as ComponentFixture3; if (com.Script != null || com.IsLoading) { if (com.IsLoading) { Debug.LogWarning("ComponentFixture3 Loop Connect"); } return(com.Script); } else { object ot = Activator.CreateInstance(t); Load3(ot as IComponentFixture, com); return(ot); } }
public static void PostLoad(IComponentFixture script, ComponentFixture3 component_object) { script.FixtureLoad(component_object); if (component_object._need_enable_afterload) { script.Enable(); component_object._need_enable_afterload = false; } }
internal static void Load3(IComponentFixture my3, ComponentFixture3 componentFixture) { componentFixture.OnAfterDeserialize(); ComponentFixture3.PreLoad(my3, componentFixture); Type type = my3.GetType(); foreach (var item in componentFixture.ListFiledInfo) { FieldInfo info = type.GetField(item.filed_name, BindingFlags.NonPublic | BindingFlags.Instance); if (info == null) { Debug.LogErrorFormat("FieldInfo not Exist:{0}", item.filed_name); continue; } Type sub_type = GetFieldType(info); if (info.FieldType.IsArray) { Array array = Array.CreateInstance(sub_type, item.arr.Count); for (int i = 0; i < item.arr.Count; i++) { array.SetValue(ConvertItem(item.arr[i], sub_type), i); } info.SetValue(my3, array); } else { object o = ConvertItem(item.obj, sub_type); if (IsNull(o)) { info.SetValue(my3, null); } else { info.SetValue(my3, o); } } } ComponentFixture3.PostLoad(my3, componentFixture); }
public void FixtureLoad(ComponentFixture3 comp) { _component = comp; OnFixtureLoad(); }
public static void PreLoad(IComponentFixture script, ComponentFixture3 component_object) { component_object.Script = script; component_object.IsLoading = true; }