Initial Commit

This commit is contained in:
2026-03-16 14:38:46 +02:00
commit b8f7327a21
2327 changed files with 253610 additions and 0 deletions
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a78a183f887b72e45b2ec6d77fb514d8
folderAsset: yes
timeCreated: 1461708046
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Zenject.Internal;
namespace Zenject
{
public enum ScopeTypes
{
Unset,
Transient,
Singleton
}
public enum ToChoices
{
Self,
Concrete
}
public enum InvalidBindResponses
{
Assert,
Skip
}
public enum BindingInheritanceMethods
{
None,
CopyIntoAll,
CopyDirectOnly,
MoveIntoAll,
MoveDirectOnly
}
[NoReflectionBaking]
public class BindInfo : IDisposable
{
public bool MarkAsCreationBinding;
public bool MarkAsUniqueSingleton;
public object ConcreteIdentifier;
public bool SaveProvider;
public bool OnlyBindIfNotBound;
public bool RequireExplicitScope;
public object Identifier;
public readonly List<Type> ContractTypes;
public BindingInheritanceMethods BindingInheritanceMethod;
public InvalidBindResponses InvalidBindResponse;
public bool NonLazy;
public BindingCondition Condition;
public ToChoices ToChoice;
public string ContextInfo;
public readonly List<Type> ToTypes; // Only relevant with ToChoices.Concrete
public ScopeTypes Scope;
public readonly List<TypeValuePair> Arguments;
public Action<InjectContext, object> InstantiatedCallback;
public BindInfo()
{
ContractTypes = new List<Type>();
ToTypes = new List<Type>();
Arguments = new List<TypeValuePair>();
Reset();
}
public void Dispose()
{
ZenPools.DespawnBindInfo(this);
}
[Conditional("UNITY_EDITOR")]
public void SetContextInfo(string contextInfo)
{
ContextInfo = contextInfo;
}
public void Reset()
{
MarkAsCreationBinding = true;
MarkAsUniqueSingleton = false;
ConcreteIdentifier = null;
SaveProvider = false;
OnlyBindIfNotBound = false;
RequireExplicitScope = false;
Identifier = null;
ContractTypes.Clear();
BindingInheritanceMethod = BindingInheritanceMethods.None;
InvalidBindResponse = InvalidBindResponses.Assert;
NonLazy = false;
Condition = null;
ToChoice = ToChoices.Self;
ContextInfo = null;
ToTypes.Clear();
Scope = ScopeTypes.Unset;
Arguments.Clear();
InstantiatedCallback = null;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 647e28e377c50e549b443131ce6163fc
timeCreated: 1461708051
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using ModestTree;
using Zenject.Internal;
namespace Zenject
{
[NoReflectionBaking]
public class BindStatement : IDisposable
{
readonly List<IDisposable> _disposables;
IBindingFinalizer _bindingFinalizer;
public BindStatement()
{
_disposables = new List<IDisposable>();
Reset();
}
public BindingInheritanceMethods BindingInheritanceMethod
{
get
{
AssertHasFinalizer();
return _bindingFinalizer.BindingInheritanceMethod;
}
}
public bool HasFinalizer
{
get { return _bindingFinalizer != null; }
}
public void SetFinalizer(IBindingFinalizer bindingFinalizer)
{
_bindingFinalizer = bindingFinalizer;
}
void AssertHasFinalizer()
{
if (_bindingFinalizer == null)
{
throw Assert.CreateException(
"Unfinished binding! Some required information was left unspecified.");
}
}
public void AddDisposable(IDisposable disposable)
{
_disposables.Add(disposable);
}
public BindInfo SpawnBindInfo()
{
var bindInfo = ZenPools.SpawnBindInfo();
AddDisposable(bindInfo);
return bindInfo;
}
public void FinalizeBinding(DiContainer container)
{
AssertHasFinalizer();
_bindingFinalizer.FinalizeBinding(container);
}
public void Reset()
{
_bindingFinalizer = null;
for (int i = 0; i < _disposables.Count; i++)
{
_disposables[i].Dispose();
}
_disposables.Clear();
}
public void Dispose()
{
ZenPools.DespawnStatement(this);
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 63a8f1068d150404f820c8cc9057dbc8
timeCreated: 1535868299
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryBindInfo
{
public FactoryBindInfo(Type factoryType)
{
FactoryType = factoryType;
Arguments = new List<TypeValuePair>();
}
public Type FactoryType
{
get; private set;
}
public Func<DiContainer, IProvider> ProviderFunc
{
get; set;
}
public List<TypeValuePair> Arguments
{
get;
set;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e69b2b4566e331e44a9f92e4e309816a
timeCreated: 1484520532
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,93 @@
#if !NOT_UNITY3D
using System;
using UnityEngine;
namespace Zenject
{
[NoReflectionBaking]
public class GameObjectCreationParameters
{
public string Name
{
get;
set;
}
public string GroupName
{
get;
set;
}
public Transform ParentTransform
{
get;
set;
}
public Func<InjectContext, Transform> ParentTransformGetter
{
get;
set;
}
public Vector3? Position
{
get;
set;
}
public Quaternion? Rotation
{
get;
set;
}
public static readonly GameObjectCreationParameters Default = new GameObjectCreationParameters();
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hash = 17;
hash = hash * 29 + (Name == null ? 0 : Name.GetHashCode());
hash = hash * 29 + (GroupName == null ? 0 : GroupName.GetHashCode());
hash = hash * 29 + (ParentTransform == null ? 0 : ParentTransform.GetHashCode());
hash = hash * 29 + (ParentTransformGetter == null ? 0 : ParentTransformGetter.GetHashCode());
hash = hash * 29 + (!Position.HasValue ? 0 : Position.Value.GetHashCode());
hash = hash * 29 + (!Rotation.HasValue ? 0 : Rotation.Value.GetHashCode());
return hash;
}
}
public override bool Equals(object other)
{
if (other is GameObjectCreationParameters)
{
GameObjectCreationParameters otherId = (GameObjectCreationParameters)other;
return otherId == this;
}
return false;
}
public bool Equals(GameObjectCreationParameters that)
{
return this == that;
}
public static bool operator ==(GameObjectCreationParameters left, GameObjectCreationParameters right)
{
return Equals(left.Name, right.Name)
&& Equals(left.GroupName, right.GroupName);
}
public static bool operator !=(GameObjectCreationParameters left, GameObjectCreationParameters right)
{
return !left.Equals(right);
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2b708f7f76ea5574e9a39b60cc5a8238
timeCreated: 1477163090
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,35 @@
namespace Zenject
{
public enum PoolExpandMethods
{
OneAtATime,
Double,
Disabled
}
[NoReflectionBaking]
public class MemoryPoolBindInfo
{
public MemoryPoolBindInfo()
{
ExpandMethod = PoolExpandMethods.OneAtATime;
MaxSize = int.MaxValue;
}
public PoolExpandMethods ExpandMethod
{
get; set;
}
public int InitialSize
{
get; set;
}
public int MaxSize
{
get; set;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3f8798fbf64bca945a7be04615c08c4f
timeCreated: 1485711462
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3e0d343c02f9d0a488a62abffae00ceb
folderAsset: yes
timeCreated: 1461708046
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,106 @@
using System.Collections.Generic;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ArgConditionCopyNonLazyBinder : InstantiateCallbackConditionCopyNonLazyBinder
{
public ArgConditionCopyNonLazyBinder(BindInfo bindInfo)
: base(bindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<T>(T param)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<TParam1, TParam2>(TParam1 param1, TParam2 param2)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<TParam1, TParam2, TParam3>(
TParam1 param1, TParam2 param2, TParam3 param3)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<TParam1, TParam2, TParam3, TParam4>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<TParam1, TParam2, TParam3, TParam4, TParam5>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param5));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
{
BindInfo.Arguments.Clear();
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param1));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param2));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param3));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param4));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param5));
BindInfo.Arguments.Add(InjectUtil.CreateTypePair(param6));
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArguments(object[] args)
{
BindInfo.Arguments.Clear();
for (int i = 0; i < args.Length; i++)
{
var arg = args[i];
Assert.IsNotNull(arg,
"Cannot include null values when creating a zenject argument list because zenject has no way of deducing the type from a null value. If you want to allow null, use the Explicit form.");
BindInfo.Arguments.Add(
new TypeValuePair(arg.GetType(), arg));
}
return this;
}
public InstantiateCallbackConditionCopyNonLazyBinder WithArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
BindInfo.Arguments.Clear();
foreach (var arg in extraArgs)
{
BindInfo.Arguments.Add(arg);
}
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d0eff25a90fc7a4479dbb9a1f74dddc2
timeCreated: 1483833202
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b3b29de51c8625443984cbd926505d00
folderAsset: yes
timeCreated: 1461708047
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteBinderGeneric<TContract> : FromBinderGeneric<TContract>
{
public ConcreteBinderGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
ToSelf();
}
// Note that this is the default, so not necessary to call
public FromBinderGeneric<TContract> ToSelf()
{
Assert.IsEqual(BindInfo.ToChoice, ToChoices.Self);
BindInfo.RequireExplicitScope = true;
SubFinalizer = new ScopableBindingFinalizer(
BindInfo, (container, type) => new TransientProvider(
type, container, BindInfo.Arguments,
BindInfo.ContextInfo, BindInfo.ConcreteIdentifier,
BindInfo.InstantiatedCallback));
return this;
}
public FromBinderGeneric<TConcrete> To<TConcrete>()
where TConcrete : TContract
{
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.Add(typeof(TConcrete));
return new FromBinderGeneric<TConcrete>(
BindContainer, BindInfo, BindStatement);
}
public FromBinderNonGeneric To(params Type[] concreteTypes)
{
return To((IEnumerable<Type>)concreteTypes);
}
public FromBinderNonGeneric To(IEnumerable<Type> concreteTypes)
{
BindingUtil.AssertIsDerivedFromTypes(
concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse);
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(concreteTypes);
return new FromBinderNonGeneric(
BindContainer, BindInfo, BindStatement);
}
#if !(UNITY_WSA && ENABLE_DOTNET)
public FromBinderNonGeneric To(
Action<ConventionSelectTypesBinder> generator)
{
var bindInfo = new ConventionBindInfo();
// Automatically filter by the given contract types
bindInfo.AddTypeFilter(
concreteType => BindInfo.ContractTypes.All(contractType => concreteType.DerivesFromOrEqual(contractType)));
generator(new ConventionSelectTypesBinder(bindInfo));
return To(bindInfo.ResolveTypes());
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 62ec581e8d820a74797d1dabf19d85c3
timeCreated: 1461708051
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteBinderNonGeneric : FromBinderNonGeneric
{
public ConcreteBinderNonGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
ToSelf();
}
// Note that this is the default, so not necessary to call
public FromBinderNonGeneric ToSelf()
{
Assert.IsEqual(BindInfo.ToChoice, ToChoices.Self);
BindInfo.RequireExplicitScope = true;
SubFinalizer = new ScopableBindingFinalizer(
BindInfo, (container, type) => new TransientProvider(
type, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier,
BindInfo.InstantiatedCallback));
return this;
}
public FromBinderNonGeneric To<TConcrete>()
{
return To(typeof(TConcrete));
}
public FromBinderNonGeneric To(params Type[] concreteTypes)
{
return To((IEnumerable<Type>)concreteTypes);
}
public FromBinderNonGeneric To(IEnumerable<Type> concreteTypes)
{
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(concreteTypes);
if (BindInfo.ToTypes.Count > 1 && BindInfo.ContractTypes.Count > 1)
{
// Be more lenient in this case to behave similar to convention based bindings
BindInfo.InvalidBindResponse = InvalidBindResponses.Skip;
}
else
{
BindingUtil.AssertIsDerivedFromTypes(concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse);
}
return this;
}
#if !(UNITY_WSA && ENABLE_DOTNET)
public FromBinderNonGeneric To(
Action<ConventionSelectTypesBinder> generator)
{
var bindInfo = new ConventionBindInfo();
// This is nice because it allows us to do things like Bind(all interfaces).To(specific types)
// instead of having to do Bind(all interfaces).To(specific types that inherit from one of these interfaces)
BindInfo.InvalidBindResponse = InvalidBindResponses.Skip;
generator(new ConventionSelectTypesBinder(bindInfo));
BindInfo.ToChoice = ToChoices.Concrete;
BindInfo.ToTypes.Clear();
BindInfo.ToTypes.AddRange(bindInfo.ResolveTypes());
return this;
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b04935d23b1499e42a242d63a3fe248b
timeCreated: 1461708052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteIdBinderGeneric<TContract> : ConcreteBinderGeneric<TContract>
{
public ConcreteIdBinderGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
}
public ConcreteBinderGeneric<TContract> WithId(object identifier)
{
BindInfo.Identifier = identifier;
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 358cdf402ef00ff40ac81f3bbe7018f0
timeCreated: 1463318690
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteIdBinderNonGeneric : ConcreteBinderNonGeneric
{
public ConcreteIdBinderNonGeneric(
DiContainer bindContainer, BindInfo bindInfo,
BindStatement bindStatement)
: base(bindContainer, bindInfo, bindStatement)
{
}
public ConcreteBinderNonGeneric WithId(object identifier)
{
BindInfo.Identifier = identifier;
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1251d518904c9574897614d756f76756
timeCreated: 1463318690
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
namespace Zenject
{
[NoReflectionBaking]
public class ConcreteIdArgConditionCopyNonLazyBinder : ArgConditionCopyNonLazyBinder
{
public ConcreteIdArgConditionCopyNonLazyBinder(BindInfo bindInfo)
: base(bindInfo)
{
}
public ArgConditionCopyNonLazyBinder WithConcreteId(object id)
{
BindInfo.ConcreteIdentifier = id;
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 5803a20c252d8ae4498e79e8b3bb09e0
timeCreated: 1523257672
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
using System;
using System.Linq;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConditionCopyNonLazyBinder : CopyNonLazyBinder
{
public ConditionCopyNonLazyBinder(BindInfo bindInfo)
: base(bindInfo)
{
}
public CopyNonLazyBinder When(BindingCondition condition)
{
BindInfo.Condition = condition;
return this;
}
public CopyNonLazyBinder WhenInjectedIntoInstance(object instance)
{
return When(r => ReferenceEquals(r.ObjectInstance, instance));
}
public CopyNonLazyBinder WhenInjectedInto(params Type[] targets)
{
return When(r => targets.Where(x => r.ObjectType != null && r.ObjectType.DerivesFromOrEqual(x)).Any());
}
public CopyNonLazyBinder WhenInjectedInto<T>()
{
return When(r => r.ObjectType != null && r.ObjectType.DerivesFromOrEqual(typeof(T)));
}
public CopyNonLazyBinder WhenNotInjectedInto<T>()
{
return When(r => r.ObjectType == null || !r.ObjectType.DerivesFromOrEqual(typeof(T)));
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a638543bf618ed94fb418f48d9ea9329
timeCreated: 1483833202
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cecd58a5468ced54aabe6cc4d2eed9a8
folderAsset: yes
timeCreated: 1462127452
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,72 @@
#if !(UNITY_WSA && ENABLE_DOTNET)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Zenject
{
[NoReflectionBaking]
public class ConventionAssemblySelectionBinder
{
public ConventionAssemblySelectionBinder(ConventionBindInfo bindInfo)
{
BindInfo = bindInfo;
}
protected ConventionBindInfo BindInfo
{
get;
private set;
}
public void FromAllAssemblies()
{
// Do nothing
// This is the default
}
public void FromAssemblyContaining<T>()
{
FromAssembliesContaining(typeof(T));
}
public void FromAssembliesContaining(params Type[] types)
{
FromAssembliesContaining((IEnumerable<Type>)types);
}
public void FromAssembliesContaining(IEnumerable<Type> types)
{
FromAssemblies(types.Select(t => t.Assembly).Distinct());
}
public void FromThisAssembly()
{
FromAssemblies(Assembly.GetCallingAssembly());
}
public void FromAssembly(Assembly assembly)
{
FromAssemblies(assembly);
}
public void FromAssemblies(params Assembly[] assemblies)
{
FromAssemblies((IEnumerable<Assembly>)assemblies);
}
public void FromAssemblies(IEnumerable<Assembly> assemblies)
{
BindInfo.AddAssemblyFilter(assembly => assemblies.Contains(assembly));
}
public void FromAssembliesWhere(Func<Assembly, bool> predicate)
{
BindInfo.AddAssemblyFilter(predicate);
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5229c122d45b5634ebd4b9bccee749ac
timeCreated: 1462127487
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
#if !(UNITY_WSA && ENABLE_DOTNET)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Zenject
{
[NoReflectionBaking]
public class ConventionBindInfo
{
readonly List<Func<Type, bool>> _typeFilters = new List<Func<Type, bool>>();
readonly List<Func<Assembly, bool>> _assemblyFilters = new List<Func<Assembly, bool>>();
#if ZEN_MULTITHREADING
readonly object _locker = new object();
#endif
static Dictionary<Assembly, Type[]> _assemblyTypeCache = new Dictionary<Assembly, Type[]>();
public void AddAssemblyFilter(Func<Assembly, bool> predicate)
{
_assemblyFilters.Add(predicate);
}
public void AddTypeFilter(Func<Type, bool> predicate)
{
_typeFilters.Add(predicate);
}
IEnumerable<Assembly> GetAllAssemblies()
{
// This seems fast enough that it's not worth caching
// We also want to allow dynamically loading assemblies
return AppDomain.CurrentDomain.GetAssemblies();
}
bool ShouldIncludeAssembly(Assembly assembly)
{
return _assemblyFilters.All(predicate => predicate(assembly));
}
bool ShouldIncludeType(Type type)
{
return _typeFilters.All(predicate => predicate(type));
}
Type[] GetTypes(Assembly assembly)
{
Type[] types;
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
// This is much faster than calling assembly.GetTypes() every time
if (!_assemblyTypeCache.TryGetValue(assembly, out types))
{
types = assembly.GetTypes();
_assemblyTypeCache[assembly] = types;
}
}
return types;
}
public List<Type> ResolveTypes()
{
return GetAllAssemblies()
.Where(ShouldIncludeAssembly)
.SelectMany(assembly => GetTypes(assembly))
.Where(ShouldIncludeType).ToList();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f1e908965ce63ab40b271724cb5490aa
timeCreated: 1462127523
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,139 @@
#if !(UNITY_WSA && ENABLE_DOTNET)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class ConventionFilterTypesBinder : ConventionAssemblySelectionBinder
{
public ConventionFilterTypesBinder(ConventionBindInfo bindInfo)
: base(bindInfo)
{
}
public ConventionFilterTypesBinder DerivingFromOrEqual<T>()
{
return DerivingFromOrEqual(typeof(T));
}
public ConventionFilterTypesBinder DerivingFromOrEqual(Type parentType)
{
BindInfo.AddTypeFilter(type => type.DerivesFromOrEqual(parentType));
return this;
}
public ConventionFilterTypesBinder DerivingFrom<T>()
{
return DerivingFrom(typeof(T));
}
public ConventionFilterTypesBinder DerivingFrom(Type parentType)
{
BindInfo.AddTypeFilter(type => type.DerivesFrom(parentType));
return this;
}
public ConventionFilterTypesBinder WithAttribute<T>()
where T : Attribute
{
return WithAttribute(typeof(T));
}
public ConventionFilterTypesBinder WithAttribute(Type attribute)
{
Assert.That(attribute.DerivesFrom<Attribute>());
BindInfo.AddTypeFilter(t => t.HasAttribute(attribute));
return this;
}
public ConventionFilterTypesBinder WithoutAttribute<T>()
where T : Attribute
{
return WithoutAttribute(typeof(T));
}
public ConventionFilterTypesBinder WithoutAttribute(Type attribute)
{
Assert.That(attribute.DerivesFrom<Attribute>());
BindInfo.AddTypeFilter(t => !t.HasAttribute(attribute));
return this;
}
public ConventionFilterTypesBinder WithAttributeWhere<T>(Func<T, bool> predicate)
where T : Attribute
{
BindInfo.AddTypeFilter(t => t.HasAttribute<T>() && t.AllAttributes<T>().All(predicate));
return this;
}
public ConventionFilterTypesBinder Where(Func<Type, bool> predicate)
{
BindInfo.AddTypeFilter(predicate);
return this;
}
public ConventionFilterTypesBinder InNamespace(string ns)
{
return InNamespaces(ns);
}
public ConventionFilterTypesBinder InNamespaces(params string[] namespaces)
{
return InNamespaces((IEnumerable<string>)namespaces);
}
public ConventionFilterTypesBinder InNamespaces(IEnumerable<string> namespaces)
{
BindInfo.AddTypeFilter(t => namespaces.Any(n => IsInNamespace(t, n)));
return this;
}
public ConventionFilterTypesBinder WithSuffix(string suffix)
{
BindInfo.AddTypeFilter(t => t.Name.EndsWith(suffix));
return this;
}
public ConventionFilterTypesBinder WithPrefix(string prefix)
{
BindInfo.AddTypeFilter(t => t.Name.StartsWith(prefix));
return this;
}
public ConventionFilterTypesBinder MatchingRegex(string pattern)
{
return MatchingRegex(pattern, RegexOptions.None);
}
public ConventionFilterTypesBinder MatchingRegex(string pattern, RegexOptions options)
{
return MatchingRegex(new Regex(pattern, options));
}
public ConventionFilterTypesBinder MatchingRegex(Regex regex)
{
BindInfo.AddTypeFilter(t => regex.IsMatch(t.Name));
return this;
}
static bool IsInNamespace(Type type, string requiredNs)
{
var actualNs = type.Namespace ?? "";
if (requiredNs.Length > actualNs.Length)
{
return false;
}
return actualNs.StartsWith(requiredNs)
&& (actualNs.Length == requiredNs.Length || actualNs[requiredNs.Length] == '.');
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fc3e9c89606ca52458403153ad0d9b3e
timeCreated: 1462127525
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
#if !(UNITY_WSA && ENABLE_DOTNET)
namespace Zenject
{
[NoReflectionBaking]
public class ConventionSelectTypesBinder
{
readonly ConventionBindInfo _bindInfo;
public ConventionSelectTypesBinder(ConventionBindInfo bindInfo)
{
_bindInfo = bindInfo;
}
ConventionFilterTypesBinder CreateNextBinder()
{
return new ConventionFilterTypesBinder(_bindInfo);
}
public ConventionFilterTypesBinder AllTypes()
{
// Do nothing (this is the default)
return CreateNextBinder();
}
public ConventionFilterTypesBinder AllClasses()
{
_bindInfo.AddTypeFilter(t => t.IsClass);
return CreateNextBinder();
}
public ConventionFilterTypesBinder AllNonAbstractClasses()
{
_bindInfo.AddTypeFilter(t => t.IsClass && !t.IsAbstract);
return CreateNextBinder();
}
public ConventionFilterTypesBinder AllAbstractClasses()
{
_bindInfo.AddTypeFilter(t => t.IsClass && t.IsAbstract);
return CreateNextBinder();
}
public ConventionFilterTypesBinder AllInterfaces()
{
_bindInfo.AddTypeFilter(t => t.IsInterface);
return CreateNextBinder();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 05d17b3e7f09bc44f8be86e01642ee8d
timeCreated: 1462127469
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
using System.Collections.Generic;
namespace Zenject
{
[NoReflectionBaking]
public class CopyNonLazyBinder : NonLazyBinder
{
List<BindInfo> _secondaryBindInfos;
public CopyNonLazyBinder(BindInfo bindInfo)
: base(bindInfo)
{
}
// This is used in cases where you have multiple bindings that depend on each other so should
// be inherited together (eg. FromIFactory)
internal void AddSecondaryCopyBindInfo(BindInfo bindInfo)
{
if (_secondaryBindInfos == null)
{
_secondaryBindInfos = new List<BindInfo>();
}
_secondaryBindInfos.Add(bindInfo);
}
public NonLazyBinder CopyIntoAllSubContainers()
{
SetInheritanceMethod(BindingInheritanceMethods.CopyIntoAll);
return this;
}
// Only copy the binding into children and not grandchildren
public NonLazyBinder CopyIntoDirectSubContainers()
{
SetInheritanceMethod(BindingInheritanceMethods.CopyDirectOnly);
return this;
}
// Do not apply the binding on the current container
public NonLazyBinder MoveIntoAllSubContainers()
{
SetInheritanceMethod(BindingInheritanceMethods.MoveIntoAll);
return this;
}
// Do not apply the binding on the current container
public NonLazyBinder MoveIntoDirectSubContainers()
{
SetInheritanceMethod(BindingInheritanceMethods.MoveDirectOnly);
return this;
}
void SetInheritanceMethod(BindingInheritanceMethods method)
{
BindInfo.BindingInheritanceMethod = method;
if (_secondaryBindInfos != null)
{
foreach (var secondaryBindInfo in _secondaryBindInfos)
{
secondaryBindInfo.BindingInheritanceMethod = method;
}
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6cf2e5d7a11cf6c418960ff59949b5fa
timeCreated: 1483833202
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
namespace Zenject
{
[NoReflectionBaking]
public class DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder : ScopeConcreteIdArgConditionCopyNonLazyBinder
{
public DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder(
SubContainerCreatorBindInfo subContainerBindInfo, BindInfo bindInfo)
: base(bindInfo)
{
SubContainerCreatorBindInfo = subContainerBindInfo;
}
protected SubContainerCreatorBindInfo SubContainerCreatorBindInfo
{
get; private set;
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder WithDefaultGameObjectParent(string defaultParentName)
{
SubContainerCreatorBindInfo.DefaultParentName = defaultParentName;
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: f6b4e164706b85c408cd7e8f28266747
timeCreated: 1535254660
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 580f48a64cf849041937c7ad570aaf89
folderAsset: yes
timeCreated: 1461708047
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3fd0e848e31df144fbbeab59a2c137e2
folderAsset: yes
timeCreated: 1528637818
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TContract> : FactoryToChoiceBinder<TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments<TParam1, TParam2>(TParam1 param1, TParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments<TParam1, TParam2, TParam3>(
TParam1 param1, TParam2 param2, TParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments<TParam1, TParam2, TParam3, TParam4>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments<TParam1, TParam2, TParam3, TParam4, TParam5>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ca3197650e9628a45b99e79b8dea27d9
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TContract> : FactoryToChoiceBinder<TParam1, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: a37e124df695f644e87579f08ea443f7
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 614bb4e31afa5154487c94e128e9461a
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3b450191ad6422c4f841a99cdf3d108a
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TParam3, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 667d9c959f8ba004f86c8202d637f9ce
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ce44f168dd48e1442b43a43c925abc47
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: f3c4d5776729d2d4abae523dd6dce595
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryArgumentsToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> : FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>
{
public FactoryArgumentsToChoiceBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, bindInfo, factoryBindInfo)
{
}
// We use generics instead of params object[] so that we preserve type info
// So that you can for example pass in a variable that is null and the type info will
// still be used to map null on to the correct field
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<T>(T param)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2>(TFactoryParam1 param1, TFactoryParam2 param2)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments<TFactoryParam1, TFactoryParam2, TFactoryParam3, TFactoryParam4, TFactoryParam5, TFactoryParam6>(
TFactoryParam1 param1, TFactoryParam2 param2, TFactoryParam3 param3, TFactoryParam4 param4, TFactoryParam5 param5, TFactoryParam6 param6)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgListExplicit(param1, param2, param3, param4, param5, param6);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArguments(object[] args)
{
FactoryBindInfo.Arguments = InjectUtil.CreateArgList(args);
return this;
}
public FactoryToChoiceBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> WithFactoryArgumentsExplicit(IEnumerable<TypeValuePair> extraArgs)
{
FactoryBindInfo.Arguments = extraArgs.ToList();
return this;
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 22836272211e07a459544765e2e7c098
timeCreated: 1528637818
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: aa754ab1fdfa8714fb6eddd17108e5c6
folderAsset: yes
timeCreated: 1461708047
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TContract> : FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromResolveGetter<TObj>(Func<TObj, TContract> method)
{
return FromResolveGetter<TObj>(null, method);
}
public ConditionCopyNonLazyBinder FromResolveGetter<TObj>(
object subIdentifier, Func<TObj, TContract> method)
{
return FromResolveGetter<TObj>(subIdentifier, method, InjectSources.Any);
}
public ConditionCopyNonLazyBinder FromResolveGetter<TObj>(
object subIdentifier, Func<TObj, TContract> method, InjectSources source)
{
FactoryBindInfo.ProviderFunc =
(container) => new GetterProvider<TObj, TContract>(subIdentifier, method, container, source, false);
return this;
}
public ConditionCopyNonLazyBinder FromMethod(Func<DiContainer, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ArgConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
#if !NOT_UNITY3D
public ConditionCopyNonLazyBinder FromComponentInHierarchy(
bool includeInactive = true)
{
BindingUtil.AssertIsInterfaceOrComponent(ContractType);
return FromMethod(_ =>
{
var res = BindContainer.Resolve<Context>().GetRootGameObjects()
.Select(x => x.GetComponentInChildren<TContract>(includeInactive))
.Where(x => x != null).FirstOrDefault();
Assert.IsNotNull(res,
"Could not find component '{0}' through FromComponentInHierarchy factory binding", typeof(TContract));
return res;
});
}
#endif
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder0Extensions
{
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TContract, TMemoryPool>(
this FactoryFromBinder<TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<IMemoryPool>
where TMemoryPool : MemoryPool<IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>().WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TContract>(
this FactoryFromBinder<TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TContract>(
this FactoryFromBinder<TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TContract, PoolableMemoryPool<IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TContract>(
this FactoryFromBinder<TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TContract>(
this FactoryFromBinder<TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TContract, MonoPoolableMemoryPool<IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TContract, TMemoryPool>(
this FactoryFromBinder<TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<IMemoryPool>
where TMemoryPool : MemoryPool<IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromIFactory<TContract>(
this FactoryFromBinder<TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fd0f7feaafd2cc44da895162de285da7
timeCreated: 1461708055
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TContract> : FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(Func<DiContainer, TParam1, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder1Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TContract>(
this FactoryFromBinder<TParam1, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TContract>(
this FactoryFromBinder<TParam1, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TContract>(
this FactoryFromBinder<TParam1, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TContract, PoolableMemoryPool<TParam1, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TContract>(
this FactoryFromBinder<TParam1, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TContract>(
this FactoryFromBinder<TParam1, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TContract, MonoPoolableMemoryPool<TParam1, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>().WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 57ab0b3d05763f14fb530d07a5acd481
timeCreated: 1461708050
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
using System;
#if !NOT_UNITY3D
#endif
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>
: FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Func<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> method)
{
ProviderFunc =
container => new MethodProviderWithContainer<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>
{
return FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public ArgConditionCopyNonLazyBinder FromIFactory(
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
CreateIFactoryBinder<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>>(out factoryId));
ProviderFunc =
container => { return new IFactoryProvider<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(BindInfo);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d835e30b6131d754e892d6f397e9921a
timeCreated: 1507270780
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TContract> : FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(Func<DiContainer, TParam1, TParam2, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TParam2, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TParam2, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder2Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TParam2, TContract>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TParam2, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TParam2, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TContract>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TContract>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TContract, PoolableMemoryPool<TParam1, TParam2, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TContract>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TParam2, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TContract>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TContract, MonoPoolableMemoryPool<TParam1, TParam2, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>()
.WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TParam2, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a36f88760754c1c498ab3270dfb88b72
timeCreated: 1461708052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TParam3, TContract> : FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(Func<DiContainer, TParam1, TParam2, TParam3, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TParam2, TParam3, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TParam3, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TParam3, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder3Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TParam2, TParam3, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TParam3, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TParam2, TParam3, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TParam2, TParam3, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract, PoolableMemoryPool<TParam1, TParam2, TParam3, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract, MonoPoolableMemoryPool<TParam1, TParam2, TParam3, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>()
.WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TParam2, TParam3, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4eb3a4d5d01c55748b43f48a1da3c7b6
timeCreated: 1461708050
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> : FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Func<DiContainer, TParam1, TParam2, TParam3, TParam4, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TParam2, TParam3, TParam4, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TParam3, TParam4, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder4Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TParam2, TParam3, TParam4, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TParam3, TParam4, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TParam2, TParam3, TParam4, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TParam2, TParam3, TParam4, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract, PoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract, MonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>()
.WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TParam2, TParam3, TParam4, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e67ee9caa78de914a9c727a607c3d8c0
timeCreated: 1461708054
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>
: FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Func<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder5Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, PoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, MonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, IMemoryPool, TContract>
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>()
.WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TParam2, TParam3, TParam4, TParam5, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 901200be3b8d1cc40876aa50a03103b8
timeCreated: 1461708052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
#if !NOT_UNITY3D
using UnityEngine;
#endif
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>
: FactoryFromBinderBase
{
public FactoryFromBinder(
DiContainer container, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(container, typeof(TContract), bindInfo, factoryBindInfo)
{
}
public ConditionCopyNonLazyBinder FromMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Func<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> method)
{
ProviderFunc =
(container) => new MethodProviderWithContainer<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(method);
return this;
}
// Shortcut for FromIFactory and also for backwards compatibility
public ConditionCopyNonLazyBinder FromFactory<TSubFactory>()
where TSubFactory : IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>
{
return this.FromIFactory(x => x.To<TSubFactory>().AsCached());
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> FromSubContainerResolve()
{
return FromSubContainerResolve(null);
}
public FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> FromSubContainerResolve(object subIdentifier)
{
return new FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
BindContainer, BindInfo, FactoryBindInfo, subIdentifier);
}
}
// These methods have to be extension methods for the UWP build (with .NET backend) to work correctly
// When these are instance methods it takes a really long time then fails with StackOverflowException
public static class FactoryFromBinder6Extensions
{
public static ArgConditionCopyNonLazyBinder FromIFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder,
Action<ConcreteBinderGeneric<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>>> factoryBindGenerator)
{
Guid factoryId;
factoryBindGenerator(
fromBinder.CreateIFactoryBinder<IFactory<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>>(out factoryId));
fromBinder.ProviderFunc =
(container) => { return new IFactoryProvider<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(container, factoryId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, PoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool, TContract>>(poolBindGenerator);
}
#if !NOT_UNITY3D
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
{
return fromBinder.FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromMonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : Component, IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, MonoPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool, TContract>>(poolBindGenerator);
}
#endif
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool, TContract>
{
return fromBinder.FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, TMemoryPool>(x => {});
}
public static ArgConditionCopyNonLazyBinder FromPoolableMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, TMemoryPool>(
this FactoryFromBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract> fromBinder,
Action<MemoryPoolInitialSizeMaxSizeBinder<TContract>> poolBindGenerator)
// Unfortunately we have to pass the same contract in again to satisfy the generic
// constraints below
where TContract : IPoolable<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool>
where TMemoryPool : MemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, IMemoryPool, TContract>
{
Assert.IsEqual(typeof(TContract), typeof(TContract));
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
var poolId = Guid.NewGuid();
// Important to use NoFlush otherwise the binding will be finalized early
var binder = fromBinder.BindContainer.BindMemoryPoolCustomInterfaceNoFlush<TContract, TMemoryPool, TMemoryPool>()
.WithId(poolId);
// Always make it non lazy by default in case the user sets an InitialSize
binder.NonLazy();
poolBindGenerator(binder);
fromBinder.ProviderFunc =
(container) => { return new PoolableMemoryPoolProvider<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract, TMemoryPool>(container, poolId); };
return new ArgConditionCopyNonLazyBinder(fromBinder.BindInfo);
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: b79f4e548e208b1418f013d2fdb0e076
timeCreated: 1528529860
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 17d1fc460074cfc419ffecab2a7e97e8
folderAsset: yes
timeCreated: 1461708047
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,143 @@
using System;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TContract>
: FactorySubContainerBinderBase<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action<DiContainer> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(Action<DiContainer> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter, Action<DiContainer> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab, Action<DiContainer> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath, Action<DiContainer> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
[System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(UnityEngine.Object prefab)
{
return ByNewContextPrefab(prefab);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(UnityEngine.Object prefab)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefab(
container,
new PrefabProvider(prefab),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
[System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(string resourcePath)
{
return ByNewContextPrefabResource(resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefab(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3c12d5eb6ac4cc8449986d020ef27e4f
timeCreated: 1461708049
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,97 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action<DiContainer, TParam1> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
Action<DiContainer, TParam1> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter, Action<DiContainer, TParam1> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab, Action<DiContainer, TParam1> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath, Action<DiContainer, TParam1> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b119fe818c4bae143ab8f9a4f2a1b0fd
timeCreated: 1461708053
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>( container,
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>( container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>( container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>( container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3b6136acd174dfc4d9b9d3f2b9e110e4
timeCreated: 1507270779
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,97 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action<DiContainer, TParam1, TParam2> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
Action<DiContainer, TParam1, TParam2> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter, Action<DiContainer, TParam1, TParam2> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab, Action<DiContainer, TParam1, TParam2> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath, Action<DiContainer, TParam1, TParam2> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5f32bdc495dbe204caab18bace045515
timeCreated: 1461708050
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,98 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TParam3, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action<DiContainer, TParam1, TParam2, TParam3> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2, TParam3>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
Action<DiContainer, TParam1, TParam2, TParam3> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2, TParam3>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter, Action<DiContainer, TParam1, TParam2, TParam3> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab, Action<DiContainer, TParam1, TParam2, TParam3> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath, Action<DiContainer, TParam1, TParam2, TParam3> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fdb97e2862ca0a24e8f87c081ea05727
timeCreated: 1461708055
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,116 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2, TParam3, TParam4>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2, TParam3, TParam4>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b0f061434819b334289a066ab685ab37
timeCreated: 1461708053
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,115 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2, TParam3, TParam4, TParam5>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2, TParam3, TParam4, TParam5>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e562a021e16d4a2418f6c47de105c64e
timeCreated: 1461708054
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,115 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinder<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TContract>
: FactorySubContainerBinderWithParams<TContract>
{
public FactorySubContainerBinder(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> installerMethod)
{
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
container, subcontainerBindInfo, installerMethod), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod(
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
container, gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
Func<InjectContext, UnityEngine.Object> prefabGetter,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> installerMethod)
{
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod(
UnityEngine.Object prefab,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> installerMethod)
{
BindingUtil.AssertIsValidPrefab(prefab);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod(
string resourcePath,
#if !NET_4_6
ModestTree.Util.
#endif
Action<DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> installerMethod)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerMethod), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 6bc525cf91bd29644ab941902ab4a8d2
timeCreated: 1528529860
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,179 @@
using System;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinderBase<TContract>
{
public FactorySubContainerBinderBase(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
{
FactoryBindInfo = factoryBindInfo;
SubIdentifier = subIdentifier;
BindInfo = bindInfo;
BindContainer = bindContainer;
// Reset so we get errors if we end here
factoryBindInfo.ProviderFunc = null;
}
protected DiContainer BindContainer
{
get; private set;
}
protected FactoryBindInfo FactoryBindInfo
{
get; private set;
}
protected Func<DiContainer, IProvider> ProviderFunc
{
get { return FactoryBindInfo.ProviderFunc; }
set { FactoryBindInfo.ProviderFunc = value; }
}
protected BindInfo BindInfo
{
get;
private set;
}
protected object SubIdentifier
{
get;
private set;
}
protected Type ContractType
{
get { return typeof(TContract); }
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstaller<TInstaller>()
where TInstaller : InstallerBase
{
return ByInstaller(typeof(TInstaller));
}
public ScopeConcreteIdArgConditionCopyNonLazyBinder ByInstaller(Type installerType)
{
Assert.That(installerType.DerivesFrom<InstallerBase>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType);
var subcontainerBindInfo = new SubContainerCreatorBindInfo();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByInstaller(
container, subcontainerBindInfo, installerType, BindInfo.Arguments), false);
return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo);
}
#if !NOT_UNITY3D
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller<TInstaller>()
where TInstaller : InstallerBase
{
return ByNewGameObjectInstaller(typeof(TInstaller));
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectInstaller(Type installerType)
{
Assert.That(installerType.DerivesFrom<InstallerBase>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewGameObjectInstaller(
container, gameObjectInfo, installerType, BindInfo.Arguments), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller<TInstaller>(
Func<InjectContext, UnityEngine.Object> prefabGetter)
where TInstaller : InstallerBase
{
return ByNewPrefabInstaller(prefabGetter, typeof(TInstaller));
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller(
Func<InjectContext, UnityEngine.Object> prefabGetter, Type installerType)
{
Assert.That(installerType.DerivesFrom<InstallerBase>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabInstaller(
container,
new PrefabProviderCustom(prefabGetter),
gameObjectInfo, installerType, BindInfo.Arguments), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller<TInstaller>(
UnityEngine.Object prefab)
where TInstaller : InstallerBase
{
return ByNewPrefabInstaller(prefab, typeof(TInstaller));
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabInstaller(
UnityEngine.Object prefab, Type installerType)
{
Assert.That(installerType.DerivesFrom<InstallerBase>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabInstaller(
container,
new PrefabProvider(prefab),
gameObjectInfo, installerType, BindInfo.Arguments), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceInstaller<TInstaller>(
string resourcePath)
where TInstaller : InstallerBase
{
return ByNewPrefabResourceInstaller(resourcePath, typeof(TInstaller));
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceInstaller(
string resourcePath, Type installerType)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
Assert.That(installerType.DerivesFrom<InstallerBase>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'Installer<>'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabInstaller(
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo, installerType, BindInfo.Arguments), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 387c12fd770c48e49bcefe4c0723d511
timeCreated: 1461708049
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,96 @@
using System;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinderWithParams<TContract> : FactorySubContainerBinderBase<TContract>
{
public FactorySubContainerBinderWithParams(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
#if !NOT_UNITY3D
[System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(Type installerType, UnityEngine.Object prefab)
{
return ByNewContextPrefab(installerType, prefab);
}
[System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab<TInstaller>(UnityEngine.Object prefab)
where TInstaller : IInstaller
{
return ByNewContextPrefab<TInstaller>(prefab);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab<TInstaller>(UnityEngine.Object prefab)
where TInstaller : IInstaller
{
return ByNewContextPrefab(typeof(TInstaller), prefab);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(Type installerType, UnityEngine.Object prefab)
{
BindingUtil.AssertIsValidPrefab(prefab);
Assert.That(installerType.DerivesFrom<MonoInstaller>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'MonoInstaller'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabWithParams(
installerType,
container,
new PrefabProvider(prefab),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
[System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource<TInstaller>(string resourcePath)
where TInstaller : IInstaller
{
return ByNewContextPrefabResource<TInstaller>(resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(
Type installerType, string resourcePath)
{
return ByNewContextPrefabResource(installerType, resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource<TInstaller>(string resourcePath)
where TInstaller : IInstaller
{
return ByNewContextPrefabResource(typeof(TInstaller), resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(
Type installerType, string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabWithParams(
installerType,
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a002e9dce4e8af54d948529d6beda84b
timeCreated: 1461708052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 97d57d9da80f7414a8fed9f2a04621b8
folderAsset: yes
timeCreated: 1512304190
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System;
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinderUntyped : FactoryFromBinderBase
{
public FactoryFromBinderUntyped(
DiContainer bindContainer, Type contractType, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindContainer, contractType, bindInfo, factoryBindInfo)
{
}
// TODO - add similar methods found in FactoryFromBinder<>
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ed1989ebc010d0746ab301cc5747f5c8
timeCreated: 1512304191
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,297 @@
using System;
using System.Collections.Generic;
using ModestTree;
#if !NOT_UNITY3D
using UnityEngine;
#endif
namespace Zenject
{
[NoReflectionBaking]
public class FactoryFromBinderBase : ScopeConcreteIdArgConditionCopyNonLazyBinder
{
public FactoryFromBinderBase(
DiContainer bindContainer, Type contractType, BindInfo bindInfo, FactoryBindInfo factoryBindInfo)
: base(bindInfo)
{
FactoryBindInfo = factoryBindInfo;
BindContainer = bindContainer;
ContractType = contractType;
factoryBindInfo.ProviderFunc =
(container) => new TransientProvider(
ContractType, container, BindInfo.Arguments, BindInfo.ContextInfo, BindInfo.ConcreteIdentifier,
BindInfo.InstantiatedCallback);
}
// Don't use this
internal DiContainer BindContainer
{
get; private set;
}
protected FactoryBindInfo FactoryBindInfo
{
get; private set;
}
// Don't use this
internal Func<DiContainer, IProvider> ProviderFunc
{
get { return FactoryBindInfo.ProviderFunc; }
set { FactoryBindInfo.ProviderFunc = value; }
}
protected Type ContractType
{
get; private set;
}
public IEnumerable<Type> AllParentTypes
{
get
{
yield return ContractType;
foreach (var type in BindInfo.ToTypes)
{
yield return type;
}
}
}
// Note that this isn't necessary to call since it's the default
public ConditionCopyNonLazyBinder FromNew()
{
BindingUtil.AssertIsNotComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
return this;
}
public ConditionCopyNonLazyBinder FromResolve()
{
return FromResolve(null);
}
public ConditionCopyNonLazyBinder FromInstance(object instance)
{
BindingUtil.AssertInstanceDerivesFromOrEqual(instance, AllParentTypes);
ProviderFunc =
(container) => new InstanceProvider(ContractType, instance, container, null);
return this;
}
public ConditionCopyNonLazyBinder FromResolve(object subIdentifier)
{
ProviderFunc =
(container) => new ResolveProvider(
ContractType, container,
subIdentifier, false, InjectSources.Any, false);
return this;
}
// Don't use this
internal ConcreteBinderGeneric<T> CreateIFactoryBinder<T>(out Guid factoryId)
{
// Use a random ID so that our provider is the only one that can find it and so it doesn't
// conflict with anything else
factoryId = Guid.NewGuid();
// Very important here that we use NoFlush otherwise the main binding will be finalized early
return BindContainer.BindNoFlush<T>().WithId(factoryId);
}
#if !NOT_UNITY3D
public ConditionCopyNonLazyBinder FromComponentOn(GameObject gameObject)
{
BindingUtil.AssertIsValidGameObject(gameObject);
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
ProviderFunc =
(container) => new GetFromGameObjectComponentProvider(
ContractType, gameObject, true);
return this;
}
public ConditionCopyNonLazyBinder FromComponentOn(Func<InjectContext, GameObject> gameObjectGetter)
{
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
ProviderFunc =
(container) => new GetFromGameObjectGetterComponentProvider(
ContractType, gameObjectGetter, true);
return this;
}
public ConditionCopyNonLazyBinder FromComponentOnRoot()
{
return FromComponentOn(
ctx => BindContainer.Resolve<Context>().gameObject);
}
public ConditionCopyNonLazyBinder FromNewComponentOn(GameObject gameObject)
{
BindingUtil.AssertIsValidGameObject(gameObject);
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
ProviderFunc =
(container) => new AddToExistingGameObjectComponentProvider(
gameObject, container, ContractType,
new List<TypeValuePair>(), BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback);
return this;
}
public ConditionCopyNonLazyBinder FromNewComponentOn(
Func<InjectContext, GameObject> gameObjectGetter)
{
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
ProviderFunc =
(container) => new AddToExistingGameObjectComponentProviderGetter(
gameObjectGetter, container, ContractType,
new List<TypeValuePair>(), BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback);
return this;
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewGameObject()
{
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new AddToNewGameObjectComponentProvider(
container, ContractType,
new List<TypeValuePair>(), gameObjectInfo, BindInfo.ConcreteIdentifier, BindInfo.InstantiatedCallback);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewPrefab(UnityEngine.Object prefab)
{
BindingUtil.AssertIsValidPrefab(prefab);
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new InstantiateOnPrefabComponentProvider(
ContractType,
new PrefabInstantiator(
container, gameObjectInfo,
ContractType, new [] { ContractType }, new List<TypeValuePair>(),
new PrefabProvider(prefab), BindInfo.InstantiatedCallback));
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInNewPrefab(UnityEngine.Object prefab)
{
BindingUtil.AssertIsValidPrefab(prefab);
BindingUtil.AssertIsInterfaceOrComponent(ContractType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new GetFromPrefabComponentProvider(
ContractType,
new PrefabInstantiator(
container, gameObjectInfo,
ContractType, new [] { ContractType }, new List<TypeValuePair>(),
new PrefabProvider(prefab),
BindInfo.InstantiatedCallback), true);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentInNewPrefabResource(string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
BindingUtil.AssertIsInterfaceOrComponent(ContractType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new GetFromPrefabComponentProvider(
ContractType,
new PrefabInstantiator(
container, gameObjectInfo,
ContractType, new [] { ContractType }, new List<TypeValuePair>(),
new PrefabProviderResource(resourcePath), BindInfo.InstantiatedCallback), true);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder FromNewComponentOnNewPrefabResource(string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
BindingUtil.AssertIsComponent(ContractType);
BindingUtil.AssertIsNotAbstract(ContractType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new InstantiateOnPrefabComponentProvider(
ContractType,
new PrefabInstantiator(
container, gameObjectInfo,
ContractType, new [] { ContractType }, new List<TypeValuePair>(),
new PrefabProviderResource(resourcePath),
BindInfo.InstantiatedCallback));
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
public ConditionCopyNonLazyBinder FromNewScriptableObjectResource(string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
BindingUtil.AssertIsInterfaceOrScriptableObject(ContractType);
ProviderFunc =
(container) => new ScriptableObjectResourceProvider(
resourcePath, ContractType, container, new List<TypeValuePair>(),
true, null, BindInfo.InstantiatedCallback);
return this;
}
public ConditionCopyNonLazyBinder FromScriptableObjectResource(string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
BindingUtil.AssertIsInterfaceOrScriptableObject(ContractType);
ProviderFunc =
(container) => new ScriptableObjectResourceProvider(
resourcePath, ContractType, container, new List<TypeValuePair>(),
false, null, BindInfo.InstantiatedCallback);
return this;
}
public ConditionCopyNonLazyBinder FromResource(string resourcePath)
{
BindingUtil.AssertDerivesFromUnityObject(ContractType);
ProviderFunc =
(container) => new ResourceProvider(resourcePath, ContractType, true);
return this;
}
#endif
}
}

Some files were not shown because too many files have changed in this diff Show More