update component interfaaces

This commit is contained in:
DCFApixels 2025-03-17 13:05:23 +08:00
parent 3986149267
commit b331f4fda1
3 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@
#endif #endif
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS.Core
{ {
#region IEcsWorldComponent #region IEcsWorldComponent
public interface IEcsWorldComponent<T> public interface IEcsWorldComponent<T>
@ -44,11 +44,11 @@ namespace DCFApixels.DragonECS
void Enable(ref T component); void Enable(ref T component);
void Disable(ref T component); void Disable(ref T component);
} }
public static class EcsComponentResetHandler<T> public static class EcsComponentLifecycleHandler<T>
{ {
public static readonly IEcsComponentLifecycle<T> instance; public static readonly IEcsComponentLifecycle<T> instance;
public static readonly bool isHasHandler; public static readonly bool isHasHandler;
static EcsComponentResetHandler() static EcsComponentLifecycleHandler()
{ {
T def = default; T def = default;
if (def is IEcsComponentLifecycle<T> intrf) if (def is IEcsComponentLifecycle<T> intrf)

View File

@ -1,6 +1,7 @@
#if DISABLE_DEBUG #if DISABLE_DEBUG
#undef DEBUG #undef DEBUG
#endif #endif
using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -45,8 +45,8 @@ namespace DCFApixels.DragonECS
private int[] _recycledItems; private int[] _recycledItems;
private int _recycledItemsCount = 0; private int _recycledItemsCount = 0;
private readonly IEcsComponentLifecycle<T> _componentLifecycleHandler = EcsComponentResetHandler<T>.instance; private readonly IEcsComponentLifecycle<T> _componentLifecycleHandler = EcsComponentLifecycleHandler<T>.instance;
private readonly bool _isHasComponentLifecycleHandler = EcsComponentResetHandler<T>.isHasHandler; private readonly bool _isHasComponentLifecycleHandler = EcsComponentLifecycleHandler<T>.isHasHandler;
private readonly IEcsComponentCopy<T> _componentCopyHandler = EcsComponentCopyHandler<T>.instance; private readonly IEcsComponentCopy<T> _componentCopyHandler = EcsComponentCopyHandler<T>.instance;
private readonly bool _isHasComponentCopyHandler = EcsComponentCopyHandler<T>.isHasHandler; private readonly bool _isHasComponentCopyHandler = EcsComponentCopyHandler<T>.isHasHandler;