Exemple #1
0
        public GameObjectNameGroupNameBinder FromPrefabResource(string resourcePath)
        {
            BindingUtil.AssertIsValidResourcePath(resourcePath);

            var gameObjectInfo = new GameObjectBindInfo();

            if (ContractType == typeof(GameObject))
            {
                SubFinalizer = CreateFinalizer(
                    (container) => new PrefabGameObjectProvider(
                        new PrefabInstantiator(
                            container, gameObjectInfo.Name, gameObjectInfo.GroupName,
                            new List <TypeValuePair>(), new PrefabProviderResource(resourcePath))));
            }
            else
            {
                BindingUtil.AssertIsAbstractOrComponent(ContractType);

                SubFinalizer = CreateFinalizer(
                    (container) => new GetFromPrefabComponentProvider(
                        ContractType,
                        new PrefabInstantiator(
                            container, gameObjectInfo.Name, gameObjectInfo.GroupName,
                            new List <TypeValuePair>(), new PrefabProviderResource(resourcePath))));
            }

            return(new GameObjectNameGroupNameBinder(BindInfo, gameObjectInfo));
        }
Exemple #2
0
 public GameObjectGroupNameScopeBinder(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectInfo)
     : base(bindInfo)
 {
     GameObjectInfo = gameObjectInfo;
 }
 public PrefabResourceBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     string resourcePath)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _resourcePath       = resourcePath;
 }
 public PrefabBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     UnityEngine.Object prefab)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _prefab = prefab;
 }
 public PrefabBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     GameObject prefab)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _prefab             = prefab;
 }
 public PrefabResourceBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     string resourcePath)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _resourcePath = resourcePath;
 }
 public SubContainerPrefabResourceBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     string resourcePath,
     object subIdentifier)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _subIdentifier = subIdentifier;
     _resourcePath = resourcePath;
 }
 public SubContainerPrefabBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     UnityEngine.Object prefab,
     object subIdentifier)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _prefab = prefab;
     _subIdentifier = subIdentifier;
 }
 public SubContainerPrefabBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     UnityEngine.Object prefab,
     object subIdentifier)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _prefab             = prefab;
     _subIdentifier      = subIdentifier;
 }
Exemple #10
0
        public GameObjectNameGroupNameScopeBinder ByPrefab(UnityEngine.Object prefab)
        {
            BindingUtil.AssertIsValidPrefab(prefab);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = new SubContainerPrefabBindingFinalizer(
                _bindInfo, gameObjectInfo, prefab, _subIdentifier);

            return(new GameObjectNameGroupNameScopeBinder(_bindInfo, gameObjectInfo));
        }
Exemple #11
0
        public GameObjectNameGroupNameScopeBinder ByPrefabResource(string resourcePath)
        {
            BindingUtil.AssertIsValidResourcePath(resourcePath);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = new SubContainerPrefabResourceBindingFinalizer(
                _bindInfo, gameObjectInfo, resourcePath, _subIdentifier);

            return(new GameObjectNameGroupNameScopeBinder(_bindInfo, gameObjectInfo));
        }
 public SubContainerPrefabResourceBindingFinalizer(
     BindInfo bindInfo,
     GameObjectBindInfo gameObjectBindInfo,
     string resourcePath,
     object subIdentifier)
     : base(bindInfo)
 {
     _gameObjectBindInfo = gameObjectBindInfo;
     _subIdentifier = subIdentifier;
     _resourcePath = resourcePath;
 }
 public override bool Equals(object other)
 {
     if (other is GameObjectBindInfo)
     {
         GameObjectBindInfo otherId = (GameObjectBindInfo)other;
         return(otherId == this);
     }
     else
     {
         return(false);
     }
 }
Exemple #14
0
        public GameObjectNameGroupNameScopeArgBinder FromPrefabResource(string resourcePath)
        {
            BindingUtil.AssertIsValidResourcePath(resourcePath);
            BindingUtil.AssertIsAbstractOrComponentOrGameObject(AllParentTypes);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = new PrefabResourceBindingFinalizer(
                BindInfo, gameObjectInfo, resourcePath);

            return(new GameObjectNameGroupNameScopeArgBinder(BindInfo, gameObjectInfo));
        }
Exemple #15
0
        public GameObjectNameGroupNameScopeArgBinder FromPrefab(UnityEngine.Object prefab)
        {
            BindingUtil.AssertIsValidPrefab(prefab);
            BindingUtil.AssertIsAbstractOrComponentOrGameObject(AllParentTypes);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = new PrefabBindingFinalizer(
                BindInfo, gameObjectInfo, prefab);

            return(new GameObjectNameGroupNameScopeArgBinder(BindInfo, gameObjectInfo));
        }
        public GameObjectNameGroupNameBinder ByPrefabResource(string resourcePath)
        {
            BindingUtil.AssertIsValidResourcePath(resourcePath);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = CreateFinalizer(
                (container) => new SubContainerDependencyProvider(
                    ContractType, SubIdentifier,
                    new SubContainerCreatorByPrefab(
                        container,
                        new PrefabProviderResource(resourcePath),
                        gameObjectInfo.Name,
                        gameObjectInfo.GroupName)));

            return(new GameObjectNameGroupNameBinder(BindInfo, gameObjectInfo));
        }
        public GameObjectNameGroupNameBinder ByPrefab(UnityEngine.Object prefab)
        {
            BindingUtil.AssertIsValidPrefab(prefab);

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = CreateFinalizer(
                (container) => new SubContainerDependencyProvider(
                    ContractType, SubIdentifier,
                    new SubContainerCreatorByPrefab(
                        container,
                        new PrefabProvider(prefab),
                        gameObjectInfo.Name,
                        gameObjectInfo.GroupName)));

            return(new GameObjectNameGroupNameBinder(BindInfo, gameObjectInfo));
        }
        public GameObjectNameGroupNameBinder ByPrefab(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.Name());

            var gameObjectInfo = new GameObjectBindInfo();

            SubFinalizer = CreateFinalizer(
                (container) => new SubContainerDependencyProvider(
                    ContractType, SubIdentifier,
                    new SubContainerCreatorByPrefabWithParams(
                        installerType,
                        container,
                        new PrefabProvider(prefab),
                        gameObjectInfo.Name,
                        gameObjectInfo.GroupName)));

            return(new GameObjectNameGroupNameBinder(BindInfo, gameObjectInfo));
        }
Exemple #19
0
        public GameObjectNameGroupNameBinder FromGameObject()
        {
            var gameObjectInfo = new GameObjectBindInfo();

            if (ContractType == typeof(GameObject))
            {
                SubFinalizer = CreateFinalizer(
                    (container) => new EmptyGameObjectProvider(
                        container, gameObjectInfo.Name, gameObjectInfo.GroupName));
            }
            else
            {
                BindingUtil.AssertIsComponent(ContractType);
                BindingUtil.AssertIsNotAbstract(ContractType);

                SubFinalizer = CreateFinalizer(
                    (container) => new AddToNewGameObjectComponentProvider(
                        container, ContractType, null,
                        new List <TypeValuePair>(), gameObjectInfo.Name, gameObjectInfo.GroupName));
            }

            return(new GameObjectNameGroupNameBinder(BindInfo, gameObjectInfo));
        }
Exemple #20
0
        public GameObjectNameGroupNameScopeArgBinder FromGameObject()
        {
            BindingUtil.AssertIsAbstractOrComponentOrGameObject(BindInfo.ContractTypes);
            BindingUtil.AssertIsComponentOrGameObject(ConcreteTypes);

            var gameObjectInfo = new GameObjectBindInfo();

            if (ConcreteTypes.All(x => x == typeof(GameObject)))
            {
                SubFinalizer = new ScopableBindingFinalizer(
                    BindInfo, SingletonTypes.ToGameObject, gameObjectInfo,
                    (container, type) =>
                {
                    Assert.That(BindInfo.Arguments.IsEmpty(), "Cannot inject arguments into empty game object");
                    return(new EmptyGameObjectProvider(
                               container, gameObjectInfo.Name, gameObjectInfo.GroupName));
                });
            }
            else
            {
                BindingUtil.AssertIsComponent(ConcreteTypes);
                BindingUtil.AssertTypesAreNotAbstract(ConcreteTypes);

                SubFinalizer = new ScopableBindingFinalizer(
                    BindInfo, SingletonTypes.ToGameObject, gameObjectInfo,
                    (container, type) => new AddToNewGameObjectComponentProvider(
                        container,
                        type,
                        BindInfo.ConcreteIdentifier,
                        BindInfo.Arguments,
                        gameObjectInfo.Name,
                        gameObjectInfo.GroupName));
            }

            return(new GameObjectNameGroupNameScopeArgBinder(BindInfo, gameObjectInfo));
        }
Exemple #21
0
 public GameObjectNameGroupNameBinder(
     BindInfo bindInfo, GameObjectBindInfo gameObjectInfo)
     : base(bindInfo, gameObjectInfo)
 {
 }
 public bool Equals(GameObjectBindInfo that)
 {
     return(this == that);
 }