Browse Source

clean up code

tags/2.8
sebas77 5 years ago
parent
commit
0468add53d
5 changed files with 10 additions and 21 deletions
  1. +4
    -4
      Svelto.ECS/DynamicEntityDescriptor.cs
  2. +0
    -1
      Svelto.ECS/EntityBuilder.cs
  3. +1
    -11
      Svelto.ECS/EntityDescriptorInfo.cs
  4. +3
    -3
      Svelto.ECS/ExtendibleEntityDescriptor.cs
  5. +2
    -2
      Svelto.ECS/StaticEntityDescriptorInfo.cs

Svelto.ECS/DynamicEntityDescriptorInfo.cs → Svelto.ECS/DynamicEntityDescriptor.cs View File

@@ -2,9 +2,9 @@ using System;

namespace Svelto.ECS
{
public struct DynamicEntityDescriptorInfo<TType>:IEntityDescriptor where TType : IEntityDescriptor, new()
public struct DynamicEntityDescriptor<TType>:IEntityDescriptor where TType : IEntityDescriptor, new()
{
public DynamicEntityDescriptorInfo(IEntityBuilder[] extraEntities)
public DynamicEntityDescriptor(IEntityBuilder[] extraEntities)
{
DBC.ECS.Check.Require(extraEntities.Length > 0,
"don't use a DynamicEntityDescriptorInfo if you don't need to use extra EntityViews");
@@ -17,7 +17,7 @@ namespace Svelto.ECS
Array.Copy(defaultEntities, 0, entitiesToBuild, 0, length);
Array.Copy(extraEntities, 0, entitiesToBuild, length, extraEntities.Length);

var _builder = new EntityBuilder<EntityStructInfoView>
var builder = new EntityBuilder<EntityStructInfoView>
{
_initializer = new EntityStructInfoView
{
@@ -25,7 +25,7 @@ namespace Svelto.ECS
type = typeof(TType)
}
};
entitiesToBuild[entitiesToBuild.Length - 1] = _builder;
entitiesToBuild[entitiesToBuild.Length - 1] = builder;
}

public IEntityBuilder[] entitiesToBuild { get; }

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

@@ -78,7 +78,6 @@ namespace Svelto.ECS

internal static readonly Type ENTITY_VIEW_TYPE = typeof(T);
static readonly T DEFAULT_IT = default;
static readonly Type ENTITYINFOVIEW_TYPE = typeof(EntityStructInfoView);
static readonly bool NEEDS_REFLECTION = typeof(IEntityViewStruct).IsAssignableFrom(typeof(T));
static readonly string ENTITY_VIEW_NAME = ENTITY_VIEW_TYPE.ToString();
internal static readonly bool HAS_EGID = typeof(INeedEGID).IsAssignableFrom(ENTITY_VIEW_TYPE);


+ 1
- 11
Svelto.ECS/EntityDescriptorInfo.cs View File

@@ -5,19 +5,9 @@ namespace Svelto.ECS
IEntityBuilder[] entitiesToBuild { get; }
}

public class EntityDescriptor : IEntityDescriptor
{
protected EntityDescriptor(IEntityBuilder[] entityToBuild)
{
entitiesToBuild = entityToBuild;
}
public IEntityBuilder[] entitiesToBuild { get; }
}

static class EntityDescriptorTemplate<TType> where TType : IEntityDescriptor, new()
{
public static readonly StaticEntityDescriptorInfo<TType> descriptor
internal static readonly StaticEntityDescriptorInfo<TType> descriptor
= new StaticEntityDescriptorInfo<TType>(new TType());
}
}

+ 3
- 3
Svelto.ECS/ExtendibleEntityDescriptor.cs View File

@@ -1,14 +1,14 @@
namespace Svelto.ECS
{
public class ExtendibleEntityDescriptor<TType>:IEntityDescriptor where TType : IEntityDescriptor, new()
public abstract class ExtendibleEntityDescriptor<TType>:IEntityDescriptor where TType : IEntityDescriptor, new()
{
protected ExtendibleEntityDescriptor(IEntityBuilder[] extraEntities)
{
_dynamicDescriptor = new DynamicEntityDescriptorInfo<TType>(extraEntities);
_dynamicDescriptor = new DynamicEntityDescriptor<TType>(extraEntities);
}

public IEntityBuilder[] entitiesToBuild { get { return _dynamicDescriptor.entitiesToBuild; } }

readonly DynamicEntityDescriptorInfo<TType> _dynamicDescriptor;
readonly DynamicEntityDescriptor<TType> _dynamicDescriptor;
}
}

+ 2
- 2
Svelto.ECS/StaticEntityDescriptorInfo.cs View File

@@ -1,13 +1,13 @@
namespace Svelto.ECS
{
public class StaticEntityDescriptorInfo<TType>: IEntityDescriptor where TType : IEntityDescriptor
class StaticEntityDescriptorInfo<TType>: IEntityDescriptor where TType : IEntityDescriptor
{
internal StaticEntityDescriptorInfo(TType descriptor)
{
entitiesToBuild = descriptor.entitiesToBuild;
}

public IEntityBuilder[] entitiesToBuild { get; private set; }
public IEntityBuilder[] entitiesToBuild { get; }
}
}


Loading…
Cancel
Save