private void InputGUI(ProceduralPropertyDescription input)
{
float num;
ProceduralPropertyType type = input.type;
GUIContent label = new GUIContent(input.label, input.name);
switch (type)
{
case ProceduralPropertyType.Boolean:
{
EditorGUI.BeginChangeCheck();
bool flag = EditorGUILayout.Toggle(label, m_Material.GetProceduralBoolean(input.name), new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralBoolean(input.name, flag);
}
return;
}
case ProceduralPropertyType.Float:
{
EditorGUI.BeginChangeCheck();
if (!input.hasRange)
{
num = EditorGUILayout.FloatField(label, m_Material.GetProceduralFloat(input.name), new GUILayoutOption[0]);
break;
}
float minimum = input.minimum;
float maximum = input.maximum;
num = EditorGUILayout.Slider(label, m_Material.GetProceduralFloat(input.name), minimum, maximum, new GUILayoutOption[0]);
break;
}
case ProceduralPropertyType.Vector2:
case ProceduralPropertyType.Vector3:
case ProceduralPropertyType.Vector4:
{
int num4 = (type != ProceduralPropertyType.Vector2) ? ((type != ProceduralPropertyType.Vector3) ? 4 : 3) : 2;
Vector4 proceduralVector = m_Material.GetProceduralVector(input.name);
EditorGUI.BeginChangeCheck();
if (!input.hasRange)
{
switch (num4)
{
case 2:
proceduralVector = EditorGUILayout.Vector2Field(input.name, (Vector2) proceduralVector, new GUILayoutOption[0]);
break;
case 3:
proceduralVector = EditorGUILayout.Vector3Field(input.name, (Vector3) proceduralVector, new GUILayoutOption[0]);
break;
case 4:
proceduralVector = EditorGUILayout.Vector4Field(input.name, proceduralVector, new GUILayoutOption[0]);
break;
}
}
else
{
float leftValue = input.minimum;
float rightValue = input.maximum;
EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.Space((float) (EditorGUI.indentLevel * 15));
GUILayout.Label(label, new GUILayoutOption[0]);
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel++;
for (int i = 0; i < num4; i++)
{
proceduralVector[i] = EditorGUILayout.Slider(new GUIContent(input.componentLabels[i]), proceduralVector[i], leftValue, rightValue, new GUILayoutOption[0]);
}
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
}
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralVector(input.name, proceduralVector);
}
return;
}
case ProceduralPropertyType.Color3:
case ProceduralPropertyType.Color4:
{
EditorGUI.BeginChangeCheck();
Color color = EditorGUILayout.ColorField(label, m_Material.GetProceduralColor(input.name), new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralColor(input.name, color);
}
return;
}
case ProceduralPropertyType.Enum:
{
GUIContent[] displayedOptions = new GUIContent[input.enumOptions.Length];
for (int j = 0; j < displayedOptions.Length; j++)
{
displayedOptions[j] = new GUIContent(input.enumOptions[j]);
}
EditorGUI.BeginChangeCheck();
int num9 = EditorGUILayout.Popup(label, m_Material.GetProceduralEnum(input.name), displayedOptions, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralEnum(input.name, num9);
}
return;
}
case ProceduralPropertyType.Texture:
{
EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.Space((float) (EditorGUI.indentLevel * 15));
GUILayout.Label(label, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
Rect position = GUILayoutUtility.GetRect((float) 64f, (float) 64f, options);
EditorGUI.BeginChangeCheck();
Texture2D textured = EditorGUI.DoObjectField(position, position, GUIUtility.GetControlID(0x3042, FocusType.Keyboard, position), m_Material.GetProceduralTexture(input.name), typeof(Texture2D), null, null, false) as Texture2D;
EditorGUILayout.EndHorizontal();
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralTexture(input.name, textured);
}
return;
}
default:
return;
}
if (EditorGUI.EndChangeCheck())
{
this.RecordForUndo(m_Material, m_Importer, "Modified property " + input.name + " for material " + m_Material.name);
m_Material.SetProceduralFloat(input.name, num);
}
}