Merge branch 'new_dev' of https://github.com/DCFApixels/DragonECS into new_dev

This commit is contained in:
Mikhail 2024-02-26 12:22:59 +08:00
commit 278ce467e5
6 changed files with 9 additions and 12 deletions

View File

@ -397,7 +397,7 @@ namespace DCFApixels.DragonECS
} }
public static TypeMetaDataCached GetCachedTypeMeta(Type type) public static TypeMetaDataCached GetCachedTypeMeta(Type type)
{ {
if(_metaCache.TryGetValue(type, out TypeMetaDataCached result) == false) if (_metaCache.TryGetValue(type, out TypeMetaDataCached result) == false)
{ {
result = new TypeMetaDataCached(type); result = new TypeMetaDataCached(type);
_metaCache.Add(type, result); _metaCache.Add(type, result);
@ -438,7 +438,7 @@ namespace DCFApixels.DragonECS
this.group = group; this.group = group;
this.color = color; this.color = color;
this.description = description; this.description = description;
this.tags = tags; this.tags = tags;
} }
} }
@ -528,7 +528,7 @@ namespace DCFApixels.DragonECS
{ {
get get
{ {
if(_typeMetaData == null) if (_typeMetaData == null)
{ {
_typeMetaData = new TypeMetaData( _typeMetaData = new TypeMetaData(
Type, Type,

View File

@ -1,9 +1,7 @@
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.RunnersCore; using DCFApixels.DragonECS.RunnersCore;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using static DCFApixels.DragonECS.EcsDebugUtility; using static DCFApixels.DragonECS.EcsDebugUtility;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS

View File

@ -275,7 +275,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool HasEntityComponent(int entityID, EcsMaskChunck maskBit) private bool HasEntityComponent(int entityID, EcsMaskChunck maskBit)
{ {
return (_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] & maskBit.mask) == maskBit.mask; return (_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] & maskBit.mask) == maskBit.mask;
} }
#endregion #endregion
@ -311,7 +311,7 @@ namespace DCFApixels.DragonECS
{ {
return World.TryUnregisterEntityComponent(entityID, componentTypeID, maskBit); return World.TryUnregisterEntityComponent(entityID, componentTypeID, maskBit);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetComponentCount(int componentTypeID) public int GetComponentCount(int componentTypeID)
{ {

View File

@ -118,7 +118,7 @@ namespace DCFApixels.DragonECS
if (_nodes.TryGetValue(type, out InjectionNodeBase oldNode)) if (_nodes.TryGetValue(type, out InjectionNodeBase oldNode))
{ {
Throw.Exception("Already declared"); Throw.Exception("Already declared");
} }
InitNode(injectionProperty); InitNode(injectionProperty);
#if !REFLECTION_DISABLED #if !REFLECTION_DISABLED
if (IsCanInstantiated(type)) if (IsCanInstantiated(type))

View File

@ -36,20 +36,20 @@ namespace DCFApixels.DragonECS
#endregion #endregion
} }
/// <summary>A pool for struct components.</summary> /// <summary>A pool for struct components.</summary>
public interface IEcsStructPool<T> : IEcsPool where T: struct public interface IEcsStructPool<T> : IEcsPool where T : struct
{ {
ref T Add(int entityID); ref T Add(int entityID);
ref readonly T Read(int entityID); ref readonly T Read(int entityID);
ref T Get(int entityID); ref T Get(int entityID);
} }
/// <summary>A pool for reference components of type T that instantiates components itself.</summary> /// <summary>A pool for reference components of type T that instantiates components itself.</summary>
public interface IEcsClassPool<T> : IEcsPool where T: class public interface IEcsClassPool<T> : IEcsPool where T : class
{ {
T Add(int entityID); T Add(int entityID);
T Get(int entityID); T Get(int entityID);
} }
/// <summary>A pool for reference components of type T, which does not instantiate components itself but receives components from external sources..</summary> /// <summary>A pool for reference components of type T, which does not instantiate components itself but receives components from external sources..</summary>
public interface IEcsHybridPool<T> : IEcsPool where T: class public interface IEcsHybridPool<T> : IEcsPool where T : class
{ {
void Add(int entityID, T component); void Add(int entityID, T component);
T Get(int entityID); T Get(int entityID);

View File

@ -1,4 +1,3 @@
using DCFApixels.DragonECS.Internal;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;