public void Listen(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> listener) { Assert.That(!_listeners.Contains(listener), () => "Tried to add method '{0}' to signal '{1}' but it has already been added" .Fmt(MethodToString(listener), this.GetType().Name)); _listeners.Add(listener); }
public void Unlisten(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> listener) { bool success = _listeners.Remove(listener); Assert.That(success, () => "Tried to remove method '{0}' from signal '{1}' without adding it first" .Fmt(MethodToString(listener), this.GetType().Name)); }
static string MethodToString(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> action) { #if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR return(action.ToString()); #else return("{0}.{1}".Fmt(action.Method.DeclaringType.Name(), action.Method.Name)); #endif }
public ConditionBinder ByMethod(ModestTree.Util.Action <DiContainer, TParam1, TParam2, TParam3, TParam4> installerMethod) { SubFinalizer = CreateFinalizer( (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod <TParam1, TParam2, TParam3, TParam4>( container, installerMethod))); return(new ConditionBinder(BindInfo)); }
public ConditionCopyNonLazyBinder ByMethod(ModestTree.Util.Action <DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5> installerMethod) { ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod <TParam1, TParam2, TParam3, TParam4, TParam5>( container, installerMethod)); return(new ConditionCopyNonLazyBinder(BindInfo)); }
// AsSingle / AsCached / etc. don't make sense in this case so just return ConditionBinder public ConditionBinder ToMethod(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5> action) { // Create the command class once and re-use it everywhere Finalizer = new SingleProviderBindingFinalizer( BindInfo, new CachedProvider( new TransientProvider( typeof(TCommand), Container, InjectUtil.CreateArgListExplicit(action), null))); return(new ConditionBinder(BindInfo)); }
public ConditionCopyNonLazyBinder ByMethod( #if !NET_4_6 ModestTree.Util. #endif Action <DiContainer, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10> installerMethod) { ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(container, installerMethod), false); return(new ConditionCopyNonLazyBinder(BindInfo)); }
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 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)); }
public NameTransformConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, ModestTree.Util.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)); return(new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo)); }
public NameTransformConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, ModestTree.Util.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)); return(new NameTransformConditionCopyNonLazyBinder(BindInfo, gameObjectInfo)); }
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( Func <InjectContext, UnityEngine.Object> prefabGetter, #if !NET_4_6 && !NET_STANDARD_2_0 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)); }
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); #if NOT_UNITY3D return(new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo)); #else return(new DefaultParentScopeConcreteIdArgConditionCopyNonLazyBinder(subcontainerBindInfo, BindInfo)); #endif }
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, #if !NET_4_6 && !NET_STANDARD_2_0 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)); }
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, #if !NET_4_6 && !NET_STANDARD_2_0 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 static string ToDebugString <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(this ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> action) { #if UNITY_WSA && ENABLE_DOTNET && !UNITY_EDITOR return(action.ToString()); #else return(action.Method.ToDebugString()); #endif }