Sfoglia il codice sorgente

UPM package version 3.1.0

tags/3.1.0
GitHub 3 anni fa
parent
commit
258679388c
100 ha cambiato i file con 496 aggiunte e 282 eliminazioni
  1. +21
    -0
      CHANGELOG.md
  2. +7
    -0
      CHANGELOG.md.meta
  3. +8
    -0
      Core.meta
  4. +0
    -0
      Core/AllowMultipleAttribute.cs
  5. +1
    -1
      Core/AllowMultipleAttribute.cs.meta
  6. +1
    -2
      Core/CheckEntityUtilities.cs
  7. +1
    -1
      Core/CheckEntityUtilities.cs.meta
  8. +0
    -0
      Core/ComponentBuilder.CheckFields.cs
  9. +1
    -1
      Core/ComponentBuilder.CheckFields.cs.meta
  10. +0
    -0
      Core/ComponentBuilder.cs
  11. +1
    -1
      Core/ComponentBuilder.cs.meta
  12. +0
    -0
      Core/DBC.cs
  13. +1
    -1
      Core/DBC.cs.meta
  14. +0
    -0
      Core/ECSException.cs
  15. +1
    -1
      Core/ECSException.cs.meta
  16. +1
    -1
      Core/EGID.cs
  17. +1
    -1
      Core/EGID.cs.meta
  18. +0
    -1
      Core/EGIDMapper.cs
  19. +1
    -1
      Core/EGIDMapper.cs.meta
  20. +8
    -0
      Core/EnginesGroup.meta
  21. +25
    -0
      Core/EnginesGroup/IStepEngine.cs
  22. +11
    -0
      Core/EnginesGroup/IStepEngine.cs.meta
  23. +3
    -25
      Core/EnginesGroup/SortedEnginesGroup.cs
  24. +1
    -1
      Core/EnginesGroup/SortedEnginesGroup.cs.meta
  25. +28
    -0
      Core/EnginesGroup/UnsortedEnginesGroup.cs
  26. +1
    -1
      Core/EnginesGroup/UnsortedEnginesGroup.cs.meta
  27. +1
    -2
      Core/EnginesRoot.DoubleBufferedEntitiesToAdd.cs
  28. +1
    -1
      Core/EnginesRoot.DoubleBufferedEntitiesToAdd.cs.meta
  29. +57
    -49
      Core/EnginesRoot.Engines.cs
  30. +1
    -1
      Core/EnginesRoot.Engines.cs.meta
  31. +3
    -4
      Core/EnginesRoot.Entities.cs
  32. +1
    -1
      Core/EnginesRoot.Entities.cs.meta
  33. +9
    -9
      Core/EnginesRoot.GenericEntityFactory.cs
  34. +1
    -1
      Core/EnginesRoot.GenericEntityFactory.cs.meta
  35. +14
    -15
      Core/EnginesRoot.GenericEntityFunctions.cs
  36. +1
    -1
      Core/EnginesRoot.GenericEntityFunctions.cs.meta
  37. +73
    -56
      Core/EnginesRoot.Submission.cs
  38. +1
    -1
      Core/EnginesRoot.Submission.cs.meta
  39. +0
    -0
      Core/EntitiesDB.FindGroups.cs
  40. +1
    -1
      Core/EntitiesDB.FindGroups.cs.meta
  41. +0
    -0
      Core/EntitiesDB.cs
  42. +1
    -1
      Core/EntitiesDB.cs.meta
  43. +28
    -26
      Core/EntityCollection.cs
  44. +1
    -1
      Core/EntityCollection.cs.meta
  45. +8
    -0
      Core/EntityDescriptor.meta
  46. +0
    -0
      Core/EntityDescriptor/DynamicEntityDescriptor.cs
  47. +1
    -1
      Core/EntityDescriptor/DynamicEntityDescriptor.cs.meta
  48. +13
    -0
      Core/EntityDescriptor/ExtendibleEntityDescriptor.cs
  49. +1
    -1
      Core/EntityDescriptor/ExtendibleEntityDescriptor.cs.meta
  50. +0
    -0
      Core/EntityDescriptor/GenericEntityDescriptor.cs
  51. +1
    -1
      Core/EntityDescriptor/GenericEntityDescriptor.cs.meta
  52. +6
    -0
      Core/EntityDescriptor/IDynamicEntityDescriptor.cs
  53. +11
    -0
      Core/EntityDescriptor/IDynamicEntityDescriptor.cs.meta
  54. +7
    -0
      Core/EntityDescriptor/IEntityDescriptor.cs
  55. +11
    -0
      Core/EntityDescriptor/IEntityDescriptor.cs.meta
  56. +0
    -9
      Core/EntityDescriptorTemplate.cs
  57. +1
    -1
      Core/EntityDescriptorTemplate.cs.meta
  58. +0
    -0
      Core/EntityFactory.cs
  59. +1
    -1
      Core/EntityFactory.cs.meta
  60. +0
    -0
      Core/EntityGroupNotFoundException.cs
  61. +1
    -1
      Core/EntityGroupNotFoundException.cs.meta
  62. +0
    -0
      Core/EntityInfoView.cs
  63. +1
    -1
      Core/EntityInfoView.cs.meta
  64. +3
    -4
      Core/EntityInitializer.cs
  65. +11
    -0
      Core/EntityInitializer.cs.meta
  66. +0
    -0
      Core/EntityNotFoundException.cs
  67. +1
    -1
      Core/EntityNotFoundException.cs.meta
  68. +16
    -0
      Core/EntitySubmissionScheduler.cs
  69. +1
    -1
      Core/EntitySubmissionScheduler.cs.meta
  70. +0
    -0
      Core/EntitySubmitOperation.cs
  71. +1
    -1
      Core/EntitySubmitOperation.cs.meta
  72. +0
    -0
      Core/EntityViewUtility.cs
  73. +1
    -1
      Core/EntityViewUtility.cs.meta
  74. +1
    -1
      Core/Filters.meta
  75. +1
    -2
      Core/Filters/EntitiesDB.GroupFilters.cs
  76. +1
    -1
      Core/Filters/EntitiesDB.GroupFilters.cs.meta
  77. +0
    -0
      Core/Filters/FilterGroup.cs
  78. +1
    -1
      Core/Filters/FilterGroup.cs.meta
  79. +15
    -1
      Core/Filters/FilteredIndices.cs
  80. +1
    -1
      Core/Filters/FilteredIndices.cs.meta
  81. +1
    -1
      Core/Filters/GroupFilters.cs
  82. +1
    -1
      Core/Filters/GroupFilters.cs.meta
  83. +2
    -2
      Core/GlobalTypeID.cs
  84. +1
    -1
      Core/GlobalTypeID.cs.meta
  85. +8
    -0
      Core/Groups.meta
  86. +27
    -0
      Core/Groups/ExclusiveBuildGroup.cs
  87. +11
    -0
      Core/Groups/ExclusiveBuildGroup.cs.meta
  88. +0
    -1
      Core/Groups/ExclusiveGroup.cs
  89. +1
    -1
      Core/Groups/ExclusiveGroup.cs.meta
  90. +0
    -25
      Core/Groups/ExclusiveGroupStruct.cs
  91. +1
    -1
      Core/Groups/ExclusiveGroupStruct.cs.meta
  92. +4
    -4
      Core/Groups/GroupCompound.cs
  93. +1
    -1
      Core/Groups/GroupCompound.cs.meta
  94. +0
    -0
      Core/Groups/NamedExclusiveGroup.cs
  95. +1
    -1
      Core/Groups/NamedExclusiveGroup.cs.meta
  96. +1
    -1
      Core/Hybrid.meta
  97. +0
    -0
      Core/Hybrid/IEntityDescriptorHolder.cs
  98. +1
    -1
      Core/Hybrid/IEntityDescriptorHolder.cs.meta
  99. +0
    -0
      Core/Hybrid/IEntityViewComponent.cs
  100. +1
    -1
      Core/Hybrid/IEntityViewComponent.cs.meta

+ 21
- 0
CHANGELOG.md Vedi File

@@ -0,0 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file. I created this file with Svelto.ECS version 3.1.

## [0.3.1]

### Changed

* rearrange folders structures for clarity
* added DoubleEntitiesEnumerator, as seen in MiniExample 4, to allow a double iteration of the same group skipping already checked tuples
* reengineered the behaviour of WaitForSubmissionEnumerator
* removed redudant ISimpleEntitySubmissionScheduler interface
* renamed BuildGroup in to ExclusiveBuildGroup
* renamed EntityComponentInitializer to EntityInitializer
* Entity Submission now can optionally be time slices (based on number of entities to submit per slice)
* working on the Unity extension Submission Engine, still wip
* added the possibility to hold a reference in a EntityViewComponent. This reference cannot be accesses as an object, but can be converted to the original object in OOP abstract layers
* renamed NativeEntityComponentInitializer to NativeEntityInitializer
*

### Fixed


+ 7
- 0
CHANGELOG.md.meta Vedi File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 46f11aabb9f33c4c883a62268c9d8e75
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Core.meta Vedi File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 780543feb41c3e379f62a1cb4012dd73
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

AllowMultipleAttribute.cs → Core/AllowMultipleAttribute.cs Vedi File


AllowMultipleAttribute.cs.meta → Core/AllowMultipleAttribute.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3c9bebf03e59386d84e0a930eccf48fc
guid: 6fb69554705d3885b0bd4cf46e72fa95
MonoImporter:
externalObjects: {}
serializedVersion: 2

CheckEntityUtilities.cs → Core/CheckEntityUtilities.cs Vedi File

@@ -3,7 +3,6 @@
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Svelto.DataStructures;

namespace Svelto.ECS
@@ -72,7 +71,7 @@ namespace Svelto.ECS
#if DONT_USE
[Conditional("CHECK_ALL")]
#endif
void RemoveGroupID(BuildGroup groupID) { _idChecker.Remove(groupID); }
void RemoveGroupID(ExclusiveBuildGroup groupID) { _idChecker.Remove(groupID); }

#if DONT_USE
[Conditional("CHECK_ALL")]

CheckEntityUtilities.cs.meta → Core/CheckEntityUtilities.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1f68096cd077321494ba5dd6f816076c
guid: 2b103bee96523b9da1a57a2e6c2ddb27
MonoImporter:
externalObjects: {}
serializedVersion: 2

ComponentBuilder.CheckFields.cs → Core/ComponentBuilder.CheckFields.cs Vedi File


ComponentBuilder.CheckFields.cs.meta → Core/ComponentBuilder.CheckFields.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b8801fb2bdee37a6aa48c7ab61badd55
guid: dd4e9c0e74f3396fad9d053821b3a920
MonoImporter:
externalObjects: {}
serializedVersion: 2

ComponentBuilder.cs → Core/ComponentBuilder.cs Vedi File


ComponentBuilder.cs.meta → Core/ComponentBuilder.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cf16c7aee929396a99cb63c9d8242a91
guid: 5a37611df353344e9e4d8f5b09f3e122
MonoImporter:
externalObjects: {}
serializedVersion: 2

DBC.cs → Core/DBC.cs Vedi File


DBC.cs.meta → Core/DBC.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3b94ce79abd33ebdb58b4feb589e2ec2
guid: edf26e91bb743648b20976997c28cdc9
MonoImporter:
externalObjects: {}
serializedVersion: 2

ECSException.cs → Core/ECSException.cs Vedi File


ECSException.cs.meta → Core/ECSException.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ebf9ad21334336bd87fc11d4ce9edfb2
guid: 84772ff612c9344a8a46c1ad75879a2f
MonoImporter:
externalObjects: {}
serializedVersion: 2

EGID.cs → Core/EGID.cs Vedi File

@@ -31,7 +31,7 @@ namespace Svelto.ECS
_GID = MAKE_GLOBAL_ID(entityID, groupID);
}
public EGID(uint entityID, BuildGroup groupID) : this()
public EGID(uint entityID, ExclusiveBuildGroup groupID) : this()
{
_GID = MAKE_GLOBAL_ID(entityID, groupID.group);
}

EGID.cs.meta → Core/EGID.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b45ce870121e36ff9e022e665152b753
guid: e887cc489753338cafc98950283c76d5
MonoImporter:
externalObjects: {}
serializedVersion: 2

EGIDMapper.cs → Core/EGIDMapper.cs Vedi File

@@ -1,7 +1,6 @@
using System;
using System.Runtime.CompilerServices;
using Svelto.Common;
using Svelto.DataStructures;
using Svelto.ECS.Internal;

namespace Svelto.ECS

EGIDMapper.cs.meta → Core/EGIDMapper.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f2ad50acf4bd3aff9debb59333681ac8
guid: 501b2e2d9db632fe9547410a9d30e49b
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 8
- 0
Core/EnginesGroup.meta Vedi File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 283bf9c0ee343a8da006c6f651b6b41a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 25
- 0
Core/EnginesGroup/IStepEngine.cs Vedi File

@@ -0,0 +1,25 @@
namespace Svelto.ECS
{
public interface IStepEngine : IEngine
{
void Step();
string name { get; }
}
public interface IStepEngine<T> : IEngine
{
void Step(in T _param);
string name { get; }
}
//this must stay IStep Engine as it may be part of a group itself
public interface IStepGroupEngine : IStepEngine
{
}
public interface IStepGroupEngine<T> : IStepEngine<T>
{
}
}

+ 11
- 0
Core/EnginesGroup/IStepEngine.cs.meta Vedi File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee2c4f1f4c543668b06899b70adbdd89
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

SortedEnginesGroup.cs → Core/EnginesGroup/SortedEnginesGroup.cs Vedi File

@@ -3,28 +3,6 @@ using Svelto.Common;

namespace Svelto.ECS
{
public interface IStepEngine : IEngine
{
void Step();
string name { get; }
}
public interface IStepEngine<T> : IEngine
{
void Step(ref T _param);
string name { get; }
}
public interface IStepGroupEngine : IStepEngine
{
}
public interface IStepGroupEngine<T> : IStepEngine<T>
{
}

public abstract class SortedEnginesGroup<Interface, SequenceOrder> : IStepGroupEngine
where SequenceOrder : struct, ISequenceOrder where Interface : IStepEngine
{
@@ -47,7 +25,7 @@ namespace Svelto.ECS
}
}

public string name => _name;
public string name => _name;
readonly string _name;
readonly Sequence<Interface, SequenceOrder> _instancedSequence;
@@ -62,7 +40,7 @@ namespace Svelto.ECS
_instancedSequence = new Sequence<Interface, SequenceOrder>(engines);
}

public void Step(ref Parameter param)
public void Step(in Parameter param)
{
var sequenceItems = _instancedSequence.items;
using (var profiler = new PlatformProfiler(_name))
@@ -70,7 +48,7 @@ namespace Svelto.ECS
for (var index = 0; index < sequenceItems.count; index++)
{
var engine = sequenceItems[index];
using (profiler.Sample(engine.name)) engine.Step(ref param);
using (profiler.Sample(engine.name)) engine.Step(param);
}
}
}

SortedEnginesGroup.cs.meta → Core/EnginesGroup/SortedEnginesGroup.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 690435cd81303cf593cf1c5bdf96e70f
guid: 07174f15395d3c0dba8a34b0d485bc22
MonoImporter:
externalObjects: {}
serializedVersion: 2

UnsortedEnginesGroup.cs → Core/EnginesGroup/UnsortedEnginesGroup.cs Vedi File

@@ -30,4 +30,32 @@ namespace Svelto.ECS
readonly string _name;
readonly FasterList<Interface> _instancedSequence;
}
public abstract class UnsortedEnginesGroup<Interface, Parameter> : IStepGroupEngine<Parameter>
where Interface : IStepEngine<Parameter>
{
protected UnsortedEnginesGroup(FasterList<Interface> engines)
{
_name = "UnsortedEnginesGroup - "+this.GetType().Name;
_instancedSequence = engines;
}

public void Step(in Parameter param)
{
var sequenceItems = _instancedSequence;
using (var profiler = new PlatformProfiler(_name))
{
for (var index = 0; index < sequenceItems.count; index++)
{
var engine = sequenceItems[index];
using (profiler.Sample(engine.name)) engine.Step(param);
}
}
}

public string name => _name;
readonly string _name;
readonly FasterList<Interface> _instancedSequence;
}
}

UnsortedEnginesGroup.cs.meta → Core/EnginesGroup/UnsortedEnginesGroup.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 885e43f2997833bcacd6681fd4744a33
guid: e211b8eca6013fbe96e90e4eeb954a58
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.DoubleBufferedEntitiesToAdd.cs → Core/EnginesRoot.DoubleBufferedEntitiesToAdd.cs Vedi File

@@ -1,5 +1,4 @@
using System;
using Svelto.DataStructures;
using Svelto.DataStructures;
using Svelto.ECS.Internal;

namespace Svelto.ECS

EnginesRoot.DoubleBufferedEntitiesToAdd.cs.meta → Core/EnginesRoot.DoubleBufferedEntitiesToAdd.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5bf312fc57853c4d8368dcb99141a1e9
guid: 36851f224e1339e489644c58b97044d9
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.Engines.cs → Core/EnginesRoot.Engines.cs Vedi File

@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Svelto.Common;
using Svelto.DataStructures;
@@ -9,26 +10,38 @@ namespace Svelto.ECS
{
public sealed partial class EnginesRoot
{
public readonly struct EntitiesSubmitter
public struct EntitiesSubmitter
{
public EntitiesSubmitter(EnginesRoot enginesRoot)
public EntitiesSubmitter(EnginesRoot enginesRoot) : this()
{
_weakReference = new Svelto.DataStructures.WeakReference<EnginesRoot>(enginesRoot);
}

public bool IsUnused => _weakReference.IsValid == false;

public void Invoke()
public IEnumerator Invoke(uint maxNumberOfOperationsPerFrame)
{
if (_weakReference.IsValid)
_weakReference.Target.SubmitEntityComponents();
var entitiesSubmissionScheduler = _weakReference.Target._scheduler;
if (_weakReference.IsValid && entitiesSubmissionScheduler.paused == false)
{
var submitEntityComponents =
_weakReference.Target.SubmitEntityComponents(maxNumberOfOperationsPerFrame);
DBC.ECS.Check.Require(entitiesSubmissionScheduler.isRunning == false
, "A submission started while the previous one was still flushing");
entitiesSubmissionScheduler.isRunning = true;
while (submitEntityComponents.MoveNext() == true)
yield return null;

entitiesSubmissionScheduler.isRunning = false;
++entitiesSubmissionScheduler.iteration;
}
}

readonly Svelto.DataStructures.WeakReference<EnginesRoot> _weakReference;
}

readonly EntitiesSubmissionScheduler _scheduler;
public IEntitiesSubmissionScheduler scheduler => _scheduler;
readonly EntitiesSubmissionScheduler _scheduler;
public EntitiesSubmissionScheduler scheduler => _scheduler;

/// <summary>
/// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot
@@ -40,15 +53,16 @@ namespace Svelto.ECS
/// </summary>
public EnginesRoot(EntitiesSubmissionScheduler entitiesComponentScheduler)
{
_entitiesOperations = new ThreadSafeDictionary<ulong, EntitySubmitOperation>();
serializationDescriptorMap = new SerializationDescriptorMap();
_reactiveEnginesAddRemove = new FasterDictionary<RefWrapperType, FasterList<IReactEngine>>();
_reactiveEnginesSwap = new FasterDictionary<RefWrapperType, FasterList<IReactEngine>>();
_reactiveEnginesSubmission = new FasterList<IReactOnSubmission>();
_enginesSet = new FasterList<IEngine>();
_enginesTypeSet = new HashSet<Type>();
_disposableEngines = new FasterList<IDisposable>();
_transientEntitiesOperations = new FasterList<EntitySubmitOperation>();
_entitiesOperations = new FasterDictionary<ulong, EntitySubmitOperation>();
serializationDescriptorMap = new SerializationDescriptorMap();
_reactiveEnginesAddRemove = new FasterDictionary<RefWrapperType, FasterList<IReactEngine>>();
_reactiveEnginesAddRemoveOnDispose = new FasterDictionary<RefWrapperType, FasterList<IReactEngine>>();
_reactiveEnginesSwap = new FasterDictionary<RefWrapperType, FasterList<IReactEngine>>();
_reactiveEnginesSubmission = new FasterList<IReactOnSubmission>();
_enginesSet = new FasterList<IEngine>();
_enginesTypeSet = new HashSet<Type>();
_disposableEngines = new FasterList<IDisposable>();
_transientEntitiesOperations = new FasterList<EntitySubmitOperation>();

_groupEntityComponentsDB =
new FasterDictionary<ExclusiveGroupStruct, FasterDictionary<RefWrapperType, ITypeSafeDictionary>>();
@@ -104,15 +118,13 @@ namespace Svelto.ECS
}
}

foreach (FasterDictionary<ExclusiveGroupStruct, FasterDictionary<RefWrapperType, ITypeSafeDictionary>>.
KeyValuePairFast groups in _groupEntityComponentsDB)
foreach (var groups in _groupEntityComponentsDB)
{
foreach (FasterDictionary<RefWrapperType, ITypeSafeDictionary>.KeyValuePairFast entityList in groups
.Value)
foreach (var entityList in groups.Value)
try
{
entityList.Value.ExecuteEnginesRemoveCallbacks(_reactiveEnginesAddRemove, profiler
, new ExclusiveGroupStruct(groups.Key));
entityList.Value.ExecuteEnginesRemoveCallbacks(_reactiveEnginesAddRemoveOnDispose, profiler
, new ExclusiveGroupStruct(groups.Key));
}
catch (Exception e)
{
@@ -120,18 +132,15 @@ namespace Svelto.ECS
}
}

foreach (FasterDictionary<ExclusiveGroupStruct, FasterDictionary<RefWrapperType, ITypeSafeDictionary>>.
KeyValuePairFast groups in _groupEntityComponentsDB)
foreach (var groups in _groupEntityComponentsDB)
{
foreach (FasterDictionary<RefWrapperType, ITypeSafeDictionary>.KeyValuePairFast entityList in groups
.Value)
foreach (var entityList in groups.Value)
entityList.Value.Dispose();
}

foreach (FasterDictionary<RefWrapperType, FasterDictionary<ExclusiveGroupStruct, GroupFilters>>.
KeyValuePairFast type in _groupFilters)
foreach (FasterDictionary<ExclusiveGroupStruct, GroupFilters>.KeyValuePairFast group in type.Value)
group.Value.Dispose();
foreach (var type in _groupFilters)
foreach (var group in type.Value)
group.Value.Dispose();

_groupFilters.Clear();

@@ -148,6 +157,7 @@ namespace Svelto.ECS
_enginesTypeSet.Clear();
_reactiveEnginesSwap.Clear();
_reactiveEnginesAddRemove.Clear();
_reactiveEnginesAddRemoveOnDispose.Clear();
_reactiveEnginesSubmission.Clear();

_entitiesOperations.Clear();
@@ -183,6 +193,9 @@ namespace Svelto.ECS
if (engine is IReactOnAddAndRemove viewEngine)
CheckReactEngineComponents(viewEngine, _reactiveEnginesAddRemove);

if (engine is IReactOnDispose viewEngineDispose)
CheckReactEngineComponents(viewEngineDispose, _reactiveEnginesAddRemoveOnDispose);

if (engine is IReactOnSwap viewEngineSwap)
CheckReactEngineComponents(viewEngineSwap, _reactiveEnginesSwap);

@@ -219,12 +232,12 @@ namespace Svelto.ECS
{
var genericArguments = interf.GetGenericArgumentsEx();

AddEngine(engine, genericArguments, engines);
AddEngineToList(engine, genericArguments, engines);
}
}
}

static void AddEngine<T>
static void AddEngineToList<T>
(T engine, Type[] entityComponentTypes, FasterDictionary<RefWrapperType, FasterList<IReactEngine>> engines)
where T : class, IReactEngine
{
@@ -232,29 +245,24 @@ namespace Svelto.ECS
{
var type = entityComponentTypes[i];

AddEngine(engine, engines, type);
}
}
if (engines.TryGetValue(new RefWrapperType(type), out var list) == false)
{
list = new FasterList<IReactEngine>();

static void AddEngine<T>(T engine, FasterDictionary<RefWrapperType, FasterList<IReactEngine>> engines, Type type)
where T : class, IReactEngine
{
if (engines.TryGetValue(new RefWrapperType(type), out var list) == false)
{
list = new FasterList<IReactEngine>();
engines.Add(new RefWrapperType(type), list);
}

engines.Add(new RefWrapperType(type), list);
list.Add(engine);
}

list.Add(engine);
}

readonly FasterDictionary<RefWrapperType, FasterList<IReactEngine>> _reactiveEnginesAddRemove;
readonly FasterDictionary<RefWrapperType, FasterList<IReactEngine>> _reactiveEnginesAddRemoveOnDispose;
readonly FasterDictionary<RefWrapperType, FasterList<IReactEngine>> _reactiveEnginesSwap;
readonly FasterList<IReactOnSubmission> _reactiveEnginesSubmission;
readonly FasterList<IDisposable> _disposableEngines;
readonly FasterList<IEngine> _enginesSet;
readonly HashSet<Type> _enginesTypeSet;
internal bool _isDisposing;
readonly FasterList<IReactOnSubmission> _reactiveEnginesSubmission;
readonly FasterList<IDisposable> _disposableEngines;
readonly FasterList<IEngine> _enginesSet;
readonly HashSet<Type> _enginesTypeSet;
internal bool _isDisposing;
}
}

EnginesRoot.Engines.cs.meta → Core/EnginesRoot.Engines.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 06751374e9a5391080488d0150900530
guid: 9e95fbe15f7d39cd8587f07094ece7b2
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.Entities.cs → Core/EnginesRoot.Entities.cs Vedi File

@@ -29,7 +29,7 @@ namespace Svelto.ECS

///--------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)]
EntityComponentInitializer BuildEntity
EntityInitializer BuildEntity
(EGID entityID, IComponentBuilder[] componentsToBuild, Type descriptorType,
IEnumerable<object> implementors = null)
{
@@ -39,7 +39,7 @@ namespace Svelto.ECS
var dic = EntityFactory.BuildGroupedEntities(entityID, _groupedEntityToAdd, componentsToBuild
, implementors, descriptorType);

return new EntityComponentInitializer(entityID, dic);
return new EntityInitializer(entityID, dic);
}

///--------------------------------------------
@@ -285,8 +285,7 @@ namespace Svelto.ECS
{
if (_groupEntityComponentsDB.TryGetValue(groupID, out var dictionariesOfEntities))
{
foreach (FasterDictionary<RefWrapperType, ITypeSafeDictionary>.KeyValuePairFast dictionaryOfEntities
in dictionariesOfEntities)
foreach (var dictionaryOfEntities in dictionariesOfEntities)
{
dictionaryOfEntities.Value.ExecuteEnginesRemoveCallbacks(_reactiveEnginesAddRemove, profiler
, new ExclusiveGroupStruct(groupID));

EnginesRoot.Entities.cs.meta → Core/EnginesRoot.Entities.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4e91e7ae14883825ab74a51da18c18d5
guid: 285427eb696631de93209efd46376859
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.GenericEntityFactory.cs → Core/EnginesRoot.GenericEntityFactory.cs Vedi File

@@ -13,8 +13,8 @@ namespace Svelto.ECS
_enginesRoot = new Svelto.DataStructures.WeakReference<EnginesRoot>(weakReference);
}

public EntityComponentInitializer BuildEntity<T>
(uint entityID, BuildGroup groupStructId, IEnumerable<object> implementors = null)
public EntityInitializer BuildEntity<T>
(uint entityID, ExclusiveBuildGroup groupStructId, IEnumerable<object> implementors = null)
where T : IEntityDescriptor, new()
{
return _enginesRoot.Target.BuildEntity(new EGID(entityID, groupStructId)
@@ -22,26 +22,26 @@ namespace Svelto.ECS
, TypeCache<T>.type, implementors);
}

public EntityComponentInitializer BuildEntity<T>(EGID egid, IEnumerable<object> implementors = null)
public EntityInitializer BuildEntity<T>(EGID egid, IEnumerable<object> implementors = null)
where T : IEntityDescriptor, new()
{
return _enginesRoot.Target.BuildEntity(
egid, EntityDescriptorTemplate<T>.descriptor.componentsToBuild, TypeCache<T>.type, implementors);
}

public EntityComponentInitializer BuildEntity<T>
public EntityInitializer BuildEntity<T>
(EGID egid, T entityDescriptor, IEnumerable<object> implementors) where T : IEntityDescriptor
{
return _enginesRoot.Target.BuildEntity(egid, entityDescriptor.componentsToBuild, TypeCache<T>.type, implementors);
}
#if UNITY_NATIVE
public NativeEntityFactory ToNative<T>(string memberName) where T : IEntityDescriptor, new()
public NativeEntityFactory ToNative<T>(string callerName) where T : IEntityDescriptor, new()
{
return _enginesRoot.Target.ProvideNativeEntityFactoryQueue<T>(memberName);
return _enginesRoot.Target.ProvideNativeEntityFactoryQueue<T>(callerName);
}
#endif
public EntityComponentInitializer BuildEntity<T>
(uint entityID, BuildGroup groupStructId, T descriptorEntity, IEnumerable<object> implementors)
public EntityInitializer BuildEntity<T>
(uint entityID, ExclusiveBuildGroup groupStructId, T descriptorEntity, IEnumerable<object> implementors)
where T : IEntityDescriptor
{
return _enginesRoot.Target.BuildEntity(new EGID(entityID, groupStructId)
@@ -54,7 +54,7 @@ namespace Svelto.ECS
_enginesRoot.Target.Preallocate<T>(groupStructId, size);
}
public EntityComponentInitializer BuildEntity(EGID egid, IComponentBuilder[] componentsToBuild, Type type, IEnumerable<object> implementors = null)
public EntityInitializer BuildEntity(EGID egid, IComponentBuilder[] componentsToBuild, Type type, IEnumerable<object> implementors = null)
{
return _enginesRoot.Target.BuildEntity(egid, componentsToBuild, type, implementors);
}

EnginesRoot.GenericEntityFactory.cs.meta → Core/EnginesRoot.GenericEntityFactory.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44d18988251a391090b6a72a159f32b3
guid: 3c51c0b5c5723f3bafc17521eff882b1
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.GenericEntityFunctions.cs → Core/EnginesRoot.GenericEntityFunctions.cs Vedi File

@@ -1,5 +1,4 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
using Svelto.Common;
using Svelto.DataStructures;
using Svelto.ECS.Internal;
@@ -20,18 +19,18 @@ namespace Svelto.ECS
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RemoveEntity<T>(uint entityID, BuildGroup groupID) where T :
public void RemoveEntity<T>(uint entityID, ExclusiveBuildGroup groupID, [CallerMemberName] string memberName = "") where T :
IEntityDescriptor, new()
{
RemoveEntity<T>(new EGID(entityID, groupID));
RemoveEntity<T>(new EGID(entityID, groupID), memberName);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RemoveEntity<T>(EGID entityEGID) where T : IEntityDescriptor, new()
public void RemoveEntity<T>(EGID entityEGID, [CallerMemberName] string memberName = "") where T : IEntityDescriptor, new()
{
DBC.ECS.Check.Require(entityEGID.groupID != 0, "invalid group detected");
var descriptorComponentsToBuild = EntityDescriptorTemplate<T>.descriptor.componentsToBuild;
_enginesRoot.Target.CheckRemoveEntityID(entityEGID, TypeCache<T>.type);
_enginesRoot.Target.CheckRemoveEntityID(entityEGID, TypeCache<T>.type, memberName);

_enginesRoot.Target.QueueEntitySubmitOperation<T>(
new EntitySubmitOperation(EntitySubmitOperationType.Remove, entityEGID, entityEGID,
@@ -39,7 +38,7 @@ namespace Svelto.ECS
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RemoveEntitiesFromGroup(BuildGroup groupID)
public void RemoveEntitiesFromGroup(ExclusiveBuildGroup groupID)
{
DBC.ECS.Check.Require(groupID != 0, "invalid group detected");
_enginesRoot.Target.RemoveGroupID(groupID);
@@ -73,7 +72,7 @@ namespace Svelto.ECS
// }

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SwapEntitiesInGroup<T>(BuildGroup fromGroupID, BuildGroup toGroupID)
public void SwapEntitiesInGroup<T>(ExclusiveBuildGroup fromGroupID, ExclusiveBuildGroup toGroupID)
where T : IEntityDescriptor, new()
{
if (_enginesRoot.Target._groupEntityComponentsDB.TryGetValue(
@@ -98,23 +97,23 @@ namespace Svelto.ECS
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SwapEntityGroup<T>(uint entityID, BuildGroup fromGroupID,
BuildGroup toGroupID)
public void SwapEntityGroup<T>(uint entityID, ExclusiveBuildGroup fromGroupID,
ExclusiveBuildGroup toGroupID)
where T : IEntityDescriptor, new()
{
SwapEntityGroup<T>(new EGID(entityID, fromGroupID), toGroupID);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SwapEntityGroup<T>(EGID fromID, BuildGroup toGroupID)
public void SwapEntityGroup<T>(EGID fromID, ExclusiveBuildGroup toGroupID)
where T : IEntityDescriptor, new()
{
SwapEntityGroup<T>(fromID, new EGID(fromID.entityID, (uint) toGroupID));
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SwapEntityGroup<T>(EGID fromID, BuildGroup toGroupID
, BuildGroup mustBeFromGroup)
public void SwapEntityGroup<T>(EGID fromID, ExclusiveBuildGroup toGroupID
, ExclusiveBuildGroup mustBeFromGroup)
where T : IEntityDescriptor, new()
{
if (fromID.groupID != mustBeFromGroup)
@@ -125,7 +124,7 @@ namespace Svelto.ECS

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SwapEntityGroup<T>(EGID fromID, EGID toID
, BuildGroup mustBeFromGroup)
, ExclusiveBuildGroup mustBeFromGroup)
where T : IEntityDescriptor, new()
{
if (fromID.groupID != mustBeFromGroup)
@@ -196,7 +195,7 @@ namespace Svelto.ECS
}
else
#endif
_entitiesOperations.Set((ulong) entitySubmitOperation.fromID, entitySubmitOperation);
_entitiesOperations[(ulong) entitySubmitOperation.fromID] = entitySubmitOperation;
}
}
}

EnginesRoot.GenericEntityFunctions.cs.meta → Core/EnginesRoot.GenericEntityFunctions.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 682629f22d513d658b85361c143e5a48
guid: a3e5901720f035a7bd7f9d192cc0a9ed
MonoImporter:
externalObjects: {}
serializedVersion: 2

EnginesRoot.Submission.cs → Core/EnginesRoot.Submission.cs Vedi File

@@ -1,4 +1,4 @@
using System;
using System.Collections;
using Svelto.Common;
using Svelto.DataStructures;
using Svelto.ECS.Internal;
@@ -9,16 +9,18 @@ namespace Svelto.ECS
{
readonly FasterList<EntitySubmitOperation> _transientEntitiesOperations;

void SubmitEntityComponents()
IEnumerator SubmitEntityComponents(uint maxNumberOfOperations)
{
using (var profiler = new PlatformProfiler("Svelto.ECS - Entities Submission"))
{
int iterations = 0;
do
{
SingleSubmission(profiler);
var submitEntityComponents = SingleSubmission(profiler, maxNumberOfOperations);
while (submitEntityComponents.MoveNext() == true)
yield return null;
} while ((_groupedEntityToAdd.currentEntitiesCreatedPerGroup.count > 0 ||
_entitiesOperations.Count > 0) && ++iterations < 5);
_entitiesOperations.count > 0) && ++iterations < 5);

#if DEBUG && !PROFILE_SVELTO
if (iterations == 5)
@@ -32,7 +34,8 @@ namespace Svelto.ECS
/// Something to do when I will optimize the callbacks
/// </summary>
/// <param name="profiler"></param>
void SingleSubmission(in PlatformProfiler profiler)
/// <param name="maxNumberOfOperations"></param>
IEnumerator SingleSubmission(PlatformProfiler profiler, uint maxNumberOfOperations)
{
#if UNITY_NATIVE
NativeOperationSubmission(profiler);
@@ -40,8 +43,9 @@ namespace Svelto.ECS
ClearChecks();

bool entitiesAreSubmitted = false;
uint numberOfOperations = 0;
if (_entitiesOperations.Count > 0)
if (_entitiesOperations.count > 0)
{
using (profiler.Sample("Remove and Swap operations"))
{
@@ -88,6 +92,16 @@ namespace Svelto.ECS

throw;
}

++numberOfOperations;

if ((uint)numberOfOperations >= (uint)maxNumberOfOperations)
{
yield return null;
numberOfOperations = 0;
}
}
}

@@ -102,11 +116,61 @@ namespace Svelto.ECS
{
try
{
AddEntityComponentsToTheDBAndSuitableEngines(profiler);
using (profiler.Sample("Add entities to database"))
{
//each group is indexed by entity view type. for each type there is a dictionary indexed by entityID
foreach (var groupToSubmit in _groupedEntityToAdd.otherEntitiesCreatedPerGroup)
{
var groupID = groupToSubmit.Key;
var groupDB = GetOrCreateGroup(groupID, profiler);

//add the entityComponents in the group
foreach (var entityComponentsToSubmit in _groupedEntityToAdd.other[groupID])
{
var type = entityComponentsToSubmit.Key;
var targetTypeSafeDictionary = entityComponentsToSubmit.Value;
var wrapper = new RefWrapperType(type);

ITypeSafeDictionary dbDic = GetOrCreateTypeSafeDictionary(groupID, groupDB, wrapper,
targetTypeSafeDictionary);

//Fill the DB with the entity components generate this frame.
dbDic.AddEntitiesFromDictionary(targetTypeSafeDictionary, groupID);
}
}
}

//then submit everything in the engines, so that the DB is up to date with all the entity components
//created by the entity built
using (profiler.Sample("Add entities to engines"))
{
foreach (var groupToSubmit in _groupedEntityToAdd.otherEntitiesCreatedPerGroup)
{
var groupID = groupToSubmit.Key;
var groupDB = _groupEntityComponentsDB[groupID];

foreach (var entityComponentsToSubmit in _groupedEntityToAdd.other[groupID])
{
var realDic = groupDB[new RefWrapperType(entityComponentsToSubmit.Key)];

entityComponentsToSubmit.Value.ExecuteEnginesAddOrSwapCallbacks(_reactiveEnginesAddRemove, realDic,
null, new ExclusiveGroupStruct(groupID), in profiler);
++numberOfOperations;

if (numberOfOperations >= maxNumberOfOperations)
{
yield return null;
numberOfOperations = 0;
}
}
}
}
}
finally
{
using (profiler.Sample("clear 6operates double buffering"))
using (profiler.Sample("clear double buffering"))
{
//other can be cleared now, but let's avoid deleting the dictionary every time
_groupedEntityToAdd.ClearOther();
@@ -125,54 +189,7 @@ namespace Svelto.ECS
}
}

void AddEntityComponentsToTheDBAndSuitableEngines(in PlatformProfiler profiler)
{
using (profiler.Sample("Add entities to database"))
{
//each group is indexed by entity view type. for each type there is a dictionary indexed by entityID
foreach (var groupOfEntitiesToSubmit in _groupedEntityToAdd.otherEntitiesCreatedPerGroup)
{
var groupID = groupOfEntitiesToSubmit.Key;
var groupDB = GetOrCreateGroup(groupID, profiler);

//add the entityComponents in the group
foreach (var entityComponentsToSubmit in _groupedEntityToAdd.other[groupID])
{
var type = entityComponentsToSubmit.Key;
var targetTypeSafeDictionary = entityComponentsToSubmit.Value;
var wrapper = new RefWrapperType(type);

ITypeSafeDictionary dbDic = GetOrCreateTypeSafeDictionary(groupID, groupDB, wrapper,
targetTypeSafeDictionary);

//Fill the DB with the entity components generate this frame.
dbDic.AddEntitiesFromDictionary(targetTypeSafeDictionary, groupID);
}
}
}

//then submit everything in the engines, so that the DB is up to date with all the entity components
//created by the entity built
using (profiler.Sample("Add entities to engines"))
{
foreach (var groupToSubmit in _groupedEntityToAdd.otherEntitiesCreatedPerGroup)
{
var groupID = groupToSubmit.Key;
var groupDB = _groupEntityComponentsDB[groupID];

foreach (var entityComponentsToSubmit in _groupedEntityToAdd.other[groupID])
{
var realDic = groupDB[new RefWrapperType(entityComponentsToSubmit.Key)];

entityComponentsToSubmit.Value.ExecuteEnginesAddOrSwapCallbacks(_reactiveEnginesAddRemove, realDic,
null, new ExclusiveGroupStruct(groupToSubmit.Key), in profiler);
}
}
}
}

readonly DoubleBufferedEntitiesToAdd _groupedEntityToAdd;
readonly ThreadSafeDictionary<ulong, EntitySubmitOperation> _entitiesOperations;
readonly FasterDictionary<ulong, EntitySubmitOperation> _entitiesOperations;
}
}

EnginesRoot.Submission.cs.meta → Core/EnginesRoot.Submission.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 973c984f2c7e39b8a01cbc6fc27a23a4
guid: d0fa18c41935378096a8a18fef23d90c
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntitiesDB.FindGroups.cs → Core/EntitiesDB.FindGroups.cs Vedi File


EntitiesDB.FindGroups.cs.meta → Core/EntitiesDB.FindGroups.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 11e0317f53f0374d9924cae6235eacdb
guid: 3a9f8fa92212370fb4baed7ca10e1404
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntitiesDB.cs → Core/EntitiesDB.cs Vedi File


EntitiesDB.cs.meta → Core/EntitiesDB.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ed0a1aea8dc43fbd8c620e8c09ac389b
guid: 48c9691c769a30019d3b411353e06df3
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityCollection.cs → Core/EntityCollection.cs Vedi File

@@ -6,16 +6,17 @@ namespace Svelto.ECS
{
public readonly ref struct EntityCollection<T> where T : struct, IEntityComponent
{
static readonly bool IsUnmanaged = TypeSafeDictionary<T>.IsUnmanaged;
public EntityCollection(IBuffer<T> buffer, uint count):this()
static readonly bool IsUnmanaged = TypeSafeDictionary<T>.IsUnmanaged;
public EntityCollection(IBuffer<T> buffer, uint count) : this()
{
DBC.ECS.Check.Require(count == 0 || buffer.isValid, "Buffer is found in impossible state");
if (IsUnmanaged)
_nativedBuffer = (NB<T>) buffer;
else
_managedBuffer = (MB<T>) buffer;
_count = count;
_count = count;
}

public uint count => _count;
@@ -26,7 +27,8 @@ namespace Svelto.ECS
readonly uint _count;
}

public readonly ref struct EntityCollection<T1, T2> where T1 : struct, IEntityComponent where T2 : struct, IEntityComponent
public readonly ref struct EntityCollection<T1, T2>
where T1 : struct, IEntityComponent where T2 : struct, IEntityComponent
{
internal EntityCollection(in EntityCollection<T1> array1, in EntityCollection<T2> array2)
{
@@ -89,14 +91,14 @@ namespace Svelto.ECS
readonly EntityCollection<T3> _array3;
}

public readonly ref struct EntityCollection<T1, T2, T3, T4>
where T1 : struct, IEntityComponent
where T2 : struct, IEntityComponent
where T3 : struct, IEntityComponent
where T4 : struct, IEntityComponent
public readonly ref struct EntityCollection<T1, T2, T3, T4> where T1 : struct, IEntityComponent
where T2 : struct, IEntityComponent
where T3 : struct, IEntityComponent
where T4 : struct, IEntityComponent
{
internal EntityCollection
(in EntityCollection<T1> array1, in EntityCollection<T2> array2, in EntityCollection<T3> array3, in EntityCollection<T4> array4)
(in EntityCollection<T1> array1, in EntityCollection<T2> array2, in EntityCollection<T3> array3
, in EntityCollection<T4> array4)
{
_array1 = array1;
_array2 = array2;
@@ -104,25 +106,25 @@ namespace Svelto.ECS
_array4 = array4;
}

internal EntityCollection<T1> Item1
internal EntityCollection<T1> buffer1
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _array1;
}

internal EntityCollection<T2> Item2
internal EntityCollection<T2> buffer2
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _array2;
}

internal EntityCollection<T3> Item3
internal EntityCollection<T3> buffer3
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _array3;
}
internal EntityCollection<T4> Item4
internal EntityCollection<T4> buffer4
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _array4;
@@ -142,7 +144,7 @@ namespace Svelto.ECS
public readonly BufferT2 buffer2;
public readonly BufferT3 buffer3;
public readonly BufferT4 buffer4;
public readonly int count;
public readonly int count;

public BT(BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, BufferT4 bufferT4, uint count) : this()
{
@@ -159,7 +161,7 @@ namespace Svelto.ECS
public readonly BufferT1 buffer1;
public readonly BufferT2 buffer2;
public readonly BufferT3 buffer3;
public readonly int count;
public readonly int count;

public BT(BufferT1 bufferT1, BufferT2 bufferT2, BufferT3 bufferT3, uint count) : this()
{
@@ -174,27 +176,27 @@ namespace Svelto.ECS
bufferT1 = buffer1;
bufferT2 = buffer2;
bufferT3 = buffer3;
count = this.count;
count = this.count;
}
}

public readonly struct BT<BufferT1>
{
public readonly BufferT1 buffer;
public readonly int count;
public readonly int count;

public BT(BufferT1 bufferT1, uint count) : this()
{
this.buffer = bufferT1;
this.count = (int) count;
}
public void Deconstruct(out BufferT1 bufferT1, out int count)
{
bufferT1 = buffer;
count = this.count;
}
public static implicit operator BufferT1(BT<BufferT1> t) => t.buffer;
}

@@ -202,7 +204,7 @@ namespace Svelto.ECS
{
public readonly BufferT1 buffer1;
public readonly BufferT2 buffer2;
public readonly int count;
public readonly int count;

public BT(BufferT1 bufferT1, BufferT2 bufferT2, uint count) : this()
{
@@ -210,7 +212,7 @@ namespace Svelto.ECS
this.buffer2 = bufferT2;
this.count = (int) count;
}
public void Deconstruct(out BufferT1 bufferT1, out BufferT2 bufferT2, out int count)
{
bufferT1 = buffer1;
@@ -218,4 +220,4 @@ namespace Svelto.ECS
count = this.count;
}
}
}
}

EntityCollection.cs.meta → Core/EntityCollection.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 40f815cf92d2362d8d1b86099231660f
guid: 7c93f6823945390588d566a600f0dfbe
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 8
- 0
Core/EntityDescriptor.meta Vedi File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4384643b30cf368c9e63ff9f8d683c1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

DynamicEntityDescriptor.cs → Core/EntityDescriptor/DynamicEntityDescriptor.cs Vedi File


DynamicEntityDescriptor.cs.meta → Core/EntityDescriptor/DynamicEntityDescriptor.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7302cea0b2d33e25a977d5eab9553ffa
guid: fe131b7b45e33280be3e268429559849
MonoImporter:
externalObjects: {}
serializedVersion: 2

ExtendibleEntityDescriptor.cs → Core/EntityDescriptor/ExtendibleEntityDescriptor.cs Vedi File

@@ -6,6 +6,19 @@ namespace Svelto.ECS
/// <summary>
/// Inherit from an ExtendibleEntityDescriptor to extend a base entity descriptor that can be used
/// to swap and remove specialized entities from abstract engines
///
/// Usage Example:
///
/// class SpecialisedDescriptor : ExtendibleEntityDescriptor<BaseDescriptor>
/// {
/// public SpecialisedDescriptor() : base (new IComponentBuilder[]
/// {
/// new ComponentBuilder<ObjectParentComponent>() //add more components to the base descriptor
/// })
/// {
/// ExtendWith<ContractDescriptor>(); //add extra components from descriptors that act as contract
/// }
/// }
/// </summary>
/// <typeparam name="TType"></typeparam>
public class ExtendibleEntityDescriptor<TType> : IDynamicEntityDescriptor where TType : IEntityDescriptor, new()

ExtendibleEntityDescriptor.cs.meta → Core/EntityDescriptor/ExtendibleEntityDescriptor.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 556422fea1ed3a2da4ffe08d8c57791d
guid: bfe2a66cb78f3fc195d27f316bb5dfbf
MonoImporter:
externalObjects: {}
serializedVersion: 2

GenericEntityDescriptor.cs → Core/EntityDescriptor/GenericEntityDescriptor.cs Vedi File


GenericEntityDescriptor.cs.meta → Core/EntityDescriptor/GenericEntityDescriptor.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fcc3912821f83f1c89b6cf7a53776f22
guid: 0ebe5676f01b32709d477f35e66418d6
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 6
- 0
Core/EntityDescriptor/IDynamicEntityDescriptor.cs Vedi File

@@ -0,0 +1,6 @@
namespace Svelto.ECS
{
public interface IDynamicEntityDescriptor: IEntityDescriptor
{
}
}

+ 11
- 0
Core/EntityDescriptor/IDynamicEntityDescriptor.cs.meta Vedi File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a46883da73f53f8c80de22402a293c6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 7
- 0
Core/EntityDescriptor/IEntityDescriptor.cs Vedi File

@@ -0,0 +1,7 @@
namespace Svelto.ECS
{
public interface IEntityDescriptor
{
IComponentBuilder[] componentsToBuild { get; }
}
}

+ 11
- 0
Core/EntityDescriptor/IEntityDescriptor.cs.meta Vedi File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b9da55a5d6ea337fb438062186eb459e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

EntityDescriptorTemplate.cs → Core/EntityDescriptorTemplate.cs Vedi File

@@ -2,15 +2,6 @@ using System;

namespace Svelto.ECS
{
public interface IEntityDescriptor
{
IComponentBuilder[] componentsToBuild { get; }
}
public interface IDynamicEntityDescriptor: IEntityDescriptor
{
}

static class EntityDescriptorTemplate<TType> where TType : IEntityDescriptor, new()
{
static EntityDescriptorTemplate()

EntityDescriptorTemplate.cs.meta → Core/EntityDescriptorTemplate.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 92c8c4b47f1b3e09866c630f2a653595
guid: 275dc525832d3dea9603e34155f4bd31
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityFactory.cs → Core/EntityFactory.cs Vedi File


EntityFactory.cs.meta → Core/EntityFactory.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ab53ac7587913f74ae704c3b436f435b
guid: e72bb26ae5d3308386aa30e95eea9479
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityGroupNotFoundException.cs → Core/EntityGroupNotFoundException.cs Vedi File


EntityGroupNotFoundException.cs.meta → Core/EntityGroupNotFoundException.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a47fdee155873f1b885a2247f91d17e1
guid: f5290f4d2cdc30d4bb27969f6f41d052
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityInfoView.cs → Core/EntityInfoView.cs Vedi File


EntityInfoView.cs.meta → Core/EntityInfoView.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 736fd837eacf3210b80c1c46a3242b6f
guid: 3782e96d12573ef7a4e7cda84492abca
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityComponentInitializer.cs → Core/EntityInitializer.cs Vedi File

@@ -1,12 +1,11 @@
using System;
using Svelto.DataStructures;
using Svelto.DataStructures;
using Svelto.ECS.Internal;

namespace Svelto.ECS
{
public readonly ref struct EntityComponentInitializer
public readonly ref struct EntityInitializer
{
public EntityComponentInitializer(EGID id, FasterDictionary<RefWrapperType, ITypeSafeDictionary> group)
public EntityInitializer(EGID id, FasterDictionary<RefWrapperType, ITypeSafeDictionary> group)
{
_group = group;
_ID = id;

+ 11
- 0
Core/EntityInitializer.cs.meta Vedi File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c5f91809a80832939d3d4cb8adefd744
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

EntityNotFoundException.cs → Core/EntityNotFoundException.cs Vedi File


EntityNotFoundException.cs.meta → Core/EntityNotFoundException.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 77c06caa7f893965b2fcb96361c01b26
guid: 03bfc923223536d0bb63c3a3b8e3351b
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 16
- 0
Core/EntitySubmissionScheduler.cs Vedi File

@@ -0,0 +1,16 @@
using System.Collections;

namespace Svelto.ECS.Schedulers
{
public abstract class EntitiesSubmissionScheduler
{
protected internal abstract EnginesRoot.EntitiesSubmitter onTick { set; }

public abstract void Dispose();

public abstract bool paused { get; set; }
public uint iteration { get; protected internal set; }
internal bool isRunning;
}
}

EntitySubmissionScheduler.cs.meta → Core/EntitySubmissionScheduler.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 154b8b6eca333188a3a9838eb9702852
guid: 7b3aa74564f6362ca6e3c22f072cd5ac
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntitySubmitOperation.cs → Core/EntitySubmitOperation.cs Vedi File


EntitySubmitOperation.cs.meta → Core/EntitySubmitOperation.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d2606ff288d53bf79dc8528a1b937a28
guid: 871a9cbbaa6f3ddaa66006db670e8d62
MonoImporter:
externalObjects: {}
serializedVersion: 2

EntityViewUtility.cs → Core/EntityViewUtility.cs Vedi File


EntityViewUtility.cs.meta → Core/EntityViewUtility.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 96edc607702a36969e4a671478a49319
guid: 6d5906217c3431e79e8938b026700ba1
MonoImporter:
externalObjects: {}
serializedVersion: 2

Filters.meta → Core/Filters.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 661a733f7383361088023fba3ffea29b
guid: 069239a1daad353c88ee1334d8c7b138
folderAsset: yes
DefaultImporter:
externalObjects: {}

Filters/EntitiesDB.GroupFilters.cs → Core/Filters/EntitiesDB.GroupFilters.cs Vedi File

@@ -1,4 +1,3 @@
using System;
using Svelto.DataStructures;

namespace Svelto.ECS
@@ -99,7 +98,7 @@ namespace Svelto.ECS
#endif
return ref _filters[TypeRefWrapper<T>.wrapper][groupID].GetFilter(filterId);
}
public bool TryGetFilterForGroup<T>(int filterId, ExclusiveGroupStruct groupID, out FilterGroup groupFilter)
where T : struct, IEntityComponent
{

Filters/EntitiesDB.GroupFilters.cs.meta → Core/Filters/EntitiesDB.GroupFilters.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e2644d7bdd9e3c4d96a07f93a5a28497
guid: 5a8f3a6e101838a88604fe66d87cf9d6
MonoImporter:
externalObjects: {}
serializedVersion: 2

Filters/FilterGroup.cs → Core/Filters/FilterGroup.cs Vedi File


Filters/FilterGroup.cs.meta → Core/Filters/FilterGroup.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 820d8be7dde53b5b94864955b2a26a67
guid: 2f13dc2395a2359fa5acac05ebaafc41
MonoImporter:
externalObjects: {}
serializedVersion: 2

Filters/FilteredIndices.cs → Core/Filters/FilteredIndices.cs Vedi File

@@ -8,14 +8,28 @@ namespace Svelto.ECS
public FilteredIndices(NativeDynamicArrayCast<uint> denseListOfIndicesToEntityComponentArray)
{
_denseListOfIndicesToEntityComponentArray = denseListOfIndicesToEntityComponentArray;
_count = _denseListOfIndicesToEntityComponentArray.count;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Count() => _denseListOfIndicesToEntityComponentArray.Count();
public int Count() => _count;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint Get(uint index) => _denseListOfIndicesToEntityComponentArray[index];

public uint this[uint index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _denseListOfIndicesToEntityComponentArray[index];
}

public uint this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _denseListOfIndicesToEntityComponentArray[index];
}

readonly NativeDynamicArrayCast<uint> _denseListOfIndicesToEntityComponentArray;
readonly int _count;
}
}

Filters/FilteredIndices.cs.meta → Core/Filters/FilteredIndices.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8311e83888a9391a821923ab0940cb81
guid: 8d699c30169d326ba534c80d1ab5c504
MonoImporter:
externalObjects: {}
serializedVersion: 2

Filters/GroupFilters.cs → Core/Filters/GroupFilters.cs Vedi File

@@ -40,7 +40,7 @@ namespace Svelto.ECS
return filters.TryGetValue(filterIndex, out filter);
}

public SveltoDictionary<int, FilterGroup, NativeStrategy<FasterDictionaryNode<int>>, NativeStrategy<FilterGroup>
public SveltoDictionary<int, FilterGroup, NativeStrategy<SveltoDictionaryNode<int>>, NativeStrategy<FilterGroup>
, NativeStrategy<int>>.SveltoDictionaryKeyValueEnumerator GetEnumerator()
{
return filters.GetEnumerator();

Filters/GroupFilters.cs.meta → Core/Filters/GroupFilters.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 36769f644df630609a3f3c4589bab898
guid: 7f1fcb3722433ba98f34384a1553a661
MonoImporter:
externalObjects: {}
serializedVersion: 2

GlobalTypeID.cs → Core/GlobalTypeID.cs Vedi File

@@ -16,7 +16,7 @@ namespace Svelto.ECS

interface IFiller
{
void FillFromByteArray(EntityComponentInitializer init, NativeBag buffer);
void FillFromByteArray(EntityInitializer init, NativeBag buffer);
}

class Filler<T> : IFiller where T : struct, IEntityComponent
@@ -27,7 +27,7 @@ namespace Svelto.ECS
}

//it's an internal interface
public void FillFromByteArray(EntityComponentInitializer init, NativeBag buffer)
public void FillFromByteArray(EntityInitializer init, NativeBag buffer)
{
var component = buffer.Dequeue<T>();


GlobalTypeID.cs.meta → Core/GlobalTypeID.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 740c683eaf643b0ea295428cd190c318
guid: 37971713191c36abbf22e12726eac5b1
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 8
- 0
Core/Groups.meta Vedi File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a1919d31796f3c9f954d36b5debf3047
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 27
- 0
Core/Groups/ExclusiveBuildGroup.cs Vedi File

@@ -0,0 +1,27 @@
namespace Svelto.ECS
{
public readonly struct ExclusiveBuildGroup
{
internal ExclusiveBuildGroup(ExclusiveGroupStruct group)
{
this.group = group;
}

public static implicit operator ExclusiveBuildGroup(ExclusiveGroupStruct group)
{
return new ExclusiveBuildGroup(group);
}

public static implicit operator ExclusiveBuildGroup(ExclusiveGroup group)
{
return new ExclusiveBuildGroup(group);
}
public static implicit operator uint(ExclusiveBuildGroup groupStruct)
{
return groupStruct.group;
}

internal ExclusiveGroupStruct @group { get; }
}
}

+ 11
- 0
Core/Groups/ExclusiveBuildGroup.cs.meta Vedi File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 759fccc978ac33eaab89d2076fc6545d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

ExclusiveGroup.cs → Core/Groups/ExclusiveGroup.cs Vedi File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

#pragma warning disable 660,661


ExclusiveGroup.cs.meta → Core/Groups/ExclusiveGroup.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 11a6c1ee094c3a9da95234d1387d3403
guid: cee0b977af8e315ca8cad5b28d2d46dd
MonoImporter:
externalObjects: {}
serializedVersion: 2

ExclusiveGroupStruct.cs → Core/Groups/ExclusiveGroupStruct.cs Vedi File

@@ -4,31 +4,6 @@ using System.Runtime.InteropServices;

namespace Svelto.ECS
{
public readonly struct BuildGroup
{
internal BuildGroup(ExclusiveGroupStruct group)
{
this.group = group;
}

public static implicit operator BuildGroup(ExclusiveGroupStruct group)
{
return new BuildGroup(group);
}

public static implicit operator BuildGroup(ExclusiveGroup group)
{
return new BuildGroup(group);
}
public static implicit operator uint(BuildGroup groupStruct)
{
return groupStruct.group;
}

internal ExclusiveGroupStruct @group { get; }
}
[StructLayout(LayoutKind.Explicit, Size = 4)]
public struct ExclusiveGroupStruct : IEquatable<ExclusiveGroupStruct>, IComparable<ExclusiveGroupStruct>,
IEqualityComparer<ExclusiveGroupStruct>

ExclusiveGroupStruct.cs.meta → Core/Groups/ExclusiveGroupStruct.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 67dde70e73a3374a87d0e9b93385405a
guid: b6cfcea8668c32ef94ce020fb53a4ed2
MonoImporter:
externalObjects: {}
serializedVersion: 2

GroupCompound.cs → Core/Groups/GroupCompound.cs Vedi File

@@ -20,7 +20,7 @@ namespace Svelto.ECS
static readonly FasterList<ExclusiveGroupStruct> _Groups;
public static FasterReadOnlyList<ExclusiveGroupStruct> Groups => new FasterReadOnlyList<ExclusiveGroupStruct>(_Groups);
public static BuildGroup BuildGroup => new BuildGroup(_Groups[0]);
public static ExclusiveBuildGroup BuildGroup => new ExclusiveBuildGroup(_Groups[0]);
static GroupCompound()
{
@@ -100,7 +100,7 @@ namespace Svelto.ECS
public static FasterReadOnlyList<ExclusiveGroupStruct> Groups =>
new FasterReadOnlyList<ExclusiveGroupStruct>(_Groups);
public static BuildGroup BuildGroup => new BuildGroup(_Groups[0]);
public static ExclusiveBuildGroup BuildGroup => new ExclusiveBuildGroup(_Groups[0]);
public static void Add(ExclusiveGroupStruct group)
{
@@ -152,7 +152,7 @@ namespace Svelto.ECS
public static FasterReadOnlyList<ExclusiveGroupStruct> Groups =>
new FasterReadOnlyList<ExclusiveGroupStruct>(_Groups);
public static BuildGroup BuildGroup => new BuildGroup(_Groups[0]);
public static ExclusiveBuildGroup BuildGroup => new ExclusiveBuildGroup(_Groups[0]);
public static void Add(ExclusiveGroupStruct group)
{
@@ -200,7 +200,7 @@ namespace Svelto.ECS
public static FasterReadOnlyList<ExclusiveGroupStruct> Groups =>
new FasterReadOnlyList<ExclusiveGroupStruct>(_Groups);
public static BuildGroup BuildGroup => new BuildGroup(_Groups[0]);
public static ExclusiveBuildGroup BuildGroup => new ExclusiveBuildGroup(_Groups[0]);
static GroupTag()
{

GroupCompound.cs.meta → Core/Groups/GroupCompound.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b4c8e3ece545370bbdd5fb72949c5984
guid: 9fa284c90e64364a9b9f51059873d380
MonoImporter:
externalObjects: {}
serializedVersion: 2

NamedExclusiveGroup.cs → Core/Groups/NamedExclusiveGroup.cs Vedi File


NamedExclusiveGroup.cs.meta → Core/Groups/NamedExclusiveGroup.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 362902783441376594e2c3b205be9758
guid: 66873b05950835849a0c2f5a80231aa7
MonoImporter:
externalObjects: {}
serializedVersion: 2

Hybrid.meta → Core/Hybrid.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 452fdabd148532a29a6b4ca381ab3ef0
guid: 026e29ec3d85325bbc2608d35de19990
folderAsset: yes
DefaultImporter:
externalObjects: {}

IEntityDescriptorHolder.cs → Core/Hybrid/IEntityDescriptorHolder.cs Vedi File


IEntityDescriptorHolder.cs.meta → Core/Hybrid/IEntityDescriptorHolder.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1636c499352d37f1b9e429f84429f4c0
guid: 8abbfa8e203e3d70a839bda4ab032eac
MonoImporter:
externalObjects: {}
serializedVersion: 2

Hybrid/IEntityViewComponent.cs → Core/Hybrid/IEntityViewComponent.cs Vedi File


Hybrid/IEntityViewComponent.cs.meta → Core/Hybrid/IEntityViewComponent.cs.meta Vedi File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 98b35f1b576439b68efee7e27c7c3f47
guid: feb91403dddf3b3c8393879238a18aa0
MonoImporter:
externalObjects: {}
serializedVersion: 2

Dato che sono stati cambiati molti file in questo diff, alcuni di essi non verranno mostrati

Loading…
Annulla
Salva