diff --git a/DBC.cs b/Svelto.ECS/DBC.cs similarity index 100% rename from DBC.cs rename to Svelto.ECS/DBC.cs diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs index c835592..b607563 100644 --- a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs +++ b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs @@ -209,10 +209,6 @@ namespace Svelto.ECS.Internal } static readonly Type _type = typeof(TValue); - static readonly string _typeName -#if ENABLE_PLATFORM_PROFILER - = _type.Name -#endif - ; + static readonly string _typeName = _type.Name; } } \ No newline at end of file diff --git a/Svelto.ECS/EGID.cs b/Svelto.ECS/EGID.cs index cda04eb..0930987 100644 --- a/Svelto.ECS/EGID.cs +++ b/Svelto.ECS/EGID.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +#pragma warning disable 660,661 namespace Svelto.ECS { diff --git a/Svelto.ECS/EnginesRoot.Entities.cs b/Svelto.ECS/EnginesRoot.Entities.cs index a0169a3..e71710c 100644 --- a/Svelto.ECS/EnginesRoot.Entities.cs +++ b/Svelto.ECS/EnginesRoot.Entities.cs @@ -260,26 +260,4 @@ namespace Svelto.ECS "same ID in the same group! The operation will continue using" + "the base descriptor only "; } - - public struct EntityStructInitializer - { - public EntityStructInitializer(EGID id, Dictionary current) - { - _current = current; - _id = id; - } - - public void Init(T initializer) where T: struct, IEntityStruct - { - var typeSafeDictionary = (TypeSafeDictionary) _current[typeof(T)]; - - initializer.ID = _id; - - int count; - typeSafeDictionary.GetValuesArray(out count)[typeSafeDictionary.FindElementIndex(_id.entityID)] = initializer; - } - - readonly Dictionary _current; - readonly EGID _id; - } } \ No newline at end of file diff --git a/Svelto.ECS/EntityBuilder.CheckFields.cs b/Svelto.ECS/EntityBuilder.CheckFields.cs index ce25f86..093671a 100644 --- a/Svelto.ECS/EntityBuilder.CheckFields.cs +++ b/Svelto.ECS/EntityBuilder.CheckFields.cs @@ -15,9 +15,7 @@ namespace Svelto.ECS #endif static void CheckFields(Type type, bool needsReflection, bool isRoot) { - if (ENTITY_VIEW_TYPE == typeof(EntityInfoView)) return; - - if (type == EGIDType || type == ExclusiveGroupStructType) return; + if (ENTITY_VIEW_TYPE == typeof(EntityInfoView) || type == EGIDType || type == ExclusiveGroupStructType) return; { var methods = type.GetMethods(BindingFlags.Public | @@ -29,10 +27,10 @@ namespace Svelto.ECS if (isRoot) { if (properties.Length > 1) - ProcessError("EntityViews cannot have public methods or properties", type); + ProcessError("Entity views cannot have public methods or properties", type); if (methods.Length > properties.Length + 1) - ProcessError("EntityViews cannot have public methods or properties", type); + ProcessError("Entity views cannot have public methods or properties", type); } else { @@ -47,7 +45,7 @@ namespace Svelto.ECS if (needsReflection == false) { if (type.IsClass) - throw new ECSException("IEntityStructs must be structs - EntityView: ".FastConcat(ENTITY_VIEW_TYPE)); + throw new ECSException("EntityStructs must be structs - entity view: ".FastConcat(ENTITY_VIEW_TYPE)); var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance); @@ -116,7 +114,6 @@ namespace Svelto.ECS " invalid field: ", type.ToString())); #endif } - static readonly Type EGIDType = typeof(EGID); static readonly Type ExclusiveGroupStructType = typeof(ExclusiveGroup.ExclusiveGroupStruct); diff --git a/Svelto.ECS/EntityStructInitializer.cs b/Svelto.ECS/EntityStructInitializer.cs new file mode 100644 index 0000000..318759c --- /dev/null +++ b/Svelto.ECS/EntityStructInitializer.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using Svelto.ECS.Internal; + +namespace Svelto.ECS +{ + public struct EntityStructInitializer + { + public EntityStructInitializer(EGID id, Dictionary current) + { + _current = current; + _id = id; + } + + public void Init(T initializer) where T: struct, IEntityStruct + { + var typeSafeDictionary = (TypeSafeDictionary) _current[typeof(T)]; + + initializer.ID = _id; + + int count; + typeSafeDictionary.GetValuesArray(out count)[typeSafeDictionary.FindElementIndex(_id.entityID)] = initializer; + } + + readonly Dictionary _current; + readonly EGID _id; + } +} \ No newline at end of file diff --git a/Svelto.ECS/ExclusiveGroups.cs b/Svelto.ECS/ExclusiveGroups.cs index 7dd092d..d8ac704 100644 --- a/Svelto.ECS/ExclusiveGroups.cs +++ b/Svelto.ECS/ExclusiveGroups.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; - +#pragma warning disable 660,661 + namespace Svelto.ECS { /// diff --git a/Svelto.ECS/IEngine.cs b/Svelto.ECS/IEngine.cs index a2e8c1e..f8d8706 100644 --- a/Svelto.ECS/IEngine.cs +++ b/Svelto.ECS/IEngine.cs @@ -16,8 +16,9 @@ namespace Svelto.ECS.Internal { name = GetType().FullName; } -#endif +#else internal string name; +#endif } } diff --git a/Svelto.ECS/IEntityFactory.cs b/Svelto.ECS/IEntityFactory.cs index 8ef811a..7e24b6b 100644 --- a/Svelto.ECS/IEntityFactory.cs +++ b/Svelto.ECS/IEntityFactory.cs @@ -39,7 +39,7 @@ namespace Svelto.ECS /// /// /// - EntityStructInitializer BuildEntity(int entityID, ExclusiveGroup.ExclusiveGroupStruct groupStructId, + EntityStructInitializer BuildEntity(int entityID, ExclusiveGroup.ExclusiveGroupStruct groupStructId, object[] implementors = null) where T : IEntityDescriptor, new(); EntityStructInitializer BuildEntity(EGID egid, object[] implementors = null) diff --git a/Svelto.ECS.asmdef b/Svelto.ECS/Svelto.ECS.asmdef similarity index 100% rename from Svelto.ECS.asmdef rename to Svelto.ECS/Svelto.ECS.asmdef diff --git a/Svelto.ECS.csproj b/Svelto.ECS/Svelto.ECS.csproj similarity index 100% rename from Svelto.ECS.csproj rename to Svelto.ECS/Svelto.ECS.csproj