rename path

This commit is contained in:
DCFApixels 2025-03-17 16:10:33 +08:00
parent 7fdd4cc7cc
commit 3fd97cce1f
18 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#if DISABLE_DEBUG #if DISABLE_DEBUG
#undef DEBUG #undef DEBUG
#endif #endif
using DCFApixels.DragonECS.Core;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -60,12 +61,29 @@ namespace DCFApixels.DragonECS
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public abstract class ComponentTemplateBase<T> : ComponentTemplateBase public abstract class ComponentTemplateBase<T> : ComponentTemplateBase
{ {
protected static TypeMeta Meta = EcsDebugUtility.GetTypeMeta<T>(); protected static readonly TypeMeta Meta = EcsDebugUtility.GetTypeMeta<T>();
protected static readonly bool _isHasIEcsComponentLifecycle;
protected static readonly IEcsComponentLifecycle<T> _iEcsComponentLifecycle;
static ComponentTemplateBase()
{
_isHasIEcsComponentLifecycle = EcsComponentLifecycleHandler<T>.isHasHandler;
_iEcsComponentLifecycle = EcsComponentLifecycleHandler<T>.instance;
}
private static T InitComponent()
{
T result = default;
if (_isHasIEcsComponentLifecycle)
{
_iEcsComponentLifecycle.Enable(ref result);
}
return result;
}
[SerializeField] [SerializeField]
protected T component; protected T component = InitComponent();
[SerializeField] [SerializeField]
[HideInInspector] [HideInInspector]
private byte _offset; // Fucking Unity drove me crazy with the error "Cannot get managed reference index with out bounds offset". This workaround helps avoid that error. private byte _offset; // Avoids the error "Cannot get managed reference index with out bounds offset"
#region Properties #region Properties
public sealed override ITypeMeta BaseMeta { get { return Meta; } } public sealed override ITypeMeta BaseMeta { get { return Meta; } }