Ejemplo n.º 1
0
 public static CryoContainer RegisterComponent <T>(this CryoContainer container, LifeTime lifeTime)
     where T : Component
 {
     return(container.RegisterProvider <T>(
                new GetComponentProvider <T>(FindComponentHint.ThisGameObject, container.LifeTimeManager, lifeTime),
                null));
 }
Ejemplo n.º 2
0
 public static CryoContainer RegisterComponent <T>(this CryoContainer container, FindComponentHint hint,
                                                   LifeTime lifeTime = LifeTime.Global)
     where T : Component
 {
     return(container.RegisterProvider <T>(new GetComponentProvider <T>(hint, container.LifeTimeManager, lifeTime),
                                           null));
 }
Ejemplo n.º 3
0
 void IInternalContainerBuidler.CreateRootContainer()
 {
     _container = CreateContainer();
     SetupContainer(_container);
     CryoBehaviour.SetRootContainer(_container);
     CryoBuilder.SetRootContainer(_container);
 }
Ejemplo n.º 4
0
 public static void SetRootContainer(CryoContainer container)
 {
     if (_rootContainer != null)
     {
         throw new ContainerException("Root container already set");
     }
     _rootContainer = container;
 }
Ejemplo n.º 5
0
 public static CryoContainer RegisterInstance <TBase, TDerived>(this CryoContainer container, TDerived obj,
                                                                string name = null, LifeTime lifeTime = LifeTime.Global) where TDerived : TBase
 {
     return(container.RegisterProvider <TBase>(
                new InstanceProvider <TDerived>(obj, container.LifeTimeManager, lifeTime), name));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Override this method to customize containers content
 /// </summary>
 protected virtual void SetupContainer(CryoContainer container)
 {
 }
Ejemplo n.º 7
0
 public static CryoContainer RegisterSingleton <T>(this CryoContainer container) where T : new()
 {
     return(container.RegisterProvider <T>(new SingletonProvider <T>(LifeTime.Global), null));
 }
Ejemplo n.º 8
0
 public static CryoContainer RegisterType <T>(this CryoContainer container) where T : new()
 {
     return(container.RegisterProvider <T>(new FactoryMethodProvider <T>(LifeTime.Global), null));
 }
Ejemplo n.º 9
0
 public static CryoContainer RegisterType <T>(this CryoContainer container, Func <T> factoryMethod, string name, LifeTime lifeTime)
 {
     return(container.RegisterProvider <T>(new FactoryMethodProvider <T>(factoryMethod, lifeTime), name));
 }
Ejemplo n.º 10
0
 public static CryoContainer RegisterType <T>(this CryoContainer container, string name, LifeTime lifeTime) where T : new()
 {
     return(container.RegisterProvider <T>(new FactoryMethodProvider <T>(lifeTime), name));
 }
Ejemplo n.º 11
0
 public static CryoContainer RegisterSceneObject <T>(this CryoContainer container, LifeTime lifeTime) where T : UnityEngine.Object
 {
     return(container.RegisterProvider <T>(new FindObjectProvider <T>(lifeTime), null));
 }
Ejemplo n.º 12
0
 public static CryoContainer RegisterType <T>(this CryoContainer container, Func <T> factoryMethod,
                                              LifeTime lifeTime)
 {
     return(container.RegisterProvider <T>(
                new FactoryMethodProvider <T>(factoryMethod, container.LifeTimeManager, lifeTime), null));
 }
Ejemplo n.º 13
0
 public static CryoContainer RegisterType <TBase, TDerived>(this CryoContainer container, string name)
     where TDerived : TBase, new()
 {
     return(container.RegisterProvider <TBase>(
                new FactoryMethodProvider <TDerived>(container.LifeTimeManager, LifeTime.Global), name));
 }
Ejemplo n.º 14
0
 public static CryoContainer RegisterSceneObject <T>(this CryoContainer container, string path,
                                                     string name = null, LifeTime lifeTime = LifeTime.Global)
 {
     return(container.RegisterProvider <T>(new ScenePathProvider <T>(path, container.LifeTimeManager, lifeTime),
                                           name));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Зарегистрировать синоним
 /// При попытке получить ссылку на тип TBase из контейнера будет извлекаться TDerived
 /// Удобно при использовании с синглтонами, реализующими несколько интерфейсов
 /// </summary>
 public static CryoContainer RegisterAlias <TBase, TDerived>(this CryoContainer container, string name = null,
                                                             string derivedName = null) where TDerived : TBase
 {
     return(container.RegisterProvider <TBase>(new AliasProvider <TDerived>(derivedName), name));
 }
Ejemplo n.º 16
0
 public static CryoContainer RegisterInstance <TBase, TDerived>(this CryoContainer container, TDerived obj, LifeTime lifeTime) where TDerived : TBase
 {
     return(container.RegisterProvider <TBase>(new InstanceProvider <TDerived>(obj, lifeTime), null));
 }
Ejemplo n.º 17
0
 public static CryoContainer RegisterSceneObject <T>(this CryoContainer container, string path, LifeTime lifeTime)
 {
     return(container.RegisterProvider <T>(new ScenePathProvider <T>(path, lifeTime), null));
 }
Ejemplo n.º 18
0
 public static CryoContainer RegisterComponent <T>(this CryoContainer container, string name, LifeTime lifeTime = LifeTime.Global)
     where T : Component
 {
     return(container.RegisterProvider <T>(new GetComponentProvider <T>(FindComponentHint.ThisGameObject, lifeTime), name));
 }
Ejemplo n.º 19
0
 public static CryoContainer RegisterSceneObject <TBase, TDerived>(this CryoContainer container, LifeTime lifeTime) where TDerived : UnityEngine.Object, TBase
 {
     return(container.RegisterProvider <TBase>(new FindObjectProvider <TDerived>(lifeTime), null));
 }
Ejemplo n.º 20
0
 public static CryoContainer RegisterSingleton <TBase, TDerived>(this CryoContainer container) where TDerived : TBase, new()
 {
     return(container.RegisterProvider <TBase>(new SingletonProvider <TDerived>(LifeTime.Global), null));
 }
Ejemplo n.º 21
0
 public static CryoContainer RegisterType <TBase, TDerived>(this CryoContainer container, LifeTime lifeTime) where TDerived : TBase, new()
 {
     return(container.RegisterProvider <TBase>(new FactoryMethodProvider <TDerived>(lifeTime), null));
 }
Ejemplo n.º 22
0
 public static CryoContainer RegisterSingleton <TBase, TDerived>(this CryoContainer container, Func <TDerived> factoryMethod, LifeTime lifeTime) where TDerived : TBase
 {
     return(container.RegisterProvider <TBase>(new SingletonProvider <TDerived>(factoryMethod, lifeTime), null));
 }
Ejemplo n.º 23
0
 public static CryoContainer RegisterType <TBase, TDerived>(this CryoContainer container, Func <TDerived> factoryMethod) where TDerived : TBase
 {
     return(container.RegisterProvider <TBase>(new FactoryMethodProvider <TDerived>(factoryMethod, LifeTime.Global), null));
 }
Ejemplo n.º 24
0
 public static CryoContainer RegisterSingleton <TBase, TDerived>(this CryoContainer container, string name, LifeTime lifeTime) where TDerived : TBase, new()
 {
     return(container.RegisterProvider <TBase>(new SingletonProvider <TDerived>(lifeTime), name));
 }
Ejemplo n.º 25
0
 public static CryoContainer RegisterType <TBase, TDerived>(this CryoContainer container, Func <TDerived> factoryMethod, string name, LifeTime lifeTime) where TDerived : TBase, new()
 {
     return(container.RegisterProvider <TBase>(new FactoryMethodProvider <TDerived>(factoryMethod, lifeTime), name));
 }
Ejemplo n.º 26
0
 public static CryoContainer RegisterInstance <T>(this CryoContainer container, T obj, string name = null, LifeTime lifeTime = LifeTime.Global)
 {
     return(container.RegisterProvider <T>(new InstanceProvider <T>(obj, lifeTime), name));
 }
Ejemplo n.º 27
0
 public static CryoContainer RegisterSingleton <T>(this CryoContainer container, Func <T> factoryMethod)
 {
     return(container.RegisterProvider <T>(new SingletonProvider <T>(factoryMethod, LifeTime.Global), null));
 }
Ejemplo n.º 28
0
 public static CryoContainer RegisterType <T>(this CryoContainer container, LifeTime lifeTime) where T : class, new()
 {
     return(container.RegisterProvider <T>(new FactoryMethodProvider <T>(lifeTime), null));
 }
Ejemplo n.º 29
0
 public PrefabInstantiator(CryoContainer container)
 {
     _container = container;
 }
Ejemplo n.º 30
0
 public static CryoContainer RegisterInstance <T>(this CryoContainer container, T obj, LifeTime lifeTime)
 {
     return(container.RegisterProvider <T>(new InstanceProvider <T>(obj, lifeTime), null));
 }