Skip to content

Commit

Permalink
Merge branch 'zenject-separation'
Browse files Browse the repository at this point in the history
  • Loading branch information
grofit committed Aug 29, 2018
2 parents 70a0e4c + d237a8a commit fa28503
Show file tree
Hide file tree
Showing 58 changed files with 147 additions and 101 deletions.
33 changes: 17 additions & 16 deletions src/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,72 +56,67 @@
<Compile Include="Assets\EcsRx.Examples\AutoRegisterSystems\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\AutoRegisterSystems\Systems\DefaultViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\AutoRegisterSystems\Systems\RandomMovementSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Components\CameraFollows.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Components\CustomViewComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Components\PlayerControlledComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Systems\CameraFollowSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Systems\CustomViewSetupSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\Systems\PlayerControlSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\CustomGameObjectHandling\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\Components\CubeComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\Components\SphereComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\ViewResolvers\CubeViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectBinding\ViewResolvers\SphereViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectLinking\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectLinking\Systems\CameraFollowSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\GameObjectLinking\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\ManuallyRegisterSystems\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\ManuallyRegisterSystems\Installers\ManualInstaller.cs" />
<Compile Include="Assets\EcsRx.Examples\ManuallyRegisterSystems\Systems\DefaultViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\ManuallyRegisterSystems\Systems\RandomMovementSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\ManuallyRegisterSystems\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\ManualSystems\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\ManualSystems\Systems\ConstantOutputSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\ManualSystems\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\PluginExample\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\PluginExample\HelloWorldPlugin\components\SayHelloWorldComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\PluginExample\HelloWorldPlugin\HelloWorldPlugin.cs" />
<Compile Include="Assets\EcsRx.Examples\PluginExample\HelloWorldPlugin\systems\OutputHelloWorldSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\PluginExample\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Blueprints\SelfDestructBlueprint.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Components\SelfDestructComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Components\SpawnerComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Systems\SelfDestructionSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\Systems\SpawnSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\PooledViews\ViewResolvers\SelfDestructionViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\Components\RandomColorComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\Systems\ColorChangingSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\Systems\CubeColourChangerSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\RandomReactions\ViewResolvers\CubeViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\Components\CubeComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\Components\SphereComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\Components\TestComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\ViewResolvers\CubeViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\SceneFirstSetup\ViewResolvers\SphereViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\Components\CameraFollows.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\Components\PlayerControlledComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\Systems\CameraFollowSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\Systems\PlayerControlSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\UnityApplication.cs" />
<Compile Include="Assets\EcsRx.Examples\SimpleMovement\ViewResolvers\DefaultViewResolver.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Application.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Blueprints\PlayerBlueprint.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Components\HasName.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Components\WithHealthComponent.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Groups\PlayerGroup.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\Systems\PlayerReportingSystem.cs" />
<Compile Include="Assets\EcsRx.Examples\UsingBlueprints\UnityApplication.cs" />
<Compile Include="Assets\EcsRx\Unity\Dependencies\ZenjectDependencyContainer.cs" />
<Compile Include="Assets\EcsRx\Unity\EcsRxApplicationBehaviour.cs" />
<Compile Include="Assets\EcsRx\Unity\Dependencies\IUnityInstantiator.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\ComponentExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\EcsRxApplicationBehaviourExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\GameObjectExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\IEntityExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\ISystemExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\IZenjectExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Extensions\ViewComponentExtensions.cs" />
<Compile Include="Assets\EcsRx\Unity\Handlers\PrefabViewHandler.cs" />
<Compile Include="Assets\EcsRx\Unity\Installers\AutoBindSystemsInstaller.cs" />
<Compile Include="Assets\EcsRx\Unity\Installers\BindSystemsInNamespace.cs" />
<Compile Include="Assets\EcsRx\Unity\JSON.cs" />
<Compile Include="Assets\EcsRx\Unity\MonoBehaviours\ActiveSystemsViewer.cs" />
<Compile Include="Assets\EcsRx\Unity\MonoBehaviours\EntityCollectionManagerViewer.cs" />
Expand All @@ -131,6 +126,12 @@
<Compile Include="Assets\EcsRx\Unity\Systems\DynamicViewResolverSystem.cs" />
<Compile Include="Assets\EcsRx\Unity\Systems\PooledPrefabViewResolverSystem.cs" />
<Compile Include="Assets\EcsRx\Unity\Systems\PrefabViewResolverSystem.cs" />
<Compile Include="Assets\EcsRx\Zenject\Dependencies\ZenjectDependencyContainer.cs" />
<Compile Include="Assets\EcsRx\Zenject\EcsRxApplicationBehaviour.cs" />
<Compile Include="Assets\EcsRx\Zenject\Extensions\EcsRxApplicationBehaviourExtensions.cs" />
<Compile Include="Assets\EcsRx\Zenject\Extensions\IZenjectExtensions.cs" />
<Compile Include="Assets\EcsRx\Zenject\Installers\AutoBindSystemsInstaller.cs" />
<Compile Include="Assets\EcsRx\Zenject\Installers\BindSystemsInNamespace.cs" />
<Reference Include="Unity.PackageManagerUI.Editor">
<HintPath>C:/Code/Personal/ecsrx.unity/src/Library/ScriptAssemblies/Unity.PackageManagerUI.Editor.dll</HintPath>
</Reference>
Expand Down
9 changes: 4 additions & 5 deletions src/Assets/EcsRx.Examples/AutoRegisterSystems/Application.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Unity.Extensions;
using EcsRx.Views.Components;
using EcsRx.Zenject;

namespace EcsRx.Examples.AutoRegisterSystems
{
Expand All @@ -10,12 +10,11 @@ protected override void ApplicationStarting()
{
// You could optionally use instead of the scene based approach
// this.BindAllSystemsWithinApplicationScope();
this.RegisterAllBoundSystems();
}

protected override void ApplicationStarted()
{
this.RegisterAllBoundSystems();

{
var defaultPool = CollectionManager.GetCollection();
var entity = defaultPool.CreateEntity();
entity.AddComponents(new ViewComponent());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using EcsRx.Collections;
using EcsRx.Entities;
using EcsRx.Events;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using UnityEngine;
using Zenject;
Expand All @@ -9,7 +10,7 @@ namespace EcsRx.Examples.AutoRegisterSystems.Systems
{
public class DefaultViewResolver : PrefabViewResolverSystem
{
public DefaultViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IInstantiator instantiator)
public DefaultViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IUnityInstantiator instantiator)
: base(collectionManager, eventSystem, instantiator)
{}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using EcsRx.Examples.CustomGameObjectHandling.Components;
using EcsRx.Examples.CustomGameObjectHandling.Systems;
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using Zenject;
using EcsRx.Zenject;

namespace EcsRx.Examples.CustomGameObjectHandling
{
public class UnityApplication : EcsRxApplicationBehaviour
{
protected override void ApplicationStarted()
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
this.BindAllSystemsWithinApplicationScope();
this.RegisterAllBoundSystems();
}

protected override void ApplicationStarted()
{
var defaultPool = CollectionManager.GetCollection();
var viewEntity = defaultPool.CreateEntity();
viewEntity.AddComponents(new CustomViewComponent(), new PlayerControlledComponent(), new CameraFollowsComponent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Views.Components;
using EcsRx.Zenject;

namespace EcsRx.Examples.GameObjectBinding
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
this.BindAllSystemsWithinApplicationScope();
this.RegisterAllBoundSystems();
}

protected override void ApplicationStarted()
{
this.RegisterAllBoundSystems();
var entityCollection = CollectionManager.GetCollection();

var cubeEntity = entityCollection.CreateEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using EcsRx.Examples.GameObjectBinding.Components;
using EcsRx.Extensions;
using EcsRx.Groups;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using UnityEngine;
using Zenject;

namespace EcsRx.Examples.GameObjectBinding.ViewResolvers
{
Expand All @@ -16,7 +16,7 @@ public class CubeViewResolver : PrefabViewResolverSystem

protected override GameObject PrefabTemplate { get; } = Resources.Load<GameObject>("Cube");

public CubeViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IInstantiator instantiator)
public CubeViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IUnityInstantiator instantiator)
: base(collectionManager, eventSystem, instantiator)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using EcsRx.Examples.GameObjectBinding.Components;
using EcsRx.Extensions;
using EcsRx.Groups;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using UnityEngine;
using Zenject;
Expand All @@ -15,7 +16,8 @@ public class SphereViewResolver : PrefabViewResolverSystem
public override IGroup Group => base.Group.WithComponent<SphereComponent>();
protected override GameObject PrefabTemplate { get; } = Resources.Load<GameObject>("Sphere");

public SphereViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IInstantiator instantiator) : base(collectionManager, eventSystem, instantiator)
public SphereViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IUnityInstantiator instantiator)
: base(collectionManager, eventSystem, instantiator)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Zenject;
using UnityEngine;

namespace EcsRx.Examples.GameObjectLinking
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
this.BindAllSystemsWithinApplicationScope();
this.RegisterAllBoundSystems();
}

protected override void ApplicationStarted()
{
this.RegisterAllBoundSystems();

var defaultPool = CollectionManager.GetCollection();
var entity = defaultPool.CreateEntity();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Zenject;

namespace EcsRx.Examples.ManualSystems
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using EcsRx.Examples.ManuallyRegisterSystems.Systems;
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Views.Components;
using EcsRx.Zenject;

namespace EcsRx.Examples.ManuallyRegisterSystems
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarted()
protected override void ApplicationStarting()
{
this.RegisterSystem<DefaultViewResolver>();
this.RegisterSystem<RandomMovementSystem>();

}

protected override void ApplicationStarted()
{
var defaultPool = CollectionManager.GetCollection();

var entity = defaultPool.CreateEntity();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using EcsRx.Collections;
using EcsRx.Entities;
using EcsRx.Events;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using UnityEngine;
using Zenject;
Expand All @@ -11,7 +12,8 @@ public class DefaultViewResolver : PrefabViewResolverSystem
{
protected override GameObject PrefabTemplate { get; } = Resources.Load<GameObject>("Cube");

public DefaultViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IInstantiator instantiator) : base(collectionManager, eventSystem, instantiator)
public DefaultViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IUnityInstantiator instantiator)
: base(collectionManager, eventSystem, instantiator)
{}

protected override void OnViewCreated(IEntity entity, GameObject view)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using EcsRx.Extensions;
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Zenject;

namespace EcsRx.Examples.PluginExample
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Zenject;

namespace EcsRx.Examples.PooledViews
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
protected override void ApplicationStarting()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
using EcsRx.Examples.PooledViews.Components;
using EcsRx.Extensions;
using EcsRx.Groups;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using EcsRx.Views.Components;
using UnityEngine;
using Zenject;

namespace EcsRx.Examples.PooledViews.ViewResolvers
{
public class SelfDestructionViewResolver : PooledPrefabViewResolverSystem
{
public override IGroup Group { get; } = new Group(typeof(SelfDestructComponent), typeof(ViewComponent));

public SelfDestructionViewResolver(IInstantiator instantiator, IEntityCollectionManager collectionManager, IEventSystem eventSystem)
public SelfDestructionViewResolver(IUnityInstantiator instantiator, IEntityCollectionManager collectionManager, IEventSystem eventSystem)
: base(instantiator, collectionManager, eventSystem)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Views.Components;
using EcsRx.Zenject;

namespace EcsRx.Examples.RandomReactions
{
public class UnityApplication : EcsRxApplicationBehaviour
public class Application : EcsRxApplicationBehaviour
{
private readonly int _cubeCount = 5000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using EcsRx.Collections;
using EcsRx.Entities;
using EcsRx.Events;
using EcsRx.Unity.Dependencies;
using EcsRx.Unity.Systems;
using UnityEngine;
using Zenject;

namespace EcsRx.Examples.RandomReactions.ViewResolvers
{
Expand All @@ -16,7 +16,8 @@ public class CubeViewResolver : PrefabViewResolverSystem

protected override GameObject PrefabTemplate { get; } = Resources.Load<GameObject>("colored-cube");

public CubeViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IInstantiator instantiator) : base(collectionManager, eventSystem, instantiator)
public CubeViewResolver(IEntityCollectionManager collectionManager, IEventSystem eventSystem, IUnityInstantiator instantiator)
: base(collectionManager, eventSystem, instantiator)
{}

private void IncrementRow()
Expand Down
1 change: 1 addition & 0 deletions src/Assets/EcsRx.Examples/SceneFirstSetup/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using EcsRx.Unity;
using EcsRx.Unity.Extensions;
using EcsRx.Views.Components;
using EcsRx.Zenject;

namespace EcsRx.Examples.SceneFirstSetup
{
Expand Down
Loading

0 comments on commit fa28503

Please sign in to comment.