public static void BindToObjectInScene <T>( this SceneView scene, string bindingName, bool rootContext) { var contextName = rootContext ? null : scene.ContextName; var obj = string.IsNullOrEmpty(bindingName) ? scene.transform.FindChildRecursively <T>() : scene.transform.FindChildRecursively <T>(bindingName); if (obj == null) { throw new Exception(string.Format( "Failed to bind injection: Could not find <{0}> with name <{1}> in scene <{2}>.", typeof(T).Name, bindingName, scene.GetName())); } if (string.IsNullOrEmpty(bindingName)) { Rapid.Bind <T>(obj, contextName); } else { Rapid.Bind(bindingName, obj, contextName); } }
public static void BindToAddObjectToScene <TInterface, TImplementation>( this SceneView scene, string bindingName, bool rootContext) where TImplementation : Component, TInterface { var contextName = rootContext ? null : scene.ContextName; var obj = scene.transform.AddChild <TImplementation>(); if (!string.IsNullOrEmpty(bindingName)) { obj.name = bindingName; Rapid.Bind(bindingName, obj, contextName); } else { Rapid.Bind <TInterface>(obj, contextName); } }
public void UnregisterFromContext() { Rapid.UnregisterView(this); }
public void RegisterWithContext() { Rapid.RegisterView(this); }
public void RegisterWithContext() { _contextName = transform.FindFirstParent <SceneView>().ContextName; Rapid.RegisterView(this); }