Skip to content

Commit

Permalink
Fixed the ResolveAll issue so systems should bind fine now
Browse files Browse the repository at this point in the history
  • Loading branch information
grofit committed Mar 19, 2020
1 parent a49a6d5 commit 2334681
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 189 deletions.
24 changes: 2 additions & 22 deletions src/Assembly-CSharp-Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -343,23 +343,11 @@
<Reference Include="EcsRx.Plugins.Views">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/EcsRx/EcsRx.Plugins.Views.dll</HintPath>
</Reference>
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Rider.Unity.Editor.Plugin.Repacked">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Mdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Pdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Rocks">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll</HintPath>
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.15f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
Expand Down Expand Up @@ -729,14 +717,6 @@
<Project>{D5B8C223-FD60-94E4-8328-3D060E400720}</Project>
<Name>Zenject-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-ReflectionBaking-Editor.csproj">
<Project>{A2779ADF-4873-DD06-56B6-BF21C8C3616D}</Project>
<Name>Zenject-ReflectionBaking-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-PoolMonitor-Editor.csproj">
<Project>{D1981D52-7C26-4A2F-54B1-3F2018FF6872}</Project>
<Name>Zenject-PoolMonitor-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject.csproj">
<Project>{3D4F1E55-9B37-CE1A-5045-137ED0A1D4C9}</Project>
<Name>Zenject</Name>
Expand Down
20 changes: 0 additions & 20 deletions src/Assembly-CSharp-firstpass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,6 @@
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Mdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Pdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Rocks">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.15f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -882,14 +870,6 @@
<Project>{D5B8C223-FD60-94E4-8328-3D060E400720}</Project>
<Name>Zenject-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-ReflectionBaking-Editor.csproj">
<Project>{A2779ADF-4873-DD06-56B6-BF21C8C3616D}</Project>
<Name>Zenject-ReflectionBaking-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-PoolMonitor-Editor.csproj">
<Project>{D1981D52-7C26-4A2F-54B1-3F2018FF6872}</Project>
<Name>Zenject-PoolMonitor-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject.csproj">
<Project>{3D4F1E55-9B37-CE1A-5045-137ED0A1D4C9}</Project>
<Name>Zenject</Name>
Expand Down
20 changes: 0 additions & 20 deletions src/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,6 @@
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Mdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Pdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Rocks">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.15f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -732,14 +720,6 @@
<Project>{D5B8C223-FD60-94E4-8328-3D060E400720}</Project>
<Name>Zenject-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-ReflectionBaking-Editor.csproj">
<Project>{A2779ADF-4873-DD06-56B6-BF21C8C3616D}</Project>
<Name>Zenject-ReflectionBaking-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject-PoolMonitor-Editor.csproj">
<Project>{D1981D52-7C26-4A2F-54B1-3F2018FF6872}</Project>
<Name>Zenject-PoolMonitor-Editor</Name>
</ProjectReference>
<ProjectReference Include="Zenject.csproj">
<Project>{3D4F1E55-9B37-CE1A-5045-137ED0A1D4C9}</Project>
<Name>Zenject</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using EcsRx.Infrastructure.Dependencies;
using EcsRx.Unity.Dependencies;
using EcsRx.Zenject.Extensions;
using UnityEngine;
using Zenject;

Expand Down Expand Up @@ -41,8 +42,8 @@ public void Bind(Type fromType, Type toType, BindingConfiguration configuration
}

// TODO: ZENJECT FIX NEEDED FOR RESOLVE ALL
//if(!string.IsNullOrEmpty(configuration.WithName))
//{ bindingSetup.WithId(configuration.WithName); }
if(!string.IsNullOrEmpty(configuration.WithName))
{ bindingSetup.WithId(configuration.WithName); }

if (configuration.ToInstance != null)
{
Expand Down Expand Up @@ -99,6 +100,6 @@ public void Unbind(Type type)
{ _container.Unbind(type); }

public IEnumerable ResolveAll(Type type)
{ return _container.ResolveAll(type); }
{ return _container.ResolveAllOf(type); }
}
}
13 changes: 13 additions & 0 deletions src/Assets/EcsRx/Zenject/Extensions/IZenjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using EcsRx.Collections;
using EcsRx.Groups;
using EcsRx.Groups.Observable;
Expand All @@ -20,5 +23,15 @@ public static IObservableGroup ResolveObservableGroup(this DiContainer container
var group = new Group(componentTypes);
return collectionManager.GetObservableGroup(group);
}

public static IEnumerable ResolveAllOf(this DiContainer container, Type type)
{
return container.AllContracts
.Where(bindingId => bindingId.Type == type)
.Select(container.Resolve);
}

public static IEnumerable<T> ResolveAllOf<T>(this DiContainer container)
{ return container.ResolveAllOf(typeof(T)).Cast<T>(); }
}
}
Binary file not shown.
16 changes: 2 additions & 14 deletions src/Zenject-Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,23 +327,11 @@
<Reference Include="EcsRx.Plugins.Views">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/EcsRx/EcsRx.Plugins.Views.dll</HintPath>
</Reference>
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Rider.Unity.Editor.Plugin.Repacked">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Mdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Pdb">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Zenject.ReflectionBaking.Mono.Cecil.Rocks">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Lib/Zenject.ReflectionBaking.Mono.Cecil.Rocks.dll</HintPath>
<Reference Include="Zenject-usage">
<HintPath>E:/Code/open-source/ecsrx/ecsrx.unity/src/Assets/Plugins/Zenject/Source/Usage/Zenject-usage.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:/Program Files/Unity/Hub/Editor/2018.4.15f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
Expand Down
Loading

0 comments on commit 2334681

Please sign in to comment.