Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
 public void FixtureLoad(ComponentFixture3 comp)
 {
     _component = comp;
     OnFixtureLoad();
 }
Exemplo n.º 6
0
 public static void PreLoad(IComponentFixture script, ComponentFixture3 component_object)
 {
     component_object.Script    = script;
     component_object.IsLoading = true;
 }