コード例 #1
0
ファイル: ZenjectMenu.cs プロジェクト: harjup/WizardCombat
        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);
        }
コード例 #2
0
ファイル: ZenEditorUtil.cs プロジェクト: harjup/WizardCombat
        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));
        }