public IProvider CreateProvider( Type resultType, string concreteIdentifier, string resourcePath, object identifier, string gameObjectName, string gameObjectGroupName) { _markRegistry.MarkSingleton( resultType, concreteIdentifier, SingletonTypes.ToSubContainerPrefabResource); var customSingletonId = new CustomSingletonId( concreteIdentifier, resourcePath); CreatorInfo creatorInfo; if (_subContainerCreators.TryGetValue(customSingletonId, out creatorInfo)) { Assert.IsEqual(creatorInfo.GameObjectName, gameObjectName, "Ambiguous creation parameters (gameObjectName) when using ToSubContainerPrefab with AsSingle"); Assert.IsEqual(creatorInfo.GameObjectGroupName, gameObjectGroupName, "Ambiguous creation parameters (gameObjectGroupName) when using ToSubContainerPrefab with AsSingle"); } else { var creator = new SubContainerCreatorCached( new SubContainerCreatorByPrefab( _container, new PrefabProviderResource(resourcePath), gameObjectName, gameObjectGroupName)); creatorInfo = new CreatorInfo( gameObjectName, gameObjectGroupName, creator); _subContainerCreators.Add(customSingletonId, creatorInfo); } return(new SubContainerDependencyProvider( resultType, identifier, creatorInfo.Creator)); }
public IProvider CreateProvider( Type resultType, object concreteIdentifier, UnityEngine.Object prefab, object identifier, GameObjectCreationParameters gameObjectBindInfo) { _markRegistry.MarkSingleton( resultType, concreteIdentifier, SingletonTypes.FromSubContainerPrefab); var customSingletonId = new CustomSingletonId( concreteIdentifier, prefab); CreatorInfo creatorInfo; if (_subContainerCreators.TryGetValue(customSingletonId, out creatorInfo)) { Assert.IsEqual(creatorInfo.GameObjectCreationParameters, gameObjectBindInfo, "Ambiguous creation parameters (game object name/parent info) when using ToSubContainerPrefab with AsSingle"); } else { var creator = new SubContainerCreatorCached( new SubContainerCreatorByNewPrefab(_container, new PrefabProvider(prefab), gameObjectBindInfo)); creatorInfo = new CreatorInfo(gameObjectBindInfo, creator); _subContainerCreators.Add(customSingletonId, creatorInfo); } return(new SubContainerDependencyProvider( resultType, identifier, creatorInfo.Creator)); }