private GUIContent GetModeString(ClothInspector.DrawMode mode)
 {
   return ClothInspector.s_ModeStrings[(int) mode];
 }
 private float PaintField(float value, ref bool enabled, ClothInspector.DrawMode mode)
 {
   GUIContent modeString = this.GetModeString(mode);
   GUILayout.BeginHorizontal();
   enabled = (GUILayout.Toggle((enabled ? 1 : 0) != 0, ClothInspector.s_PaintIcon, (GUIStyle) "MiniButton", new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(false)
   }) ? 1 : 0) != 0;
   EditorGUI.BeginDisabledGroup(!enabled);
   EditorGUI.BeginChangeCheck();
   bool flag = EditorGUILayout.Toggle(GUIContent.none, (double) value < 3.40282346638529E+38, new GUILayoutOption[0]);
   if (EditorGUI.EndChangeCheck())
   {
     value = !flag ? float.MaxValue : 0.0f;
     this.drawMode = mode;
   }
   GUILayout.Space(-162f);
   EditorGUI.BeginDisabledGroup(!flag);
   float num1 = value;
   int keyboardControl = GUIUtility.keyboardControl;
   EditorGUI.BeginChangeCheck();
   if (flag)
   {
     num1 = EditorGUILayout.FloatField(modeString, value, new GUILayoutOption[0]);
   }
   else
   {
     double num2 = (double) EditorGUILayout.FloatField(modeString, 0.0f, new GUILayoutOption[0]);
   }
   if ((double) num1 < 0.0)
     num1 = 0.0f;
   if (EditorGUI.EndChangeCheck() || keyboardControl != GUIUtility.keyboardControl)
     this.drawMode = mode;
   EditorGUI.EndDisabledGroup();
   EditorGUI.EndDisabledGroup();
   if (flag)
   {
     float num3 = this.m_MinVisualizedValue[(int) mode];
     float num4 = this.m_MaxVisualizedValue[(int) mode];
     if ((double) num4 - (double) num3 > 0.0)
       this.DrawColorBox((Texture) null, this.GetGradientColor((float) (((double) value - (double) num3) / ((double) num4 - (double) num3))));
     else
       this.DrawColorBox((Texture) null, this.GetGradientColor((double) value > (double) num3 ? 1f : 0.0f));
   }
   else
     this.DrawColorBox((Texture) null, Color.black);
   GUILayout.EndHorizontal();
   return num1;
 }
Пример #3
0
		private float PaintField(float value, ref bool enabled, ClothInspector.DrawMode mode)
		{
			GUIContent modeString = this.GetModeString(mode);
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);
			enabled = GUILayout.Toggle(enabled, ClothInspector.s_PaintIcon, "MiniButton", new GUILayoutOption[]
			{
				GUILayout.ExpandWidth(false)
			});
			EditorGUI.BeginDisabledGroup(!enabled);
			EditorGUI.BeginChangeCheck();
			bool flag = EditorGUILayout.Toggle(GUIContent.none, value < 3.40282347E+38f, new GUILayoutOption[0]);
			if (EditorGUI.EndChangeCheck())
			{
				if (flag)
				{
					value = 0f;
				}
				else
				{
					value = 3.40282347E+38f;
				}
				this.drawMode = mode;
			}
			GUILayout.Space(-162f);
			EditorGUI.BeginDisabledGroup(!flag);
			float num = value;
			int keyboardControl = GUIUtility.keyboardControl;
			EditorGUI.BeginChangeCheck();
			if (flag)
			{
				num = EditorGUILayout.FloatField(modeString, value, new GUILayoutOption[0]);
			}
			else
			{
				EditorGUILayout.FloatField(modeString, 0f, new GUILayoutOption[0]);
			}
			if (num < 0f)
			{
				num = 0f;
			}
			if (EditorGUI.EndChangeCheck() || keyboardControl != GUIUtility.keyboardControl)
			{
				this.drawMode = mode;
			}
			EditorGUI.EndDisabledGroup();
			EditorGUI.EndDisabledGroup();
			if (flag)
			{
				float num2 = this.m_MinVisualizedValue[(int)mode];
				float num3 = this.m_MaxVisualizedValue[(int)mode];
				if (num3 - num2 > 0f)
				{
					this.DrawColorBox(null, this.GetGradientColor((value - num2) / (num3 - num2)));
				}
				else
				{
					this.DrawColorBox(null, this.GetGradientColor((float)((value > num2) ? 1 : 0)));
				}
			}
			else
			{
				this.DrawColorBox(null, Color.black);
			}
			GUILayout.EndHorizontal();
			return num;
		}
 private float CoefficientField(float value, float useValue, bool enabled, ClothInspector.DrawMode mode)
 {
   GUIContent modeString = this.GetModeString(mode);
   EditorGUI.BeginDisabledGroup(!enabled);
   GUILayout.BeginHorizontal();
   EditorGUI.showMixedValue = (double) useValue < 0.0;
   EditorGUI.BeginChangeCheck();
   useValue = !EditorGUILayout.Toggle(GUIContent.none, (double) useValue != 0.0, new GUILayoutOption[0]) ? 0.0f : 1f;
   if (EditorGUI.EndChangeCheck())
   {
     value = (double) useValue <= 0.0 ? float.MaxValue : 0.0f;
     this.drawMode = mode;
   }
   GUILayout.Space(-152f);
   EditorGUI.showMixedValue = false;
   EditorGUI.BeginDisabledGroup((double) useValue != 1.0);
   float num1 = value;
   EditorGUI.showMixedValue = (double) value < 0.0;
   EditorGUI.BeginChangeCheck();
   int keyboardControl = GUIUtility.keyboardControl;
   if ((double) useValue > 0.0)
   {
     num1 = EditorGUILayout.FloatField(modeString, value, new GUILayoutOption[0]);
   }
   else
   {
     double num2 = (double) EditorGUILayout.FloatField(modeString, 0.0f, new GUILayoutOption[0]);
   }
   bool flag = EditorGUI.EndChangeCheck();
   if (flag)
   {
     value = num1;
     if ((double) value < 0.0)
       value = 0.0f;
   }
   if (flag || keyboardControl != GUIUtility.keyboardControl)
     this.drawMode = mode;
   EditorGUI.EndDisabledGroup();
   EditorGUI.EndDisabledGroup();
   if ((double) useValue > 0.0)
   {
     float num3 = this.m_MinVisualizedValue[(int) mode];
     float num4 = this.m_MaxVisualizedValue[(int) mode];
     if ((double) num4 - (double) num3 > 0.0)
       this.DrawColorBox((Texture) null, this.GetGradientColor((float) (((double) value - (double) num3) / ((double) num4 - (double) num3))));
     else
       this.DrawColorBox((Texture) null, this.GetGradientColor((double) value > (double) num3 ? 1f : 0.0f));
   }
   else
     this.DrawColorBox((Texture) null, Color.black);
   EditorGUI.showMixedValue = false;
   GUILayout.EndHorizontal();
   return value;
 }
Пример #5
0
		private float CoefficientField(float value, float useValue, bool enabled, ClothInspector.DrawMode mode)
		{
			GUIContent modeString = this.GetModeString(mode);
			EditorGUI.BeginDisabledGroup(!enabled);
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);
			EditorGUI.showMixedValue = (useValue < 0f);
			EditorGUI.BeginChangeCheck();
			useValue = (float)((!EditorGUILayout.Toggle(GUIContent.none, useValue != 0f, new GUILayoutOption[0])) ? 0 : 1);
			if (EditorGUI.EndChangeCheck())
			{
				if (useValue > 0f)
				{
					value = 0f;
				}
				else
				{
					value = 3.40282347E+38f;
				}
				this.drawMode = mode;
			}
			GUILayout.Space(-152f);
			EditorGUI.showMixedValue = false;
			EditorGUI.BeginDisabledGroup(useValue != 1f);
			float num = value;
			EditorGUI.showMixedValue = (value < 0f);
			EditorGUI.BeginChangeCheck();
			int keyboardControl = GUIUtility.keyboardControl;
			if (useValue > 0f)
			{
				num = EditorGUILayout.FloatField(modeString, value, new GUILayoutOption[0]);
			}
			else
			{
				EditorGUILayout.FloatField(modeString, 0f, new GUILayoutOption[0]);
			}
			bool flag = EditorGUI.EndChangeCheck();
			if (flag)
			{
				value = num;
				if (value < 0f)
				{
					value = 0f;
				}
			}
			if (flag || keyboardControl != GUIUtility.keyboardControl)
			{
				this.drawMode = mode;
			}
			EditorGUI.EndDisabledGroup();
			EditorGUI.EndDisabledGroup();
			if (useValue > 0f)
			{
				float num2 = this.m_MinVisualizedValue[(int)mode];
				float num3 = this.m_MaxVisualizedValue[(int)mode];
				if (num3 - num2 > 0f)
				{
					this.DrawColorBox(null, this.GetGradientColor((value - num2) / (num3 - num2)));
				}
				else
				{
					this.DrawColorBox(null, this.GetGradientColor((float)((value > num2) ? 1 : 0)));
				}
			}
			else
			{
				this.DrawColorBox(null, Color.black);
			}
			EditorGUI.showMixedValue = false;
			GUILayout.EndHorizontal();
			return value;
		}