Exemple #1
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;
     }
 }
Exemple #2
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);
    }
Exemple #3
0
 public static void PreLoad(IComponentFixture script, ComponentFixture3 component_object)
 {
     component_object.Script    = script;
     component_object.IsLoading = true;
 }