diff --git a/Svelto.ECS/Context/ContextNotifier.cs b/Svelto.ECS/Context/ContextNotifier.cs deleted file mode 100644 index 4df329e..0000000 --- a/Svelto.ECS/Context/ContextNotifier.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using WeakReferenceI = Svelto.DataStructures.WeakReference; -using WeakReferenceD = Svelto.DataStructures.WeakReference; - -namespace Svelto.Context -{ - public class ContextNotifier : IContextNotifer - { - public ContextNotifier() - { - _toInitialize = new List(); - _toDeinitialize = new List(); - } - - public void AddFrameworkDestructionListener(IWaitForFrameworkDestruction obj) - { - if (_toDeinitialize != null) - _toDeinitialize.Add(new WeakReferenceD(obj)); - else - throw new Exception("An object is expected to be initialized after the framework has been deinitialized. Type: " + obj.GetType()); - } - - public void AddFrameworkInitializationListener(IWaitForFrameworkInitialization obj) - { - if (_toInitialize != null) - _toInitialize.Add(new WeakReferenceI(obj)); - else - throw new Exception("An object is expected to be initialized after the framework has been initialized. Type: " + obj.GetType()); - } - - /// - /// A Context is meant to be deinitialized only once in its timelife - /// - public void NotifyFrameworkDeinitialized() - { - for (var i = _toDeinitialize.Count - 1; i >= 0; --i) - try - { - var obj = _toDeinitialize[i]; - if (obj.IsAlive) - obj.Target.OnFrameworkDestroyed(); - } - catch (Exception e) - { - Utility.Console.LogException(e); - } - - _toDeinitialize = null; - } - - /// - /// A Context is meant to be initialized only once in its timelife - /// - public void NotifyFrameworkInitialized() - { - for (var i = _toInitialize.Count - 1; i >= 0; --i) - try - { - var obj = _toInitialize[i]; - if (obj.IsAlive) - obj.Target.OnFrameworkInitialized(); - } - catch (Exception e) - { - Utility.Console.LogException(e); - } - - _toInitialize = null; - } - - List _toDeinitialize; - List _toInitialize; - } -} diff --git a/Svelto.ECS/Context/Factories/GameObjectFactory.cs b/Svelto.ECS/Context/Factories/GameObjectFactory.cs deleted file mode 100644 index 9b73f0a..0000000 --- a/Svelto.ECS/Context/Factories/GameObjectFactory.cs +++ /dev/null @@ -1,65 +0,0 @@ -#if UNITY_5 || UNITY_5_3_OR_NEWER -using System.Collections.Generic; -using UnityEngine; - -namespace Svelto.Context -{ - public class GameObjectFactory : Factories.IGameObjectFactory - { - public GameObjectFactory() - { - _prefabs = new Dictionary(); - } - - public GameObject Build(string prefabName) - { - DesignByContract.Check.Require(_prefabs.ContainsKey(prefabName), "Svelto.Factories.IGameObjectFactory -prefab was not found:" + prefabName); - - var go = Build(_prefabs[prefabName][0]); - - GameObject parent = _prefabs[prefabName][1]; - - if (parent != null) - { - Transform transform = go.transform; - - var scale = transform.localScale; - var rotation = transform.localRotation; - var position = transform.localPosition; - - parent.SetActive(true); - - transform.parent = parent.transform; - - transform.localPosition = position; - transform.localRotation = rotation; - transform.localScale = scale; - } - - return go; - } - - public virtual GameObject Build(GameObject prefab) - { - var copy = Object.Instantiate(prefab) as GameObject; - - return copy; - } - - /// - /// Register a prefab to be built later using a string ID. - /// - /// original prefab - public void RegisterPrefab(GameObject prefab, string prefabName, GameObject parent = null) - { - var objects = new GameObject[2]; - - objects[0] = prefab; objects[1] = parent; - - _prefabs.Add(prefabName, objects); - } - - Dictionary _prefabs; - } -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/Context/Factories/MonoBehaviourFactory.cs b/Svelto.ECS/Context/Factories/MonoBehaviourFactory.cs deleted file mode 100644 index bd376b6..0000000 --- a/Svelto.ECS/Context/Factories/MonoBehaviourFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -#if UNITY_5 || UNITY_5_3_OR_NEWER -#region - -using System; -using UnityEngine; - -#endregion - -namespace Svelto.Context -{ - public class MonoBehaviourFactory : Factories.IMonoBehaviourFactory - { - virtual public M Build(Func constructor) where M : MonoBehaviour - { - var mb = constructor(); - - return mb; - } - } -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/Context/ICompositionRoot.cs b/Svelto.ECS/Context/ICompositionRoot.cs deleted file mode 100644 index 88acda0..0000000 --- a/Svelto.ECS/Context/ICompositionRoot.cs +++ /dev/null @@ -1,11 +0,0 @@ -#if UNITY_5 || UNITY_5_3_OR_NEWER -namespace Svelto.Context -{ - public interface ICompositionRoot - { - void OnContextCreated(UnityContext contextHolder); - void OnContextInitialized(); - void OnContextDestroyed(); - } -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/Context/IContextNotifer.cs b/Svelto.ECS/Context/IContextNotifer.cs deleted file mode 100644 index 6ac2c14..0000000 --- a/Svelto.ECS/Context/IContextNotifer.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Svelto.Context -{ - public interface IContextNotifer - { - void NotifyFrameworkInitialized(); - void NotifyFrameworkDeinitialized(); - - void AddFrameworkInitializationListener(IWaitForFrameworkInitialization obj); - void AddFrameworkDestructionListener(IWaitForFrameworkDestruction obj); - } -} diff --git a/Svelto.ECS/Context/IUnityCompositionRoot.cs b/Svelto.ECS/Context/IUnityCompositionRoot.cs deleted file mode 100644 index c4db99a..0000000 --- a/Svelto.ECS/Context/IUnityCompositionRoot.cs +++ /dev/null @@ -1,11 +0,0 @@ -#if UNITY_5 || UNITY_5_3_OR_NEWER -namespace Svelto.Context -{ - public interface IUnityCompositionRoot - { - void OnContextCreated(UnityContext contextHolder); - void OnContextInitialized(); - void OnContextDestroyed(); - } -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/Context/IWaitForFrameworkDestruction.cs b/Svelto.ECS/Context/IWaitForFrameworkDestruction.cs deleted file mode 100644 index e830787..0000000 --- a/Svelto.ECS/Context/IWaitForFrameworkDestruction.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Svelto.Context -{ - public interface IWaitForFrameworkDestruction - { - void OnFrameworkDestroyed(); - } -} - diff --git a/Svelto.ECS/Context/IWaitForFrameworkInitialization.cs b/Svelto.ECS/Context/IWaitForFrameworkInitialization.cs deleted file mode 100644 index f1b8dfb..0000000 --- a/Svelto.ECS/Context/IWaitForFrameworkInitialization.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Svelto.Context -{ - public interface IWaitForFrameworkInitialization - { - void OnFrameworkInitialized(); - } -} - diff --git a/Svelto.ECS/Context/UnityContext.cs b/Svelto.ECS/Context/UnityContext.cs deleted file mode 100644 index 925a147..0000000 --- a/Svelto.ECS/Context/UnityContext.cs +++ /dev/null @@ -1,51 +0,0 @@ -#if UNITY_5 || UNITY_5_3_OR_NEWER -using System.Collections; -using Svelto.Context; -using UnityEngine; - -public abstract class UnityContext:MonoBehaviour -{ - protected abstract void OnAwake(); - - void Awake() - { - OnAwake(); - } -} - -//a Unity context is a platform specific context wrapper. -//Unity will drive the ICompositionRoot interface. -//OnContextCreated is called during the Awake of this MB -//OnContextInitialized is called one frame after the MB started -//OnContextDestroyed is called when the MB is destroyed -public class UnityContext: UnityContext where T:class, ICompositionRoot, new() -{ - protected override void OnAwake() - { - _applicationRoot = new T(); - - _applicationRoot.OnContextCreated(this); - } - - void OnDestroy() - { - _applicationRoot.OnContextDestroyed(); - } - - void Start() - { - if (Application.isPlaying == true) - StartCoroutine(WaitForFrameworkInitialization()); - } - - IEnumerator WaitForFrameworkInitialization() - { - //let's wait until the end of the frame, so we are sure that all the awake and starts are called - yield return new WaitForEndOfFrame(); - - _applicationRoot.OnContextInitialized(); - } - - T _applicationRoot; -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/ECS/DataStructures/TypeSafeDictionary.cs b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs similarity index 100% rename from Svelto.ECS/ECS/DataStructures/TypeSafeDictionary.cs rename to Svelto.ECS/DataStructures/TypeSafeDictionary.cs diff --git a/Svelto.ECS/ECS/DataStructures/TypeSafeFasterListForECS.cs b/Svelto.ECS/DataStructures/TypeSafeFasterListForECS.cs similarity index 100% rename from Svelto.ECS/ECS/DataStructures/TypeSafeFasterListForECS.cs rename to Svelto.ECS/DataStructures/TypeSafeFasterListForECS.cs diff --git a/Svelto.ECS/ECS/Dispatcher/DispatchOnChange.cs b/Svelto.ECS/Dispatcher/DispatchOnChange.cs similarity index 100% rename from Svelto.ECS/ECS/Dispatcher/DispatchOnChange.cs rename to Svelto.ECS/Dispatcher/DispatchOnChange.cs diff --git a/Svelto.ECS/ECS/Dispatcher/DispatcherOnSet.cs b/Svelto.ECS/Dispatcher/DispatcherOnSet.cs similarity index 100% rename from Svelto.ECS/ECS/Dispatcher/DispatcherOnSet.cs rename to Svelto.ECS/Dispatcher/DispatcherOnSet.cs diff --git a/Svelto.ECS/ECS/EnginesRootEngines.cs b/Svelto.ECS/EnginesRootEngines.cs similarity index 100% rename from Svelto.ECS/ECS/EnginesRootEngines.cs rename to Svelto.ECS/EnginesRootEngines.cs diff --git a/Svelto.ECS/ECS/EnginesRootEntities.cs b/Svelto.ECS/EnginesRootEntities.cs similarity index 98% rename from Svelto.ECS/ECS/EnginesRootEntities.cs rename to Svelto.ECS/EnginesRootEntities.cs index fea2823..8a1939b 100644 --- a/Svelto.ECS/ECS/EnginesRootEntities.cs +++ b/Svelto.ECS/EnginesRootEntities.cs @@ -306,7 +306,7 @@ namespace Svelto.ECS _weakEngine = weakReference; } - public void BuildEntity(int entityID, object[] implementors = null) where T : IEntityDescriptor, new() + public void BuildEntity(int entityID, object[] implementors) where T : IEntityDescriptor, new() { _weakEngine.Target.BuildEntity(entityID, implementors); } @@ -316,17 +316,17 @@ namespace Svelto.ECS _weakEngine.Target.BuildEntity(entityID, entityDescriptor, implementors); } - public void BuildMetaEntity(int metaEntityID, object[] implementors = null) where T : IEntityDescriptor, new() + public void BuildMetaEntity(int metaEntityID, object[] implementors) where T : IEntityDescriptor, new() { _weakEngine.Target.BuildMetaEntity(metaEntityID, implementors); } - public void BuildEntityInGroup(int entityID, int groupID, object[] implementors = null) where T : IEntityDescriptor, new() + public void BuildEntityInGroup(int entityID, int groupID, object[] implementors) where T : IEntityDescriptor, new() { _weakEngine.Target.BuildEntityInGroup(entityID, groupID, implementors); } - public void BuildEntityInGroup(int entityID, int groupID, IEntityDescriptorInfo entityDescriptor, object[] implementors = null) + public void BuildEntityInGroup(int entityID, int groupID, IEntityDescriptorInfo entityDescriptor, object[] implementors) { _weakEngine.Target.BuildEntityInGroup(entityID, groupID, entityDescriptor, implementors); } diff --git a/Svelto.ECS/ECS/EnginesRootSubmission.cs b/Svelto.ECS/EnginesRootSubmission.cs similarity index 100% rename from Svelto.ECS/ECS/EnginesRootSubmission.cs rename to Svelto.ECS/EnginesRootSubmission.cs diff --git a/Svelto.ECS/ECS/EntityDescriptor.cs b/Svelto.ECS/EntityDescriptor.cs similarity index 100% rename from Svelto.ECS/ECS/EntityDescriptor.cs rename to Svelto.ECS/EntityDescriptor.cs diff --git a/Svelto.ECS/ECS/EntitySubmissionScheduler.cs b/Svelto.ECS/EntitySubmissionScheduler.cs similarity index 100% rename from Svelto.ECS/ECS/EntitySubmissionScheduler.cs rename to Svelto.ECS/EntitySubmissionScheduler.cs diff --git a/Svelto.ECS/ECS/EntityView.cs b/Svelto.ECS/EntityView.cs similarity index 100% rename from Svelto.ECS/ECS/EntityView.cs rename to Svelto.ECS/EntityView.cs diff --git a/Svelto.ECS/ECS/EntityViewBuilder.cs b/Svelto.ECS/EntityViewBuilder.cs similarity index 100% rename from Svelto.ECS/ECS/EntityViewBuilder.cs rename to Svelto.ECS/EntityViewBuilder.cs diff --git a/Svelto.ECS/ECS/EntityViewsDB.cs b/Svelto.ECS/EntityViewsDB.cs similarity index 100% rename from Svelto.ECS/ECS/EntityViewsDB.cs rename to Svelto.ECS/EntityViewsDB.cs diff --git a/Svelto.ECS/ECS/Experimental/StructNodeCollections.cs b/Svelto.ECS/Experimental/StructNodeCollections.cs similarity index 100% rename from Svelto.ECS/ECS/Experimental/StructNodeCollections.cs rename to Svelto.ECS/Experimental/StructNodeCollections.cs diff --git a/Svelto.ECS/ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs b/Svelto.ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs similarity index 100% rename from Svelto.ECS/ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs rename to Svelto.ECS/Extensions/Unity/GenericEntityDescriptorHolder.cs diff --git a/Svelto.ECS/ECS/Extensions/Unity/UnitySumbmissionEntityViewScheduler .cs b/Svelto.ECS/Extensions/Unity/UnitySumbmissionEntityViewScheduler .cs similarity index 100% rename from Svelto.ECS/ECS/Extensions/Unity/UnitySumbmissionEntityViewScheduler .cs rename to Svelto.ECS/Extensions/Unity/UnitySumbmissionEntityViewScheduler .cs diff --git a/Svelto.ECS/Factories/IGameObjectFactory.cs b/Svelto.ECS/Factories/IGameObjectFactory.cs deleted file mode 100644 index 03f35ce..0000000 --- a/Svelto.ECS/Factories/IGameObjectFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -#if UNITY_5_3_OR_NEWER || UNITY_5 -using UnityEngine; - -namespace Svelto.Factories -{ - public interface IGameObjectFactory - { - void RegisterPrefab(GameObject prefab, string type, GameObject parent = null); - - GameObject Build(string type); - GameObject Build(GameObject prefab); - } -} -#endif \ No newline at end of file diff --git a/Svelto.ECS/Factories/IMonoBehaviourFactory.cs b/Svelto.ECS/Factories/IMonoBehaviourFactory.cs deleted file mode 100644 index f32a349..0000000 --- a/Svelto.ECS/Factories/IMonoBehaviourFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -#if UNITY_5_3_OR_NEWER || UNITY_5 - -using System; -using UnityEngine; - -namespace Svelto.Factories -{ - public interface IMonoBehaviourFactory - { - M Build(Func constructor) where M:MonoBehaviour; - } -} - -#endif \ No newline at end of file diff --git a/Svelto.ECS/ECS/GenericEntityDescriptor.cs b/Svelto.ECS/GenericEntityDescriptor.cs similarity index 100% rename from Svelto.ECS/ECS/GenericEntityDescriptor.cs rename to Svelto.ECS/GenericEntityDescriptor.cs diff --git a/Svelto.ECS/ECS/IEngine.cs b/Svelto.ECS/IEngine.cs similarity index 100% rename from Svelto.ECS/ECS/IEngine.cs rename to Svelto.ECS/IEngine.cs diff --git a/Svelto.ECS/ECS/IEnginesInterfaces.cs b/Svelto.ECS/IEnginesInterfaces.cs similarity index 83% rename from Svelto.ECS/ECS/IEnginesInterfaces.cs rename to Svelto.ECS/IEnginesInterfaces.cs index 36f9aab..c29848b 100644 --- a/Svelto.ECS/ECS/IEnginesInterfaces.cs +++ b/Svelto.ECS/IEnginesInterfaces.cs @@ -4,12 +4,12 @@ namespace Svelto.ECS { void Preallocate(int size) where T : IEntityDescriptor, new(); - void BuildEntity(int entityID, object[] implementors = null) where T:IEntityDescriptor, new(); + void BuildEntity(int entityID, object[] implementors) where T:IEntityDescriptor, new(); void BuildEntity(int entityID, IEntityDescriptorInfo entityDescriptorInfo, object[] implementors); - void BuildMetaEntity(int metaEntityID, object[] implementors = null) where T:IEntityDescriptor, new(); + void BuildMetaEntity(int metaEntityID, object[] implementors) where T:IEntityDescriptor, new(); - void BuildEntityInGroup(int entityID, int groupID, object[] implementors = null) where T:IEntityDescriptor, new(); + void BuildEntityInGroup(int entityID, int groupID, object[] implementors) where T:IEntityDescriptor, new(); void BuildEntityInGroup(int entityID, int groupID, IEntityDescriptorInfo entityDescriptor, object[] implementors); } diff --git a/Svelto.ECS/ECS/IEntityDescriptorHolder.cs b/Svelto.ECS/IEntityDescriptorHolder.cs similarity index 100% rename from Svelto.ECS/ECS/IEntityDescriptorHolder.cs rename to Svelto.ECS/IEntityDescriptorHolder.cs diff --git a/Svelto.ECS/ECS/IEntityViewsDB.cs b/Svelto.ECS/IEntityViewsDB.cs similarity index 100% rename from Svelto.ECS/ECS/IEntityViewsDB.cs rename to Svelto.ECS/IEntityViewsDB.cs diff --git a/Svelto.ECS/ECS/MixedEntityDescriptor.cs b/Svelto.ECS/MixedEntityDescriptor.cs similarity index 100% rename from Svelto.ECS/ECS/MixedEntityDescriptor.cs rename to Svelto.ECS/MixedEntityDescriptor.cs diff --git a/Svelto.ECS/ECS/MultiEntityViewsEngine.cs b/Svelto.ECS/MultiEntityViewsEngine.cs similarity index 100% rename from Svelto.ECS/ECS/MultiEntityViewsEngine.cs rename to Svelto.ECS/MultiEntityViewsEngine.cs diff --git a/Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EngineProfilerInspector.cs b/Svelto.ECS/Profiler/Editor/EngineProfiler/EngineProfilerInspector.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EngineProfilerInspector.cs rename to Svelto.ECS/Profiler/Editor/EngineProfiler/EngineProfilerInspector.cs diff --git a/Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EngineProfilerMenuItem.cs b/Svelto.ECS/Profiler/Editor/EngineProfiler/EngineProfilerMenuItem.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EngineProfilerMenuItem.cs rename to Svelto.ECS/Profiler/Editor/EngineProfiler/EngineProfilerMenuItem.cs diff --git a/Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EnginesMonitor.cs b/Svelto.ECS/Profiler/Editor/EngineProfiler/EnginesMonitor.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/EnginesMonitor.cs rename to Svelto.ECS/Profiler/Editor/EngineProfiler/EnginesMonitor.cs diff --git a/Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/ProfilerEditorLayout.cs b/Svelto.ECS/Profiler/Editor/EngineProfiler/ProfilerEditorLayout.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/Editor/EngineProfiler/ProfilerEditorLayout.cs rename to Svelto.ECS/Profiler/Editor/EngineProfiler/ProfilerEditorLayout.cs diff --git a/Svelto.ECS/ECS/Profiler/EngineInfo.cs b/Svelto.ECS/Profiler/EngineInfo.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/EngineInfo.cs rename to Svelto.ECS/Profiler/EngineInfo.cs diff --git a/Svelto.ECS/ECS/Profiler/EngineProfiler.cs b/Svelto.ECS/Profiler/EngineProfiler.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/EngineProfiler.cs rename to Svelto.ECS/Profiler/EngineProfiler.cs diff --git a/Svelto.ECS/ECS/Profiler/EngineProfilerBehaviour.cs b/Svelto.ECS/Profiler/EngineProfilerBehaviour.cs similarity index 100% rename from Svelto.ECS/ECS/Profiler/EngineProfilerBehaviour.cs rename to Svelto.ECS/Profiler/EngineProfilerBehaviour.cs diff --git a/Svelto.ECS/ECS/RemoveEntityImplementor.cs b/Svelto.ECS/RemoveEntityImplementor.cs similarity index 100% rename from Svelto.ECS/ECS/RemoveEntityImplementor.cs rename to Svelto.ECS/RemoveEntityImplementor.cs diff --git a/Svelto.ECS/ECS/Sequencer.cs b/Svelto.ECS/Sequencer.cs similarity index 100% rename from Svelto.ECS/ECS/Sequencer.cs rename to Svelto.ECS/Sequencer.cs diff --git a/Svelto.ECS/ECS/SingleEntityViewEngine.cs b/Svelto.ECS/SingleEntityViewEngine.cs similarity index 100% rename from Svelto.ECS/ECS/SingleEntityViewEngine.cs rename to Svelto.ECS/SingleEntityViewEngine.cs