示例#1
0
        public LifetimeScope CreateChildFromPrefab(LifetimeScope prefab, IInstaller installer = null)
        {
            if (prefab.gameObject.activeSelf && prefab.autoRun)
            {
                prefab.gameObject.SetActive(false);
            }

            var child = Instantiate(prefab, transform, false);

            if (installer != null)
            {
                child.extraInstallers.Add(installer);
            }
            child.parent = this;
            if (!child.gameObject.activeSelf)
            {
                child.gameObject.SetActive(true);
            }
            return(child);
        }
示例#2
0
        public void Build()
        {
            if (runtimeParent == null)
            {
                runtimeParent = GetRuntimeParent();
            }

            if (runtimeParent != null)
            {
                Container = runtimeParent.Container.CreateScope(builder =>
                {
                    builder.ApplicationOrigin = this;
                    InstallTo(builder);
                });
            }
            else
            {
                InstallTo(new ContainerBuilder {
                    ApplicationOrigin = this
                });
            }

            DispatchPlayerLoopItems();
        }
示例#3
0
 void IDisposable.Dispose()
 {
     LifetimeScope.RemoveExtra(key);
 }
示例#4
0
 public ExtendScope(IInstaller installer, string key = "")
 {
     this.key = key;
     LifetimeScope.EnqueueExtra(installer, key);
 }
示例#5
0
 public ParentOverrideScope(LifetimeScope nextParent) => overrideParent = nextParent;
示例#6
0
 static void CancelAwake(LifetimeScope lifetimeScope)
 {
     WaitingList.Remove(lifetimeScope);
 }
示例#7
0
 static void EnqueueAwake(LifetimeScope lifetimeScope)
 {
     WaitingList.Add(lifetimeScope);
 }