コード例 #1
0
ファイル: ProjectContext.cs プロジェクト: GAIA-project/AR
        void InstallBindings(List <MonoBehaviour> injectableMonoBehaviours)
        {
            _container.DefaultParent = this.transform;
            _container.Settings      = _settings ?? ZenjectSettings.Default;

            _container.Bind <ZenjectSceneLoader>().AsSingle();

            StandardInterfacesRootInstaller.Install(_container);

            _container.Bind <Context>().FromInstance(this);

            _container.Bind(typeof(ProjectKernel), typeof(MonoKernel))
            .To <ProjectKernel>().FromNewComponentOn(this.gameObject).AsSingle().NonLazy();

            _container.Bind <SceneContextRegistry>().AsSingle();

            InstallSceneBindings(injectableMonoBehaviours);
            InstallInstallers();
        }
コード例 #2
0
        void Initialize()
        {
            Assert.IsNull(_container);

            _container = new DiContainer(new DiContainer[] { StaticContext.Container });

            // Make sure we don't create any game objects since editor windows don't have a scene
            _container.AssertOnNewGameObjects = true;

            StandardInterfacesRootInstaller.Install(_container);

            _container.Bind <Kernel>().AsSingle();
            _container.Bind <GuiRenderableManager>().AsSingle();
            _container.BindInstance(this);

            InstallBindings();

            _container.QueueForInject(this);
            _container.ResolveRoots();

            _kernel.Initialize();
        }