public List <IBinding> GetBindings()
    {
        sceneData = SceneNavigator.Instance.GetSceneDataOrThrow <SingingResultsSceneData>();

        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        bb.BindExistingInstance(sceneData);
        return(bb.GetBindings());
    }
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        bb.BindExistingInstance(songRouletteController);
        bb.BindExistingInstance(songAudioPlayer);
        bb.BindExistingInstance(songVideoPlayer);
        return(bb.GetBindings());
    }
Exemple #3
0
    public List <IBinding> GetBindings()
    {
        // Binding happens before the injection finished. Thus, no fields can be used here that have been injected.
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        bb.BindExistingInstance(SongMeta);
        bb.BindExistingInstance(songAudioPlayer);
        bb.BindExistingInstance(songVideoPlayer);
        bb.BindExistingInstance(playerUiArea);
        return(bb.GetBindings());
    }
Exemple #4
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(ApplicationManager.Instance);
        bb.BindExistingInstance(SceneNavigator.Instance);
        bb.BindExistingInstance(SettingsManager.Instance);
        bb.BindExistingInstance(SongMetaManager.Instance);
        bb.BindExistingInstance(ThemeManager.Instance);

        // Lazy binding of settings, because they are not needed in every scene and loading the settings takes time.
        bb.BindExistingInstanceLazy(() => SettingsManager.Instance.Settings);

        return(bb.GetBindings());
    }
Exemple #5
0
    public List <UniInject.IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(uiDoc);
        return(bb.GetBindings());
    }
Exemple #6
0
        public void ConstructorInjectionWithMultipleParameters()
        {
            BindingBuilder bb = new BindingBuilder();

            bb.BindExistingInstance("abc");
            bb.BindExistingInstance(123);

            Injector injector = UniInjectUtils.CreateInjector();

            injector.AddBindings(bb);

            NeedsConstructorInjectionWithMultipleParameters needsInjection = injector.Create <NeedsConstructorInjectionWithMultipleParameters>();

            Assert.AreEqual("abc", needsInjection.theString);
            Assert.AreEqual(123, needsInjection.theInt);
        }
Exemple #7
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        return(bb.GetBindings());
    }
Exemple #8
0
        public void MethodInjectionWithMultipleParameters()
        {
            BindingBuilder bb = new BindingBuilder();

            bb.BindExistingInstance("Tolkien");
            bb.BindExistingInstance(1954);
            bb.Bind(typeof(IInstanceIndexHolder)).ToExistingInstance(new ImplWithInstanceIndex());

            Injector injector = UniInjectUtils.CreateInjector();

            injector.AddBindings(bb);
            NeedsMethodInjectionWithMultipleParameters needsInjection = injector.CreateAndInject <NeedsMethodInjectionWithMultipleParameters>();

            Assert.AreEqual("Tolkien", needsInjection.theAuthor);
            Assert.AreEqual(1954, needsInjection.theYear);
            Assert.NotNull(needsInjection.theInterfaceInstance);
        }
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        bb.BindExistingInstanceLazy(() => LazyInjectionDemo.Instance);
        bb.Bind("author").ToExistingInstance("Tolkien");
        bb.Bind(typeof(int)).ToExistingInstance(42);
        bb.Bind("personWithAge").ToExistingInstance("Bob");
        bb.Bind(typeof(IDependencyInjectionDemoInterface)).ToNewInstancesOfType(typeof(DependencyInjectionDemoInterfaceImpl));
        bb.Bind(typeof(IDependencyInjectionDemoInterfaceWithConstructorParameters)).ToSingleInstanceOfType(typeof(DependencyInjectionDemoInterfaceWithConstructorParametersImpl));
        return(bb.GetBindings());
    }
Exemple #10
0
        public void ConstructorInjectionFromExistingInstance()
        {
            BindingBuilder bb = new BindingBuilder();

            bb.BindExistingInstance("abc");

            Injector injector = UniInjectUtils.CreateInjector();

            injector.AddBindings(bb);

            NeedsConstructorInjection needsInjection = injector.Create <NeedsConstructorInjection>();

            Assert.AreEqual("abc", needsInjection.theString);
        }
Exemple #11
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(ApplicationManager.Instance);
        bb.BindExistingInstance(SceneNavigator.Instance);
        bb.BindExistingInstance(SettingsManager.Instance);
        bb.BindExistingInstance(SongMetaManager.Instance);
        bb.BindExistingInstance(ThemeManager.Instance);
        bb.BindExistingInstance(CursorManager.Instance);
        bb.BindExistingInstance(UiManager.Instance);
        bb.BindExistingInstance(MidiManager.Instance);
        bb.BindExistingInstance(AudioManager.Instance);

        EventSystem eventSystem = GameObjectUtils.FindComponentWithTag <EventSystem>("EventSystem");

        bb.BindExistingInstance(eventSystem);

        // Lazy binding of settings, because they are not needed in every scene and loading the settings takes time.
        bb.BindExistingInstanceLazy(() => SettingsManager.Instance.Settings);

        return(bb.GetBindings());
    }
Exemple #12
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        // Note that the SceneData and SongMeta are loaded on access here if not done yet.
        bb.BindExistingInstance(SceneData);
        bb.BindExistingInstance(SongMeta);
        bb.BindExistingInstance(songAudioPlayer);
        bb.BindExistingInstance(songVideoPlayer);
        bb.BindExistingInstance(noteArea);
        bb.BindExistingInstance(songEditorLayerManager);
        bb.BindExistingInstance(microphonePitchTracker);
        bb.BindExistingInstance(songEditorNoteRecorder);
        bb.BindExistingInstance(this);

        List <Voice> voices = VoiceIdToVoiceMap.Values.ToList();

        bb.Bind("voices").ToExistingInstance(voices);
        return(bb.GetBindings());
    }
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(ApplicationManager.Instance);
        bb.BindExistingInstance(SettingsManager.Instance);
        bb.BindExistingInstance(CoroutineManager.Instance);
        bb.BindExistingInstance(ClientSideConnectRequestManager.Instance);
        bb.BindExistingInstance(InputManager.Instance);
        bb.BindExistingInstance(TranslationManager.Instance);
        bb.BindExistingInstance(GetUiDocument());

        bb.BindExistingInstance(SettingsManager.Instance.Settings);
        bb.Bind(typeof(ISettings)).ToExistingInstance(SettingsManager.Instance.Settings);

        return(bb.GetBindings());
    }
        public void FieldInjectionFromExistingInstance()
        {
            BindingBuilder bb = new BindingBuilder();

            bb.BindExistingInstance("abc");

            Injector injector = UniInjectUtils.CreateInjector();

            injector.AddBindings(bb);

            NeedsFieldInjection needsInjection = new NeedsFieldInjection();

            injector.Inject(needsInjection);
            Assert.AreEqual("abc", needsInjection.theString);
        }
Exemple #15
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(ApplicationManager.Instance);
        bb.BindExistingInstance(SettingsManager.Instance);
        bb.BindExistingInstance(CoroutineManager.Instance);
        bb.BindExistingInstance(ClientSideConnectRequestManager.Instance);
        bb.BindExistingInstance(ClientSideMicSampleRecorder.Instance);
        bb.BindExistingInstance(ClientSideMicDataSender.Instance);

        // Lazy binding of settings, because they are not needed in every scene and loading the settings takes time.
        bb.BindExistingInstanceLazy(() => SettingsManager.Instance.Settings);

        return(bb.GetBindings());
    }
Exemple #16
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        bb.BindExistingInstance(this);
        bb.BindExistingInstance(songRouletteController);
        bb.BindExistingInstance(songSelectSceneInputControl);
        bb.BindExistingInstance(songAudioPlayer);
        bb.BindExistingInstance(songVideoPlayer);
        bb.BindExistingInstance(playlistSlider);
        bb.BindExistingInstance(orderSlider);
        bb.BindExistingInstance(characterQuickJumpBar);
        bb.BindExistingInstance(playerProfileListController);
        bb.BindExistingInstance(songSelectSceneControlNavigator);
        bb.BindExistingInstance(graphicRaycaster);
        bb.BindExistingInstance(songPreviewController);
        return(bb.GetBindings());
    }
Exemple #17
0
    public List <IBinding> GetBindings()
    {
        BindingBuilder bb = new BindingBuilder();

        // Note that the SceneData and SongMeta are loaded on access here if not done yet.
        bb.BindExistingInstance(SceneData);
        bb.BindExistingInstance(SongMeta);
        bb.BindExistingInstance(songAudioPlayer);
        bb.BindExistingInstance(songVideoPlayer);
        bb.BindExistingInstance(noteArea);
        bb.BindExistingInstance(noteAreaDragHandler);
        bb.BindExistingInstance(songEditorLayerManager);
        bb.BindExistingInstance(microphonePitchTracker);
        bb.BindExistingInstance(songEditorNoteRecorder);
        bb.BindExistingInstance(selectionController);
        bb.BindExistingInstance(editorNoteDisplayer);
        bb.BindExistingInstance(canvas);
        bb.BindExistingInstance(graphicRaycaster);
        bb.BindExistingInstance(historyManager);
        bb.BindExistingInstance(songMetaChangeEventStream);
        bb.BindExistingInstance(lyricsArea);
        bb.BindExistingInstance(this);
        return(bb.GetBindings());
    }