mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2026-04-22 04:35:55 +08:00
update
This commit is contained in:
parent
51735b9ce0
commit
f352ec0d92
@ -32,7 +32,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public static implicit operator UnityComponent<T>(T a) { return new UnityComponent<T>(a); }
|
public static implicit operator UnityComponent<T>(T a) { return new UnityComponent<T>(a); }
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"UnityComponent<{typeof(T).ToMeta().TypeName}>";
|
return $"UnityComponent<{typeof(T).GetMeta().TypeName}>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,11 +31,11 @@ namespace DCFApixels.DragonECS
|
|||||||
Connect = connect;
|
Connect = connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IEcsComponentLifecycle<GameObjectConnect>.Enable(ref GameObjectConnect component)
|
void IEcsComponentLifecycle<GameObjectConnect>.OnAdd(ref GameObjectConnect component, short worldID, int entityID)
|
||||||
{
|
{
|
||||||
component = default;
|
component = default;
|
||||||
}
|
}
|
||||||
void IEcsComponentLifecycle<GameObjectConnect>.Disable(ref GameObjectConnect component)
|
void IEcsComponentLifecycle<GameObjectConnect>.OnDel(ref GameObjectConnect component, short worldID, int entityID)
|
||||||
{
|
{
|
||||||
if (component.Connect != null)
|
if (component.Connect != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -139,7 +139,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
|
|
||||||
Type type = system.GetType();
|
Type type = system.GetType();
|
||||||
TypeMeta meta = type.ToMeta();
|
TypeMeta meta = type.GetMeta();
|
||||||
|
|
||||||
if (CheckIsHidden(meta))
|
if (CheckIsHidden(meta))
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
private void DrawRunner(IEcsRunner runner, int index)
|
private void DrawRunner(IEcsRunner runner, int index)
|
||||||
{
|
{
|
||||||
Type type = runner.GetType();
|
Type type = runner.GetType();
|
||||||
TypeMeta meta = type.ToMeta();
|
TypeMeta meta = type.GetMeta();
|
||||||
|
|
||||||
if (CheckIsHidden(meta))
|
if (CheckIsHidden(meta))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
var system = _systemsList[i];
|
var system = _systemsList[i];
|
||||||
foreach (var interfaceType in system.meta.Type.GetInterfaces())
|
foreach (var interfaceType in system.meta.Type.GetInterfaces())
|
||||||
{
|
{
|
||||||
TypeMeta meta = interfaceType.ToMeta();
|
TypeMeta meta = interfaceType.GetMeta();
|
||||||
if (SYSTEM_INTERFACE_TYPE.IsAssignableFrom(interfaceType) && SYSTEM_INTERFACE_TYPE != interfaceType && (IsShowHidden || meta.IsHidden == false))
|
if (SYSTEM_INTERFACE_TYPE.IsAssignableFrom(interfaceType) && SYSTEM_INTERFACE_TYPE != interfaceType && (IsShowHidden || meta.IsHidden == false))
|
||||||
{
|
{
|
||||||
ProcessData data;
|
ProcessData data;
|
||||||
|
|||||||
@ -57,7 +57,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
sb.Append($"{SEPARATOR}");
|
sb.Append($"{SEPARATOR}");
|
||||||
if (pool.IsNullOrDummy() == false)
|
if (pool.IsNullOrDummy() == false)
|
||||||
{
|
{
|
||||||
sb.Append(pool.ComponentType.ToMeta().TypeName);
|
sb.Append(pool.ComponentType.GetMeta().TypeName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
sb.Append($"{SEPARATOR}");
|
sb.Append($"{SEPARATOR}");
|
||||||
if (pool.IsNullOrDummy() == false)
|
if (pool.IsNullOrDummy() == false)
|
||||||
{
|
{
|
||||||
sb.Append(pool.ComponentType.ToMeta().TypeName);
|
sb.Append(pool.ComponentType.GetMeta().TypeName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -185,7 +185,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
foreach (var inc in ids)
|
foreach (var inc in ids)
|
||||||
{
|
{
|
||||||
Type type = Target.World.GetComponentType(inc);
|
Type type = Target.World.GetComponentType(inc);
|
||||||
TypeMeta meta = type.ToMeta();
|
TypeMeta meta = type.GetMeta();
|
||||||
|
|
||||||
Color color = EcsGUI.SelectPanelColor(meta, i, 9);
|
Color color = EcsGUI.SelectPanelColor(meta, i, 9);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
TypeMeta meta = typeof(EcsPipeline).ToMeta();
|
TypeMeta meta = typeof(EcsPipeline).GetMeta();
|
||||||
_monitor = new GameObject($"{UnityEditorUtility.TransformToUpperName(meta.Name)}").AddComponent<PipelineMonitor>();
|
_monitor = new GameObject($"{UnityEditorUtility.TransformToUpperName(meta.Name)}").AddComponent<PipelineMonitor>();
|
||||||
Object.DontDestroyOnLoad(_monitor);
|
Object.DontDestroyOnLoad(_monitor);
|
||||||
_monitor.Set(Pipeline);
|
_monitor.Set(Pipeline);
|
||||||
|
|||||||
@ -875,7 +875,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
#region SelectPanelColor
|
#region SelectPanelColor
|
||||||
public static Color SelectPanelColor(ITypeMeta meta, int index, int total)
|
public static Color SelectPanelColor(ITypeMeta meta, int index, int total)
|
||||||
{
|
{
|
||||||
var trueMeta = meta.Type.ToMeta();
|
var trueMeta = meta.Type.GetMeta();
|
||||||
bool isCustomColor = trueMeta.IsCustomColor || meta.Color != trueMeta.Color;
|
bool isCustomColor = trueMeta.IsCustomColor || meta.Color != trueMeta.Color;
|
||||||
return SelectPanelColor(meta.Color, isCustomColor, index, total);
|
return SelectPanelColor(meta.Color, isCustomColor, index, total);
|
||||||
}
|
}
|
||||||
@ -1087,7 +1087,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
if (isAssignable)
|
if (isAssignable)
|
||||||
{
|
{
|
||||||
ITypeMeta meta = type.ToMeta();
|
ITypeMeta meta = type.GetMeta();
|
||||||
string description = meta.Description.Text;
|
string description = meta.Description.Text;
|
||||||
MetaGroup group = meta.Group;
|
MetaGroup group = meta.Group;
|
||||||
var splitedGroup = group.Splited;
|
var splitedGroup = group.Splited;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}).Select(o => (o, (ITypeMeta)o.ToMeta()));
|
}).Select(o => (o, (ITypeMeta)o.GetMeta()));
|
||||||
Setup(itemMetaPairs);
|
Setup(itemMetaPairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
meta = dummy.Type.ToMeta();
|
meta = dummy.Type.GetMeta();
|
||||||
}
|
}
|
||||||
return (dummy, meta);
|
return (dummy, meta);
|
||||||
});
|
});
|
||||||
@ -174,7 +174,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
{
|
{
|
||||||
IEnumerable<(IEcsPool pool, ITypeMeta meta)> itemMetaPairs = pools.Select(pool =>
|
IEnumerable<(IEcsPool pool, ITypeMeta meta)> itemMetaPairs = pools.Select(pool =>
|
||||||
{
|
{
|
||||||
return (pool, (ITypeMeta)pool.ComponentType.ToMeta());
|
return (pool, (ITypeMeta)pool.ComponentType.GetMeta());
|
||||||
});
|
});
|
||||||
Setup(itemMetaPairs);
|
Setup(itemMetaPairs);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -259,7 +259,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
|||||||
foreach (var cmp in cmps)
|
foreach (var cmp in cmps)
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
var meta = cmp.ComponentType.ToMeta();
|
var meta = cmp.ComponentType.GetMeta();
|
||||||
if (meta.IsHidden == false || IsShowHidden)
|
if (meta.IsHidden == false || IsShowHidden)
|
||||||
{
|
{
|
||||||
Type componentType = cmp.ComponentType;
|
Type componentType = cmp.ComponentType;
|
||||||
@ -372,7 +372,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
|||||||
}
|
}
|
||||||
private void DrawRuntimeComponent(int entityID, IEcsPool pool, int total, int index)
|
private void DrawRuntimeComponent(int entityID, IEcsPool pool, int total, int index)
|
||||||
{
|
{
|
||||||
var meta = pool.ComponentType.ToMeta();
|
var meta = pool.ComponentType.GetMeta();
|
||||||
if (meta.IsHidden == false || IsShowHidden)
|
if (meta.IsHidden == false || IsShowHidden)
|
||||||
{
|
{
|
||||||
Type componentType = pool.ComponentType;
|
Type componentType = pool.ComponentType;
|
||||||
|
|||||||
@ -128,7 +128,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITypeMeta meta = template is ITypeMeta metaOverride ? metaOverride : template.Type.ToMeta();
|
ITypeMeta meta = template is ITypeMeta metaOverride ? metaOverride : template.Type.GetMeta();
|
||||||
|
|
||||||
Rect rect = position;
|
Rect rect = position;
|
||||||
if (EcsGUI.DrawTypeMetaBlock(ref rect, rootProperty, meta))
|
if (EcsGUI.DrawTypeMetaBlock(ref rect, rootProperty, meta))
|
||||||
|
|||||||
@ -93,7 +93,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
var componentProp = GetTargetProperty(prop);
|
var componentProp = GetTargetProperty(prop);
|
||||||
|
|
||||||
|
|
||||||
ITypeMeta meta = template is ITypeMeta metaOverride ? metaOverride : template.Type.ToMeta();
|
ITypeMeta meta = template is ITypeMeta metaOverride ? metaOverride : template.Type.GetMeta();
|
||||||
|
|
||||||
if (EcsGUI.DrawTypeMetaElementBlock(ref rect, _componentsProp, index, componentProp, meta))
|
if (EcsGUI.DrawTypeMetaElementBlock(ref rect, _componentsProp, index, componentProp, meta))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUG
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#endif
|
#endif
|
||||||
using DCFApixels.DragonECS.Core;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -60,10 +59,9 @@ namespace DCFApixels.DragonECS
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public abstract class ComponentTemplateBase<T> : ComponentTemplateBase, ICloneable
|
public abstract class ComponentTemplateBase<T> : ComponentTemplateBase, ICloneable
|
||||||
|
where T : struct
|
||||||
{
|
{
|
||||||
protected static readonly TypeMeta Meta = EcsDebugUtility.GetTypeMeta<T>();
|
protected static readonly TypeMeta Meta = EcsDebugUtility.GetTypeMeta<T>();
|
||||||
protected static readonly bool _isHasIEcsComponentLifecycle;
|
|
||||||
protected static readonly IEcsComponentLifecycle<T> _iEcsComponentLifecycle;
|
|
||||||
|
|
||||||
private static bool _defaultValueTypeInit = false;
|
private static bool _defaultValueTypeInit = false;
|
||||||
private static T _defaultValueType;
|
private static T _defaultValueType;
|
||||||
@ -93,11 +91,6 @@ namespace DCFApixels.DragonECS
|
|||||||
return _defaultValueType;
|
return _defaultValueType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static ComponentTemplateBase()
|
|
||||||
{
|
|
||||||
_isHasIEcsComponentLifecycle = EcsComponentLifecycleHandler<T>.isHasHandler;
|
|
||||||
_iEcsComponentLifecycle = EcsComponentLifecycleHandler<T>.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
protected T component = DefaultValueType;
|
protected T component = DefaultValueType;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
|||||||
List<DragonDocsMeta> metas = new List<DragonDocsMeta>(256);
|
List<DragonDocsMeta> metas = new List<DragonDocsMeta>(256);
|
||||||
foreach (var type in GetTypes())
|
foreach (var type in GetTypes())
|
||||||
{
|
{
|
||||||
metas.Add(new DragonDocsMeta(type.ToMeta()));
|
metas.Add(new DragonDocsMeta(type.GetMeta()));
|
||||||
}
|
}
|
||||||
DragonDocsMeta[] array = metas.ToArray();
|
DragonDocsMeta[] array = metas.ToArray();
|
||||||
Array.Sort(array);
|
Array.Sort(array);
|
||||||
|
|||||||
@ -261,7 +261,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
|||||||
{
|
{
|
||||||
GUILayout.TextArea(IsUseCustomNames ? meta.Name : meta.TypeName, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
|
GUILayout.TextArea(IsUseCustomNames ? meta.Name : meta.TypeName, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
|
||||||
|
|
||||||
if (meta.TryGetSourceType(out System.Type targetType) && ScriptsCache.TryGetScriptAsset(targetType.ToMeta(), out MonoScript script))
|
if (meta.TryGetSourceType(out System.Type targetType) && ScriptsCache.TryGetScriptAsset(targetType.GetMeta(), out MonoScript script))
|
||||||
{
|
{
|
||||||
EcsGUI.Layout.ScriptAssetButton(script, GUILayout.Width(18f));
|
EcsGUI.Layout.ScriptAssetButton(script, GUILayout.Width(18f));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user