Esempio n. 1
0
        public void Awake()
        {
            Log.Debug("Zenject Started");

            _container = CreateContainer(false, GlobalCompositionRoot.Instance.Container);

            InjectionHelper.InjectChildGameObjects(_container, gameObject);
            _dependencyRoot = _container.Resolve <IDependencyRoot>();
        }
        public void Awake()
        {
            DontDestroyOnLoad(gameObject);

            // Is this a good idea?
            //go.hideFlags = HideFlags.HideInHierarchy;

            _container = CreateContainer(false, gameObject);
            _dependencyRoot = _container.Resolve<IDependencyRoot>();
        }
Esempio n. 3
0
        public void Awake()
        {
            DontDestroyOnLoad(gameObject);

            // Is this a good idea?
            //go.hideFlags = HideFlags.HideInHierarchy;

            _container      = CreateContainer(false, this);
            _dependencyRoot = _container.Resolve <IDependencyRoot>();
        }
Esempio n. 4
0
        public void Awake()
        {
            Log.Debug("Zenject Started");

            _container = CreateContainer(
                false, GlobalCompositionRoot.Instance.Container, _staticInstallers);
            _staticInstallers.Clear();

            InjectionHelper.InjectChildGameObjects(_container, gameObject, !OnlyInjectWhenActive);
            _dependencyRoot = _container.Resolve <IDependencyRoot>();
        }
Esempio n. 5
0
        void Resolve()
        {
            InjectionHelper.InjectChildGameObjects(_container, gameObject);

            if (_container.HasBinding <IDependencyRoot>())
            {
                _dependencyRoot = _container.Resolve <IDependencyRoot>();
                _dependencyRoot.Start();
            }
            else
            {
                Debug.LogWarning("No dependency root found");
            }
        }
        public void Awake()
        {
            _container = CreateContainer(
                false, GlobalCompositionRoot.Instance.Container, _staticInstallers);
            _staticInstallers.Clear();

            if (InjectFullScene)
            {
                var rootGameObjects = GameObject.FindObjectsOfType<Transform>()
                    .Where(x => x.parent == null && x.GetComponent<GlobalCompositionRoot>() == null && (x.GetComponent<CompositionRoot>() == null || x == this.transform))
                    .Select(x => x.gameObject).ToList();

                foreach (var rootObj in rootGameObjects)
                {
                    _container.InjectGameObject(rootObj, true, !OnlyInjectWhenActive);
                }
            }
            else
            {
                _container.InjectGameObject(gameObject, true, !OnlyInjectWhenActive);
            }

            _dependencyRoot = _container.Resolve<IDependencyRoot>();
        }
Esempio n. 7
0
        public void Awake()
        {
            _container = CreateContainer(
                false, GlobalCompositionRoot.Instance.Container, _staticInstallers);
            _staticInstallers.Clear();

            if (InjectFullScene)
            {
                var rootGameObjects = GameObject.FindObjectsOfType <Transform>()
                                      .Where(x => x.parent == null && x.GetComponent <GlobalCompositionRoot>() == null && (x.GetComponent <SceneCompositionRoot>() == null || x == this.transform))
                                      .Select(x => x.gameObject).ToList();

                foreach (var rootObj in rootGameObjects)
                {
                    _container.InjectGameObject(rootObj, true, !OnlyInjectWhenActive);
                }
            }
            else
            {
                _container.InjectGameObject(gameObject, true, !OnlyInjectWhenActive);
            }

            _dependencyRoot = _container.Resolve <IDependencyRoot>();
        }
 // If we're destroyed manually somehow handle that
 public void OnDestroy()
 {
     _instance = null;
     _dependencyRoot = null;
 }
Esempio n. 9
0
 // If we're destroyed manually somehow handle that
 public void OnDestroy()
 {
     _instance       = null;
     _dependencyRoot = null;
 }
Esempio n. 10
0
        void Resolve()
        {
            InjectStartingMonoBehaviours();

            _dependencyRoot = _container.Resolve<IDependencyRoot>();

            Assert.That(_dependencyRoot != null, "No dependency root found.");

            _dependencyRoot.Start();
        }
Esempio n. 11
0
        void Resolve()
        {
            InjectionHelper.InjectChildGameObjects(_container, gameObject);

            if (_container.HasBinding<IDependencyRoot>())
            {
                _dependencyRoot = _container.Resolve<IDependencyRoot>();
                _dependencyRoot.Start();
            }
            else
            {
                Debug.LogWarning("No dependency root found");
            }
        }