Beispiel #1
0
        /// <inheritdoc/>
        public override void InstallBindings()
        {
            Assert.IsNotNull(this.ConfigurationSelector, "A service configuration selector must be specified.");
            Assert.IsNotNull(this.ConfigurationSelector.SelectedConfiguration, "A service configuration must be selected.");

            ZenjectServiceUtility.Install(this.Container, this.ConfigurationSelector.SelectedConfiguration);
        }
        private void Refresh()
        {
            this.serializedObject.ApplyModifiedProperties();

            this.targetConfigurationObject = this.target as ZenjectServiceConfiguration;
            this.targetInstallerComponents = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(this.target))
                                             .OfType <ZenjectServiceInstaller>()
                                             .ToDictionary(x => x.TargetService);
            this.targetActiveInstallers = new HashSet <ZenjectServiceInstaller>(this.targetConfigurationObject.Installers);
            //this.targetInheritedInstallers = new HashSet<ZenjectServiceInstaller>(this.targetConfigurationObject.InheritedInstallers);
            this.serviceDependentsLookup       = ZenjectServiceUtility.BuildServiceDependentsLookup(this.targetConfigurationObject.AllInstallers);
            this.sortedServiceDependentsLookup = this.serviceDependentsLookup.ToDictionary(
                entry => entry.Key,
                entry => entry.Value
                .OrderBy(group => group.TitleWithNamespace, ServiceGroupTitleComparer.Instance)
                .ToArray()
                );

            this.serviceEntries = this.discoveredServices
                                  .Select(CreateServiceEntry)
                                  .OrderBy(entry => entry.Descriptor.ServiceType.Name)
                                  .GroupBy(service => service.Descriptor.ServiceType.Namespace)
                                  .Select(group => new ServiceEntryGroup {
                Title   = !string.IsNullOrEmpty(group.Key) ? group.Key : "Global Namespace",
                Entries = group.ToArray()
            })
                                  .OrderBy(group => group.Title, ServiceGroupTitleComparer.Instance)
                                  .ToArray();
        }