本文整理汇总了C#中Zenject.DiContainer类的典型用法代码示例。如果您正苦于以下问题:C# DiContainer类的具体用法?C# DiContainer怎么用?C# DiContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiContainer类属于Zenject命名空间,在下文中一共展示了DiContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MethodProviderUntyped
public MethodProviderUntyped(
Func<InjectContext, object> method,
DiContainer container)
{
_container = container;
_method = method;
}
示例2: GetDependencies
static List<Type> GetDependencies(
DiContainer container, Type type)
{
var dependencies = new List<Type>();
foreach (var contractType in container.GetDependencyContracts(type))
{
List<Type> dependTypes;
if (contractType.FullName.StartsWith("System.Collections.Generic.List"))
{
var subTypes = contractType.GetGenericArguments();
Assert.IsEqual(subTypes.Length, 1);
var subType = subTypes[0];
dependTypes = container.ResolveTypeAll(subType);
}
else
{
dependTypes = container.ResolveTypeAll(contractType);
Assert.That(dependTypes.Count <= 1);
}
foreach (var dependType in dependTypes)
{
dependencies.Add(dependType);
}
}
return dependencies;
}
示例3: AddToExistingGameObjectComponentProvider
public AddToExistingGameObjectComponentProvider(
GameObject gameObject, DiContainer container, Type componentType,
string concreteIdentifier, List<TypeValuePair> extraArguments)
: base(container, componentType, concreteIdentifier, extraArguments)
{
_gameObject = gameObject;
}
示例4: ProcessDecoratorInstallers
void ProcessDecoratorInstallers(DiContainer container, bool isBefore)
{
if (DecoratorInstallers == null)
{
return;
}
foreach (var installer in DecoratorInstallers)
{
Assert.IsNotNull(installer, "Found null installer in SceneDecoratorContext");
if (installer.enabled)
{
container.Inject(installer);
if (isBefore)
{
installer.PreInstallBindings();
}
else
{
installer.PostInstallBindings();
}
}
}
}
示例5: MonoBehaviourSingletonProviderCreator
public MonoBehaviourSingletonProviderCreator(
DiContainer container,
SingletonRegistry singletonRegistry)
{
_singletonRegistry = singletonRegistry;
_container = container;
}
示例6: GameObjectSingletonProviderCreator
public GameObjectSingletonProviderCreator(
DiContainer container,
SingletonRegistry singletonRegistry)
{
_singletonRegistry = singletonRegistry;
_container = container;
}
示例7: EmptyGameObjectProvider
public EmptyGameObjectProvider(
DiContainer container, string gameObjectName, string groupName)
{
_gameObjectName = gameObjectName;
_groupName = groupName;
_container = container;
}
示例8: CreateInjectContext
public InjectContext CreateInjectContext(
DiContainer container, InjectContext currentContext, object targetInstance, string concreteIdentifier)
{
return new InjectContext(
container, MemberType, Identifier, Optional,
ObjectType, targetInstance, MemberName, currentContext, concreteIdentifier);
}
示例9: PrefabSingletonProvider
public PrefabSingletonProvider(
DiContainer container, Type concreteType, PrefabSingletonLazyCreator creator)
{
_creator = creator;
_container = container;
_concreteType = concreteType;
}
示例10: PrefabSingletonProvider
public PrefabSingletonProvider(
DiContainer container, Type instanceType, PrefabSingletonLazyCreator creator)
{
_creator = creator;
_container = container;
_instanceType = instanceType;
}
示例11: FinalizeBinding
public void FinalizeBinding(DiContainer container)
{
Assert.IsNotNull(_subFinalizer,
"Unfinished binding! Finalizer was not given.");
_subFinalizer.FinalizeBinding(container);
}
示例12: OutputObjectGraphForCurrentScene
public static void OutputObjectGraphForCurrentScene(
DiContainer container, IEnumerable<Type> ignoreTypes, IEnumerable<Type> contractTypes)
{
string dotFilePath = EditorUtility.SaveFilePanel("Choose the path to export the object graph", "", "ObjectGraph", "dot");
if (!dotFilePath.IsEmpty())
{
ObjectGraphVisualizer.OutputObjectGraphToFile(
container, dotFilePath, ignoreTypes, contractTypes);
var dotExecPath = EditorPrefs.GetString("Zenject.GraphVizDotExePath", "");
if (dotExecPath.IsEmpty() || !File.Exists(dotExecPath))
{
EditorUtility.DisplayDialog(
"GraphViz", "Unable to locate GraphViz. Please select the graphviz 'dot.exe' file which can be found at [GraphVizInstallDirectory]/bin/dot.exe. If you do not have GraphViz you can download it at http://www.graphviz.org", "Ok");
dotExecPath = EditorUtility.OpenFilePanel("Please select dot.exe from GraphViz bin directory", "", "exe");
EditorPrefs.SetString("Zenject.GraphVizDotExePath", dotExecPath);
}
if (!dotExecPath.IsEmpty())
{
RunDotExe(dotExecPath, dotFilePath);
}
}
}
示例13: ProcessDecoratorInstallers
void ProcessDecoratorInstallers(DiContainer container, bool isBefore)
{
if (DecoratorInstallers == null)
{
return;
}
foreach (var installer in DecoratorInstallers)
{
if (installer == null)
{
Log.Warn("Found null installer in composition root");
continue;
}
if (installer.enabled)
{
container.Inject(installer);
if (isBefore)
{
installer.PreInstallBindings();
}
else
{
installer.PostInstallBindings();
}
}
}
}
示例14: SingletonLazyCreatorByInstance
public SingletonLazyCreatorByInstance(
SingletonId id, SingletonProviderMap owner, DiContainer container, object instance)
: base(id, owner)
{
Assert.That(instance != null || container.IsValidating);
_instance = instance;
}
示例15: StandardSingletonProviderCreator
public StandardSingletonProviderCreator(
DiContainer container,
SingletonMarkRegistry markRegistry)
{
_markRegistry = markRegistry;
_container = container;
}