Exemple #1
0
        // Creates a new game object and adds the given type as a new component on it
        public BindingConditionSetter ToTransientGameObject()
        {
            if (!ContractType.DerivesFrom(typeof(Component)))
            {
                throw new ZenjectBindException(
                          "Expected UnityEngine.Component derived type when binding type '{0}'".Fmt(ContractType.Name()));
            }

            return(ToProvider(new GameObjectTransientProvider(ContractType)));
        }
Exemple #2
0
        public BindingConditionSetter ToSingle(string concreteIdentifier)
        {
#if !ZEN_NOT_UNITY3D
            if (ContractType.DerivesFrom(typeof(Component)))
            {
                throw new ZenjectBindException(
                          "Should not use ToSingle for Monobehaviours (when binding type '{0}'), you probably want either ToLookup or ToSinglePrefab or ToSingleGameObject"
                          .Fmt(ContractType.Name()));
            }
#endif

            return(ToProvider(_singletonMap.CreateProviderFromType(concreteIdentifier, ContractType)));
        }
Exemple #3
0
        public BindingConditionSetter ToTransient()
        {
#if !ZEN_NOT_UNITY3D
            if (ContractType.DerivesFrom(typeof(Component)))
            {
                throw new ZenjectBindException(
                          "Should not use ToTransient for Monobehaviours (when binding type '{0}'), you probably want either ToLookup or ToTransientFromPrefab"
                          .Fmt(ContractType.Name()));
            }
#endif

            return(ToProvider(new TransientProvider(ContractType)));
        }