Browse Source

remove wrong warnings

clean up code
tags/2.7
sebas77 5 years ago
parent
commit
385e24cb73
11 changed files with 39 additions and 37 deletions
  1. +0
    -0
      Svelto.ECS/DBC.cs
  2. +1
    -5
      Svelto.ECS/DataStructures/TypeSafeDictionary.cs
  3. +1
    -0
      Svelto.ECS/EGID.cs
  4. +0
    -22
      Svelto.ECS/EnginesRoot.Entities.cs
  5. +4
    -7
      Svelto.ECS/EntityBuilder.CheckFields.cs
  6. +28
    -0
      Svelto.ECS/EntityStructInitializer.cs
  7. +2
    -1
      Svelto.ECS/ExclusiveGroups.cs
  8. +2
    -1
      Svelto.ECS/IEngine.cs
  9. +1
    -1
      Svelto.ECS/IEntityFactory.cs
  10. +0
    -0
      Svelto.ECS/Svelto.ECS.asmdef
  11. +0
    -0
      Svelto.ECS/Svelto.ECS.csproj

DBC.cs → Svelto.ECS/DBC.cs View File


+ 1
- 5
Svelto.ECS/DataStructures/TypeSafeDictionary.cs View File

@@ -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;
}
}

+ 1
- 0
Svelto.ECS/EGID.cs View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
#pragma warning disable 660,661

namespace Svelto.ECS
{


+ 0
- 22
Svelto.ECS/EnginesRoot.Entities.cs View File

@@ -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<Type, ITypeSafeDictionary> current)
{
_current = current;
_id = id;
}

public void Init<T>(T initializer) where T: struct, IEntityStruct
{
var typeSafeDictionary = (TypeSafeDictionary<T>) _current[typeof(T)];

initializer.ID = _id;

int count;
typeSafeDictionary.GetValuesArray(out count)[typeSafeDictionary.FindElementIndex(_id.entityID)] = initializer;
}

readonly Dictionary<Type, ITypeSafeDictionary> _current;
readonly EGID _id;
}
}

+ 4
- 7
Svelto.ECS/EntityBuilder.CheckFields.cs View File

@@ -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);


+ 28
- 0
Svelto.ECS/EntityStructInitializer.cs View File

@@ -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<Type, ITypeSafeDictionary> current)
{
_current = current;
_id = id;
}

public void Init<T>(T initializer) where T: struct, IEntityStruct
{
var typeSafeDictionary = (TypeSafeDictionary<T>) _current[typeof(T)];

initializer.ID = _id;

int count;
typeSafeDictionary.GetValuesArray(out count)[typeSafeDictionary.FindElementIndex(_id.entityID)] = initializer;
}

readonly Dictionary<Type, ITypeSafeDictionary> _current;
readonly EGID _id;
}
}

+ 2
- 1
Svelto.ECS/ExclusiveGroups.cs View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
#pragma warning disable 660,661

namespace Svelto.ECS
{
/// <summary>


+ 2
- 1
Svelto.ECS/IEngine.cs View File

@@ -16,8 +16,9 @@ namespace Svelto.ECS.Internal
{
name = GetType().FullName;
}
#endif
#else
internal string name;
#endif
}
}



+ 1
- 1
Svelto.ECS/IEntityFactory.cs View File

@@ -39,7 +39,7 @@ namespace Svelto.ECS
/// <param name="groupStructId"></param>
/// <param name="ed"></param>
/// <param name="implementors"></param>
EntityStructInitializer BuildEntity<T>(int entityID, ExclusiveGroup.ExclusiveGroupStruct groupStructId,
EntityStructInitializer BuildEntity<T>(int entityID, ExclusiveGroup.ExclusiveGroupStruct groupStructId,
object[] implementors = null)
where T : IEntityDescriptor, new();
EntityStructInitializer BuildEntity<T>(EGID egid, object[] implementors = null)


Svelto.ECS.asmdef → Svelto.ECS/Svelto.ECS.asmdef View File


Svelto.ECS.csproj → Svelto.ECS/Svelto.ECS.csproj View File


Loading…
Cancel
Save