Beispiel #1
0
        static bool ValidateCompRoot(CompositionRoot compRoot, DateTime startTime)
        {
            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);
            }

            var secondsElapsed = (DateTime.Now - startTime).Milliseconds / 1000.0f;

            if (resolveErrors.Any())
            {
                Log.Error("Validation Completed With Errors, Took {0:0.00} Seconds.", secondsElapsed);
                return(false);
            }

            Log.Info("Validation Completed Successfully, Took {0:0.00} Seconds.", secondsElapsed);
            return(true);
        }
Beispiel #2
0
        public static IEnumerable <ZenjectResolveException> ValidateCurrentScene()
        {
            var compRoot = GameObject.FindObjectsOfType <SceneCompositionRoot>().OnlyOrDefault();

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

            return(ZenEditorUtil.ValidateInstallers(compRoot));
        }