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()); }
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()); }
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()); }
public List <UniInject.IBinding> GetBindings() { BindingBuilder bb = new BindingBuilder(); bb.BindExistingInstance(uiDoc); return(bb.GetBindings()); }
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); }
public List <IBinding> GetBindings() { BindingBuilder bb = new BindingBuilder(); bb.BindExistingInstance(this); return(bb.GetBindings()); }
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()); }
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); }
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()); }
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); }
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()); }
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()); }
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()); }