/// <summary> /// Draws the parameters rows. /// </summary> /// <param name="unityInterface">The unity interface.</param> /// <param name="foldout">If set to <c>true</c> [foldout].</param> /// <param name="fullMethodDescription">The full method description.</param> /// <param name="serializedObjects">The serialized objects.</param> /// <param name="lockParametersRows">If set to <c>true</c> [lock parameters rows].</param> public void DrawParametersRows(IUnityInterfaceWrapper unityInterface, bool foldout, FullMethodDescription fullMethodDescription, Dictionary <Type, ISerializedObjectWrapper> serializedObjects, bool lockParametersRows) { if (fullMethodDescription != null && foldout && !lockParametersRows) { ISerializedObjectWrapper serializedObject = null; serializedObjects.TryGetValue(fullMethodDescription.ComponentObject.GetType(), out serializedObject); foreach (MethodParameter parameter in fullMethodDescription.Parameters.Parameters) { string parameterName = parameter.ParameterInfoObject.Name; ParameterLocation parameterLocation = parameter.ParameterLocation; // "given.Array.data[0]" string parameterLocationString = parameterLocation.ParameterArrayLocation.ArrayName + ".Array.data[" + parameterLocation.ParameterArrayLocation.ArrayIndex + "]"; GUIContent label = unityInterface.GUIContent(parameterName); ISerializedPropertyWrapper property = serializedObject.FindProperty(parameterLocationString); unityInterface.EditorGUILayoutPropertyField(property, label); } } if (fullMethodDescription != null && foldout && lockParametersRows) { float labelWidth = unityInterface.EditorGUIUtilityCurrentViewWidth(); unityInterface.EditorGUILayoutLabelField("When there are some errors the parameters are protected to avoid data lost.", labelWidth); } }
/// <summary> /// Rebuilds the serialized objects list. /// </summary> /// <param name="components">The components.</param> /// <param name="serializedObjects">The serialized objects.</param> /// <returns>The new serialized objects list.</returns> public Dictionary <Type, ISerializedObjectWrapper> RebuildSerializedObjectsList(Component[] components, Dictionary <Type, ISerializedObjectWrapper> serializedObjects) { Dictionary <Type, ISerializedObjectWrapper> result = new Dictionary <Type, ISerializedObjectWrapper>(); foreach (Component component in components) { ISerializedObjectWrapper serializedObjectWrapper = null; if (serializedObjects == null || !serializedObjects.ContainsKey(component.GetType())) { serializedObjectWrapper = new SerializedObjectWrapper(component); } else { serializedObjects.TryGetValue(component.GetType(), out serializedObjectWrapper); } result.Add(component.GetType(), serializedObjectWrapper); } return(result); }