public static void GenerateReport() { var resolvers = Object.FindObjectsOfType <Resolver>(); int totalResolved = 0, totalNotResolved = 0, totalNotInjectable = 0; string message; LogType logType; LogLine(); foreach (var resolver in resolvers) { var report = new ResolverReport(resolver); report.Generate(); message = FormatMessage(resolver.gameObject.name, report.Resolved, report.NotResolved, report.NotInjectable ); logType = report.NotResolved > 0 || report.NotInjectable > 0 ? LogType.Error : LogType.Log; Log(logType, message, resolver.gameObject); totalResolved += report.Resolved; totalNotResolved += report.NotResolved; totalNotInjectable += report.NotInjectable; } message = FormatMessage("Overall", totalResolved, totalNotResolved, totalNotInjectable); logType = totalNotResolved > 0 || totalNotInjectable > 0 ? LogType.Error : LogType.Log; LogLine(); Log(logType, message); }
private static string GetResolutionText(ResolverReport report) { var(resolved, notResolved, notInjectable) = (report.Resolved, report.NotResolved, report.NotInjectable); return(new StringBuilder() .Append(notResolved > 0 || notInjectable > 0 ? "<color=red>" : "<color=green>") .AppendFormat("<b>{0} resolved, {1} failed to resolve, {2} not injectable</b>", resolved.ToString(), notResolved.ToString(), notInjectable.ToString()) .Append("</color>") .ToString()); }
private void OnEnable() { _headerStyle = new GUIStyle { normal = new GUIStyleState { textColor = Color.white, }, richText = true, }; _report = new ResolverReport((Resolver)serializedObject.targetObject); }