Esempio n. 1
0
        public static void OutputObjectGraphForScene()
        {
            if (!EditorApplication.isPlaying)
            {
                Log.Error("Zenject error: Must be in play mode to generate object graph.  Hit Play button and try again.");
                return;
            }

            DiContainer container;

            try
            {
                container = ZenEditorUtil.GetContainerForCurrentScene();
            }
            catch (ZenjectException e)
            {
                Log.Error("Unable to find container in current scene. " + e.Message);
                return;
            }

            var ignoreTypes = Enumerable.Empty <Type>();
            var types       = container.AllConcreteTypes;

            ZenEditorUtil.OutputObjectGraphForCurrentScene(container, ignoreTypes, types);
        }
Esempio n. 2
0
        public static bool ValidateCurrentScene()
        {
            var compRoot = GameObject.FindObjectsOfType <CompositionRoot>().OnlyOrDefault();

            if (compRoot == null)
            {
                Log.Error("Unable to find unique composition root in current scene");
                return(false);
            }

            if (compRoot.Installers.IsEmpty())
            {
                Log.Warn("Could not find installers while validating current scene");
                // Return true to allow playing in this case
                return(true);
            }

            // Only show a few to avoid spamming the log too much
            var resolveErrors = ZenEditorUtil.ValidateInstallers(compRoot).Take(10).ToList();

            foreach (var error in resolveErrors)
            {
                Log.ErrorException(error);
            }

            if (resolveErrors.Any())
            {
                Log.Error("Validation Completed With Errors");
                return(false);
            }

            Log.Info("Validation Completed Successfully");
            return(true);
        }
Esempio n. 3
0
        public static IEnumerable <ZenjectResolveException> ValidateCurrentScene()
        {
            var compRoot = GameObject.FindObjectsOfType <CompositionRoot>().OnlyOrDefault();

            if (compRoot == null || compRoot.Installers.IsEmpty())
            {
                return(Enumerable.Empty <ZenjectResolveException>());
            }

            return(ZenEditorUtil.ValidateInstallers(compRoot));
        }