mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 18:14:35 +08:00
Compare commits
No commits in common. "67477ef90d69b01b04593d2aa4c5e5b502bb6c12" and "7c6fdcfb6f5e1c78f8d68220926332caa60a4a95" have entirely different histories.
67477ef90d
...
7c6fdcfb6f
@ -163,7 +163,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
if (_fieldProperty != null)
|
||||
{
|
||||
_fieldProperty.managedReferenceValue = cmptmp.Clone_Reflection();
|
||||
_fieldProperty.managedReferenceValue = cmptmp.Clone();
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
@ -33,20 +33,6 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
return self.IsSubclassOf(typeof(UnityObject));
|
||||
}
|
||||
|
||||
private static MethodInfo memberwiseCloneMethdo = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
internal static object Clone_Reflection(this object obj)
|
||||
{
|
||||
if (obj is ICloneable cloneable)
|
||||
{
|
||||
return cloneable.Clone();
|
||||
}
|
||||
return memberwiseCloneMethdo.Invoke(obj, null);
|
||||
}
|
||||
internal static object Clone_Reflection<T>(this T obj)
|
||||
{
|
||||
return Clone_Reflection((object)obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private static void SelectComponent(ComponentTemplatesDropDown.Item item)
|
||||
{
|
||||
//EcsGUI.Changed = true;
|
||||
currentProperty.managedReferenceValue = item.Obj.Clone_Reflection();
|
||||
currentProperty.managedReferenceValue = item.Obj.Clone();
|
||||
currentProperty.isExpanded = false;
|
||||
currentProperty.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
@ -87,7 +87,6 @@ namespace DCFApixels.DragonECS
|
||||
_defaultValueType = (T)field.GetValue(null);
|
||||
}
|
||||
}
|
||||
_defaultValueTypeInit = true;
|
||||
}
|
||||
return _defaultValueType;
|
||||
}
|
||||
@ -145,6 +144,22 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
internal static class ComponentTemplateExtensions
|
||||
{
|
||||
private static MethodInfo memberwiseCloneMethdo = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
internal static IComponentTemplate Clone(this IComponentTemplate obj)
|
||||
{
|
||||
if(obj is ICloneable cloneable)
|
||||
{
|
||||
return (IComponentTemplate)cloneable.Clone();
|
||||
}
|
||||
return (IComponentTemplate)memberwiseCloneMethdo.Invoke(obj, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
@ -166,10 +181,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
Type interfaceType = typeof(IComponentTemplate);
|
||||
|
||||
_types = UnityEditorUtility._serializableTypes.Where(type => interfaceType.IsAssignableFrom(type)).ToArray();
|
||||
//foreach (var type in _types)
|
||||
//{
|
||||
// EcsDebugUtility.GetTypeMeta(type);
|
||||
//}
|
||||
foreach (var type in _types)
|
||||
{
|
||||
EcsDebugUtility.GetTypeMeta(type);
|
||||
}
|
||||
_dummies = new IComponentTemplate[_types.Length];
|
||||
|
||||
for (int i = 0; i < _types.Length; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user