public ScopeArgConditionCopyNonLazyBinder FromComponentInParents(bool excludeSelf = false) { BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); return(FromMethodMultiple((ctx) => { Assert.That(ctx.ObjectType.DerivesFromOrEqual <MonoBehaviour>()); Assert.IsNotNull(ctx.ObjectInstance); var res = ((MonoBehaviour)ctx.ObjectInstance).GetComponentsInParent <TContract>() .Where(x => !ReferenceEquals(x, ctx.ObjectInstance)); if (excludeSelf) { res = res.Where(x => (x as Component).gameObject != (ctx.ObjectInstance as Component).gameObject); } return res; })); }
public NameTransformConditionCopyNonLazyBinder ByNewPrefab(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)); return(new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo)); }