/// <summary> /// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot /// as multiple engines root could promote separation of scopes. The EntitySubmissionScheduler checks /// periodically if new entity must be submitted to the database and the engines. It's an external /// dependencies to be independent by the running platform as the user can define it. /// The EntitySubmissionScheduler cannot hold an EnginesRoot reference, that's why /// it must receive a weak reference of the EnginesRoot callback. /// </summary> public EnginesRoot(IEntitiesSubmissionScheduler entitiesComponentScheduler) { _entitiesOperations = new ThreadSafeDictionary <ulong, EntitySubmitOperation>(); serializationDescriptorMap = new SerializationDescriptorMap(); _reactiveEnginesAddRemove = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _reactiveEnginesSwap = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _enginesSet = new FasterList <IEngine>(); _enginesTypeSet = new HashSet <Type>(); _disposableEngines = new FasterList <IDisposable>(); _transientEntitiesOperations = new FasterList <EntitySubmitOperation>(); _groupEntityComponentsDB = new FasterDictionary <uint, FasterDictionary <RefWrapper <Type>, ITypeSafeDictionary> >(); _groupsPerEntity = new FasterDictionary <RefWrapper <Type>, FasterDictionary <uint, ITypeSafeDictionary> >(); _groupedEntityToAdd = new DoubleBufferedEntitiesToAdd(); _entitiesStream = new EntitiesStream(); _entitiesDB = new EntitiesDB(_groupEntityComponentsDB, _groupsPerEntity, _entitiesStream); scheduler = entitiesComponentScheduler; scheduler.onTick = new EntitiesSubmitter(this); #if UNITY_BURST AllocateNativeOperations(); #endif }
internal EntitiesDB (FasterDictionary <uint, FasterDictionary <RefWrapper <Type>, ITypeSafeDictionary> > groupEntityComponentsDB , FasterDictionary <RefWrapper <Type>, FasterDictionary <uint, ITypeSafeDictionary> > groupsPerEntity , EntitiesStream entityStream) { _groupEntityComponentsDB = groupEntityComponentsDB; _groupsPerEntity = groupsPerEntity; _entityStream = entityStream; }
/// <summary> /// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot /// as multiple engines root could promote separation of scopes. The EntitySubmissionScheduler checks /// periodically if new entity must be submitted to the database and the engines. It's an external /// dependencies to be independent by the running platform as the user can define it. /// The EntitySubmissionScheduler cannot hold an EnginesRoot reference, that's why /// it must receive a weak reference of the EnginesRoot callback. /// </summary> public EnginesRoot(IEntitySubmissionScheduler entityViewScheduler) { _entitiesOperations = new FasterDictionary <ulong, EntitySubmitOperation>(); _entityEngines = new Dictionary <Type, FasterList <IHandleEntityViewEngineAbstracted> >(); _enginesSet = new HashSet <IEngine>(); _disposableEngines = new FasterList <IDisposable>(); _transientEntitiesOperations = new FasterList <EntitySubmitOperation>(); _groupEntityDB = new FasterDictionary <uint, Dictionary <Type, ITypeSafeDictionary> >(); _groupsPerEntity = new Dictionary <Type, FasterDictionary <uint, ITypeSafeDictionary> >(); _groupedEntityToAdd = new DoubleBufferedEntitiesToAdd(); _entitiesStream = new EntitiesStream(); _entitiesDB = new EntitiesDB(_groupEntityDB, _groupsPerEntity, _entitiesStream); _scheduler = entityViewScheduler; _scheduler.onTick = new WeakAction(SubmitEntityViews); }
/// <summary> /// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot /// as multiple engines root could promote separation of scopes. The EntitySubmissionScheduler checks /// periodically if new entity must be submitted to the database and the engines. It's an external /// dependencies to be independent by the running platform as the user can define it. /// The EntitySubmissionScheduler cannot hold an EnginesRoot reference, that's why /// it must receive a weak reference of the EnginesRoot callback. /// </summary> public EnginesRoot(IEntitySubmissionScheduler entityViewScheduler) { _entitiesOperations = new ThreadSafeDictionary <ulong, EntitySubmitOperation>(); _reactiveEnginesAddRemove = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _reactiveEnginesSwap = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _enginesSet = new FasterList <IEngine>(); _enginesTypeSet = new HashSet <Type>(); _disposableEngines = new FasterList <IDisposable>(); _transientEntitiesOperations = new FasterList <EntitySubmitOperation>(); _groupEntityViewsDB = new FasterDictionary <uint, FasterDictionary <RefWrapper <Type>, ITypeSafeDictionary> >(); _groupsPerEntity = new FasterDictionary <RefWrapper <Type>, FasterDictionary <uint, ITypeSafeDictionary> >(); _groupedEntityToAdd = new DoubleBufferedEntitiesToAdd(); _entitiesStream = new EntitiesStream(); _entitiesDB = new EntitiesDB(_groupEntityViewsDB, _groupsPerEntity, _entitiesStream); _scheduler = entityViewScheduler; _scheduler.onTick = new EntitiesSubmitter(this); }