void DeleteParameter(SerializedProperty elementProperty, CalculatorCondition.Type type, bool deleteParameter) { SerializedProperty parametersProperty = GetParametersProperty(type); if (parametersProperty == null) { return; } SerializedProperty parameterIndexProperty = elementProperty.FindPropertyRelative(kParameterIndexPath); int parameterIndex = parameterIndexProperty.intValue; SerializedProperty parameterProperty = parametersProperty.GetArrayElementAtIndex(parameterIndex); if (parameterProperty == null) { return; } foreach (object valueObj in EditorGUITools.GetPropertyObjects(parameterProperty)) { EachField <DataSlot> .Find(valueObj, valueObj.GetType(), (s) => { s.Disconnect(); }); } if (deleteParameter) { parametersProperty.DeleteArrayElementAtIndex(parameterIndex); for (int i = 0, count = _ConditionsList.serializedProperty.arraySize; i < count; i++) { SerializedProperty p = _ConditionsList.serializedProperty.GetArrayElementAtIndex(i); CalculatorCondition.Type t = GetType(p); if (t != type) { continue; } SerializedProperty indexProperty = p.FindPropertyRelative(kParameterIndexPath); if (indexProperty.intValue > parameterIndex) { indexProperty.intValue--; } } } }
void DeleteOldBranch(Parameter.Type parameterType) { SerializedProperty valueProperty = null; switch (parameterType) { case Parameter.Type.Int: { valueProperty = serializedObject.FindProperty("_IntValue"); } break; case Parameter.Type.Float: { valueProperty = serializedObject.FindProperty("_FloatValue"); } break; case Parameter.Type.Bool: { valueProperty = serializedObject.FindProperty("_BoolValue"); } break; case Parameter.Type.String: { valueProperty = serializedObject.FindProperty("_StringValue"); } break; case Parameter.Type.GameObject: { valueProperty = serializedObject.FindProperty("_GameObjectValue"); } break; case Parameter.Type.Vector2: { valueProperty = serializedObject.FindProperty("_Vector2Value"); } break; case Parameter.Type.Vector3: { valueProperty = serializedObject.FindProperty("_Vector3Value"); } break; case Parameter.Type.Quaternion: { valueProperty = serializedObject.FindProperty("_QuaternionValue"); } break; case Parameter.Type.Rect: { valueProperty = serializedObject.FindProperty("_RectValue"); } break; case Parameter.Type.Bounds: { valueProperty = serializedObject.FindProperty("_BoundsValue"); } break; case Parameter.Type.Color: { valueProperty = serializedObject.FindProperty("_ColorValue"); } break; case Parameter.Type.Transform: { valueProperty = serializedObject.FindProperty("_TransformValue"); } break; case Parameter.Type.RectTransform: { valueProperty = serializedObject.FindProperty("_RectTransformValue"); } break; case Parameter.Type.Rigidbody: { valueProperty = serializedObject.FindProperty("_RigidbodyValue"); } break; case Parameter.Type.Rigidbody2D: { valueProperty = serializedObject.FindProperty("_Rigidbody2DValue"); } break; case Parameter.Type.Component: { valueProperty = serializedObject.FindProperty("_ComponentValue"); } break; case Parameter.Type.Long: { valueProperty = serializedObject.FindProperty("_LongValue"); } break; } if (valueProperty != null) { foreach (object valueObj in EditorGUITools.GetPropertyObjects(valueProperty)) { EachField <DataSlot> .Find(valueObj, valueObj.GetType(), (s) => { s.Disconnect(); }); } } }
void DeleteOldBranch(ParameterConditionLegacyProperty conditionProperty, Parameter.Type type) { SerializedProperty valueProperty = null; switch (type) { case Parameter.Type.Int: { valueProperty = conditionProperty.intValueProperty; } break; case Parameter.Type.Long: { valueProperty = conditionProperty.longValueProperty; } break; case Parameter.Type.Float: { valueProperty = conditionProperty.floatValueProperty; } break; case Parameter.Type.Bool: { valueProperty = conditionProperty.boolValueProperty; } break; case Parameter.Type.String: { valueProperty = conditionProperty.stringValueProperty; } break; case Parameter.Type.GameObject: { valueProperty = conditionProperty.gameObjectValueProperty; } break; case Parameter.Type.Vector2: { valueProperty = conditionProperty.vector2ValueProperty; } break; case Parameter.Type.Vector3: { valueProperty = conditionProperty.vector3ValueProperty; } break; case Parameter.Type.Quaternion: { valueProperty = conditionProperty.quaternionValueProperty; } break; case Parameter.Type.Rect: { valueProperty = conditionProperty.rectValueProperty; } break; case Parameter.Type.Bounds: { valueProperty = conditionProperty.boundsValueProperty; } break; case Parameter.Type.Color: { valueProperty = conditionProperty.colorValueProperty; } break; case Parameter.Type.Transform: { valueProperty = conditionProperty.transformValueProperty; } break; case Parameter.Type.RectTransform: { valueProperty = conditionProperty.rectTransformValueProperty; } break; case Parameter.Type.Rigidbody: { valueProperty = conditionProperty.rigidbodyValueProperty; } break; case Parameter.Type.Rigidbody2D: { valueProperty = conditionProperty.rigidbody2DValueProperty; } break; case Parameter.Type.Component: { valueProperty = conditionProperty.componentValueProperty; } break; } if (valueProperty != null) { foreach (object valueObj in EditorGUITools.GetPropertyObjects(valueProperty)) { EachField <DataSlot> .Find(valueObj, valueObj.GetType(), (s) => { s.Disconnect(); }); } } }