// Token: 0x0600017A RID: 378 RVA: 0x0000CFAC File Offset: 0x0000B1AC private static void CheckTaskForErrors(Task task, bool projectLevelBehavior, ref List <ErrorDetails> errorDetails) { if (task.Disabled) { return; } if (task is UnknownTask || task is UnknownParentTask) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.UnknownTask, task, -1, null); } if (task.GetType().GetCustomAttributes(typeof(SkipErrorCheckAttribute), false).Length == 0) { FieldInfo[] allFields = TaskUtility.GetAllFields(task.GetType()); for (int i = 0; i < allFields.Length; i++) { ErrorCheck.CheckField(task, projectLevelBehavior, ref errorDetails, allFields[i], i, allFields[i].GetValue(task)); } } if (task is ParentTask && task.NodeData.NodeDesigner != null && !(task.NodeData.NodeDesigner as NodeDesigner).IsEntryDisplay) { ParentTask parentTask = task as ParentTask; if (parentTask.Children == null || parentTask.Children.Count == 0) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.MissingChildren, task, -1, null); } else { for (int j = 0; j < parentTask.Children.Count; j++) { ErrorCheck.CheckTaskForErrors(parentTask.Children[j], projectLevelBehavior, ref errorDetails); } } } }
// Token: 0x06000179 RID: 377 RVA: 0x0000CEA8 File Offset: 0x0000B0A8 public static List <ErrorDetails> CheckForErrors(BehaviorSource behaviorSource) { if (behaviorSource == null || behaviorSource.EntryTask == null) { return(null); } List <ErrorDetails> result = null; bool flag = AssetDatabase.GetAssetPath(behaviorSource.Owner.GetObject()).Length > 0; ErrorCheck.CheckTaskForErrors(behaviorSource.EntryTask, flag, ref result); if (behaviorSource.RootTask == null) { ErrorCheck.AddError(ref result, ErrorDetails.ErrorType.MissingChildren, behaviorSource.EntryTask, -1, null); } if (behaviorSource.RootTask != null) { ErrorCheck.CheckTaskForErrors(behaviorSource.RootTask, flag, ref result); } if (!EditorApplication.isPlaying && flag && behaviorSource.Variables != null) { for (int i = 0; i < behaviorSource.Variables.Count; i++) { object value = behaviorSource.Variables[i].GetValue(); if (value is Object && AssetDatabase.GetAssetPath(value as Object).Length == 0) { ErrorCheck.AddError(ref result, ErrorDetails.ErrorType.InvalidVariableReference, null, i, behaviorSource.Variables[i].Name); } } } return(result); }
private static void CheckTaskForErrors(Task task, ref List <ErrorDetails> errorDetails) { if (task.NodeData.Disabled) { return; } if (task is UnknownTask || task is UnknownParentTask) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.UnknownTask, task, null); } if (task.GetType().GetCustomAttributes(typeof(SkipErrorCheckAttribute), false).Length == 0) { FieldInfo[] allFields = TaskUtility.GetAllFields(task.GetType()); for (int i = 0; i < allFields.Length; i++) { FieldInfo fieldInfo = allFields[i]; object value = fieldInfo.GetValue(task); if (TaskUtility.HasAttribute(fieldInfo, typeof(RequiredFieldAttribute)) && !ErrorCheck.IsRequiredFieldValid(fieldInfo.FieldType, value)) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.RequiredField, task, fieldInfo.Name); } if (fieldInfo.FieldType.Equals(typeof(SharedVariable)) || fieldInfo.FieldType.IsSubclassOf(typeof(SharedVariable))) { SharedVariable sharedVariable = value as SharedVariable; if (sharedVariable != null && sharedVariable.IsShared && string.IsNullOrEmpty(sharedVariable.Name) && !TaskUtility.HasAttribute(fieldInfo, typeof(SharedRequiredAttribute))) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.SharedVariable, task, fieldInfo.Name); } } } } if (task is ParentTask && task.NodeData.NodeDesigner != null && !(task.NodeData.NodeDesigner as NodeDesigner).IsEntryDisplay) { ParentTask parentTask = task as ParentTask; if (parentTask.Children == null || parentTask.Children.Count == 0) { ErrorCheck.AddError(ref errorDetails, ErrorDetails.ErrorType.MissingChildren, task, null); } else { for (int j = 0; j < parentTask.Children.Count; j++) { ErrorCheck.CheckTaskForErrors(parentTask.Children[j], ref errorDetails); } } } }
public static List <ErrorDetails> CheckForErrors(BehaviorSource behaviorSource) { if (behaviorSource == null || behaviorSource.EntryTask == null) { return(null); } List <ErrorDetails> result = null; ErrorCheck.CheckTaskForErrors(behaviorSource.EntryTask, ref result); if (behaviorSource.RootTask == null) { ErrorCheck.AddError(ref result, ErrorDetails.ErrorType.MissingChildren, behaviorSource.EntryTask, null); } if (behaviorSource.RootTask != null) { ErrorCheck.CheckTaskForErrors(behaviorSource.RootTask, ref result); } return(result); }