Update Project
This commit is contained in:
@@ -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:
|
||||
Reference in New Issue
Block a user