public override void OnInspectorGUI()
        {
            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, "m_JobOptions");

            GUILayout.BeginHorizontal();
            GUILayout.Space(0);
            EditorGUILayout.PropertyField(m_JobOptions, Styles.kJobOptionsLabel, true);
            GUILayout.EndHorizontal();

            m_GizmoSettingsFade.value = m_GizmoSettingsFade.target = EditorGUILayout.Foldout(m_GizmoSettingsFade.target, Styles.kGizmosLabel, true);

            if (m_GizmoSettingsFade.value)
            {
                if (EditorGUILayout.BeginFadeGroup(m_GizmoSettingsFade.faded))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_AlwaysShowColliders);
                    EditorGUILayout.PropertyField(m_ShowColliderSleep);
                    EditorGUILayout.PropertyField(m_ColliderAwakeColor);
                    EditorGUILayout.PropertyField(m_ColliderAsleepColor);
                    EditorGUILayout.PropertyField(m_ShowColliderContacts);
                    EditorGUILayout.Slider(m_ContactArrowScale, 0.1f, 1.0f, m_ContactArrowScale.displayName);
                    EditorGUILayout.PropertyField(m_ColliderContactColor);
                    EditorGUILayout.PropertyField(m_ShowColliderAABB);
                    EditorGUILayout.PropertyField(m_ColliderAABBColor);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndFadeGroup();
            }
            serializedObject.ApplyModifiedProperties();

            LayerMatrixGUI.DoGUI(Styles.kLayerCollisionMatrixLabel, ref m_ShowLayerCollisionMatrix, GetValue, SetValue);
        }
Beispiel #2
0
 public override void OnInspectorGUI()
 {
     base.DrawDefaultInspector();
     Physics2DSettingsInspector.s_ShowGizmoSettings = EditorGUILayout.Foldout(Physics2DSettingsInspector.s_ShowGizmoSettings, "Gizmos");
     this.m_GizmoSettingsFade.target = Physics2DSettingsInspector.s_ShowGizmoSettings;
     if (this.m_GizmoSettingsFade.value)
     {
         base.serializedObject.Update();
         if (EditorGUILayout.BeginFadeGroup(this.m_GizmoSettingsFade.faded))
         {
             EditorGUI.indentLevel++;
             EditorGUILayout.PropertyField(this.m_AlwaysShowColliders, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_ShowColliderSleep, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_ColliderAwakeColor, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_ColliderAsleepColor, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_ShowColliderContacts, new GUILayoutOption[0]);
             EditorGUILayout.Slider(this.m_ContactArrowScale, 0.1f, 1f, this.m_ContactArrowScale.displayName, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_ColliderContactColor, new GUILayoutOption[0]);
             EditorGUI.indentLevel--;
         }
         EditorGUILayout.EndFadeGroup();
         base.serializedObject.ApplyModifiedProperties();
     }
     LayerMatrixGUI.DoGUI("Layer Collision Matrix", ref this.m_ShowLayerCollisionMatrix, ref this.m_LayerCollisionMatrixScrollPos, new LayerMatrixGUI.GetValueFunc(Physics2DSettingsInspector.GetValue), new LayerMatrixGUI.SetValueFunc(Physics2DSettingsInspector.SetValue));
 }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Editor.DrawPropertiesExcluding(base.serializedObject, new string[]
            {
                "m_ClothInterCollisionDistance",
                "m_ClothInterCollisionStiffness",
                "m_ClothInterCollisionSettingsToggle"
            });
            base.serializedObject.ApplyModifiedProperties();
            LayerMatrixGUI.DoGUI("Layer Collision Matrix", ref this.show, ref this.scrollPos, new LayerMatrixGUI.GetValueFunc(this.GetValue), new LayerMatrixGUI.SetValueFunc(this.SetValue));
            EditorGUI.BeginChangeCheck();
            bool interCollisionSettingsToggle = EditorGUILayout.Toggle(PhysicsManagerInspector.Styles.interCollisionPropertiesLabel, Physics.interCollisionSettingsToggle, new GUILayoutOption[0]);
            bool flag = EditorGUI.EndChangeCheck();

            if (flag)
            {
                Undo.RecordObject(base.target, "Change inter collision settings");
                Physics.interCollisionSettingsToggle = interCollisionSettingsToggle;
            }
            if (Physics.interCollisionSettingsToggle)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                float num   = EditorGUILayout.FloatField(PhysicsManagerInspector.Styles.interCollisionDistanceLabel, Physics.interCollisionDistance, new GUILayoutOption[0]);
                bool  flag2 = EditorGUI.EndChangeCheck();
                if (flag2)
                {
                    Undo.RecordObject(base.target, "Change inter collision distance");
                    if (num < 0f)
                    {
                        num = 0f;
                    }
                    Physics.interCollisionDistance = num;
                }
                EditorGUI.BeginChangeCheck();
                float num2  = EditorGUILayout.FloatField(PhysicsManagerInspector.Styles.interCollisionStiffnessLabel, Physics.interCollisionStiffness, new GUILayoutOption[0]);
                bool  flag3 = EditorGUI.EndChangeCheck();
                if (flag3)
                {
                    Undo.RecordObject(base.target, "Change inter collision stiffness");
                    if (num2 < 0f)
                    {
                        num2 = 0f;
                    }
                    Physics.interCollisionStiffness = num2;
                }
                EditorGUI.indentLevel--;
            }
        }
Beispiel #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, "m_ClothInterCollisionDistance", "m_ClothInterCollisionStiffness", "m_ClothInterCollisionSettingsToggle");
            serializedObject.ApplyModifiedProperties();

            LayerMatrixGUI.DoGUI(Styles.kLayerCollisionMatrixLabel, ref show, GetValue, SetValue);

            EditorGUI.BeginChangeCheck();
            bool collisionSettings = EditorGUILayout.Toggle(Styles.interCollisionPropertiesLabel, Physics.interCollisionSettingsToggle);
            bool settingsChanged   = EditorGUI.EndChangeCheck();

            if (settingsChanged)
            {
                Undo.RecordObject(target, "Change inter collision settings");
                Physics.interCollisionSettingsToggle = collisionSettings;
            }

            if (Physics.interCollisionSettingsToggle)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                float distance        = EditorGUILayout.FloatField(Styles.interCollisionDistanceLabel, Physics.interCollisionDistance);
                bool  distanceChanged = EditorGUI.EndChangeCheck();
                if (distanceChanged)
                {
                    Undo.RecordObject(target, "Change inter collision distance");
                    if (distance < 0.0f)
                    {
                        distance = 0.0f;
                    }
                    Physics.interCollisionDistance = distance;
                }

                EditorGUI.BeginChangeCheck();
                float stiffness        = EditorGUILayout.FloatField(Styles.interCollisionStiffnessLabel, Physics.interCollisionStiffness);
                bool  stiffnessChanged = EditorGUI.EndChangeCheck();
                if (stiffnessChanged)
                {
                    Undo.RecordObject(target, "Change inter collision stiffness");
                    if (stiffness < 0.0f)
                    {
                        stiffness = 0.0f;
                    }
                    Physics.interCollisionStiffness = stiffness;
                }
                EditorGUI.indentLevel--;
            }
        }
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Editor.DrawPropertiesExcluding(base.serializedObject, new string[]
            {
                "m_JobOptions"
            });
            EditorGUILayout.PropertyField(this.m_JobOptions, Physics2DSettingsInspector.Styles.kJobOptionsLabel, true, new GUILayoutOption[0]);
            Physics2DSettingsInspector.s_ShowGizmoSettings = EditorGUILayout.Foldout(Physics2DSettingsInspector.s_ShowGizmoSettings, "Gizmos", true);
            this.m_GizmoSettingsFade.target = Physics2DSettingsInspector.s_ShowGizmoSettings;
            if (this.m_GizmoSettingsFade.value)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_GizmoSettingsFade.faded))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.m_AlwaysShowColliders, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ShowColliderSleep, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ColliderAwakeColor, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ColliderAsleepColor, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ShowColliderContacts, new GUILayoutOption[0]);
                    EditorGUILayout.Slider(this.m_ContactArrowScale, 0.1f, 1f, this.m_ContactArrowScale.displayName, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ColliderContactColor, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ShowColliderAABB, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_ColliderAABBColor, new GUILayoutOption[0]);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndFadeGroup();
            }
            base.serializedObject.ApplyModifiedProperties();
            string arg_1B5_0 = "Layer Collision Matrix";

            if (Physics2DSettingsInspector.< > f__mg$cache0 == null)
            {
                Physics2DSettingsInspector.< > f__mg$cache0 = new LayerMatrixGUI.GetValueFunc(Physics2DSettingsInspector.GetValue);
            }
            LayerMatrixGUI.GetValueFunc arg_1B5_3 = Physics2DSettingsInspector.< > f__mg$cache0;
            if (Physics2DSettingsInspector.< > f__mg$cache1 == null)
            {
                Physics2DSettingsInspector.< > f__mg$cache1 = new LayerMatrixGUI.SetValueFunc(Physics2DSettingsInspector.SetValue);
            }
            LayerMatrixGUI.DoGUI(arg_1B5_0, ref this.m_ShowLayerCollisionMatrix, ref this.m_LayerCollisionMatrixScrollPos, arg_1B5_3, Physics2DSettingsInspector.< > f__mg$cache1);
        }
Beispiel #6
0
 public override void OnInspectorGUI()
 {
     base.DrawDefaultInspector();
     LayerMatrixGUI.DoGUI("Layer Collision Matrix", ref this.show, ref this.scrollPos, new LayerMatrixGUI.GetValueFunc(this.GetValue), new LayerMatrixGUI.SetValueFunc(this.SetValue));
 }
 public static void DoGUI(string title, ref bool show, ref Vector2 scrollPos, LayerMatrixGUI.GetValueFunc getValue, LayerMatrixGUI.SetValueFunc setValue)
 {
   int num1 = 0;
   for (int layer = 0; layer < 32; ++layer)
   {
     if (LayerMask.LayerToName(layer) != string.Empty)
       ++num1;
   }
   GUILayout.BeginHorizontal();
   GUILayout.Space(0.0f);
   show = EditorGUILayout.Foldout(show, title);
   GUILayout.EndHorizontal();
   if (!show)
     return;
   scrollPos = GUILayout.BeginScrollView(scrollPos, new GUILayoutOption[2]
   {
     GUILayout.MinHeight(120f),
     GUILayout.MaxHeight((float) (100 + (num1 + 1) * 16))
   });
   Rect rect1 = GUILayoutUtility.GetRect((float) (16 * num1 + 100), 100f);
   Rect topmostRect = GUIClip.topmostRect;
   Vector2 vector2 = GUIClip.Unclip(new Vector2(rect1.x, rect1.y));
   int num2 = 0;
   for (int layer = 0; layer < 32; ++layer)
   {
     if (LayerMask.LayerToName(layer) != string.Empty)
     {
       float num3 = (float) (130 + (num1 - num2) * 16) - (topmostRect.width + scrollPos.x);
       if ((double) num3 < 0.0)
         num3 = 0.0f;
       GUI.matrix = Matrix4x4.TRS(new Vector3((float) (130 + 16 * (num1 - num2)) + vector2.y + vector2.x + scrollPos.y - num3, vector2.y + scrollPos.y, 0.0f), Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0.0f, 0.0f, 90f), Vector3.one);
       if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9.0"))
         GUI.matrix *= Matrix4x4.TRS(new Vector3(-0.5f, -0.5f, 0.0f), Quaternion.identity, Vector3.one);
       GUI.Label(new Rect(2f - vector2.x - scrollPos.y, scrollPos.y - num3, 100f, 16f), LayerMask.LayerToName(layer), (GUIStyle) "RightLabel");
       ++num2;
     }
   }
   GUI.matrix = Matrix4x4.identity;
   int num4 = 0;
   for (int index1 = 0; index1 < 32; ++index1)
   {
     if (LayerMask.LayerToName(index1) != string.Empty)
     {
       int num3 = 0;
       Rect rect2 = GUILayoutUtility.GetRect((float) (30 + 16 * num1 + 100), 16f);
       GUI.Label(new Rect(rect2.x + 30f, rect2.y, 100f, 16f), LayerMask.LayerToName(index1), (GUIStyle) "RightLabel");
       for (int index2 = 31; index2 >= 0; --index2)
       {
         if (LayerMask.LayerToName(index2) != string.Empty)
         {
           if (num3 < num1 - num4)
           {
             GUIContent content = new GUIContent(string.Empty, LayerMask.LayerToName(index1) + "/" + LayerMask.LayerToName(index2));
             bool flag = getValue(index1, index2);
             bool val = GUI.Toggle(new Rect(130f + rect2.x + (float) (num3 * 16), rect2.y, 16f, 16f), flag, content);
             if (val != flag)
               setValue(index1, index2, val);
           }
           ++num3;
         }
       }
       ++num4;
     }
   }
   GUILayout.EndScrollView();
 }
		public static void DoGUI(string title, ref bool show, ref Vector2 scrollPos, LayerMatrixGUI.GetValueFunc getValue, LayerMatrixGUI.SetValueFunc setValue)
		{
			int num = 0;
			for (int i = 0; i < 32; i++)
			{
				if (LayerMask.LayerToName(i) != string.Empty)
				{
					num++;
				}
			}
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);
			GUILayout.Space(0f);
			show = EditorGUILayout.Foldout(show, title);
			GUILayout.EndHorizontal();
			if (show)
			{
				scrollPos = GUILayout.BeginScrollView(scrollPos, new GUILayoutOption[]
				{
					GUILayout.MinHeight(120f),
					GUILayout.MaxHeight((float)(100 + (num + 1) * 16))
				});
				Rect rect = GUILayoutUtility.GetRect((float)(16 * num + 100), 100f);
				Rect topmostRect = GUIClip.topmostRect;
				Vector2 vector = GUIClip.Unclip(new Vector2(rect.x, rect.y));
				int num2 = 0;
				for (int j = 0; j < 32; j++)
				{
					if (LayerMask.LayerToName(j) != string.Empty)
					{
						float num3 = (float)(130 + (num - num2) * 16) - (topmostRect.width + scrollPos.x);
						if (num3 < 0f)
						{
							num3 = 0f;
						}
						Vector3 pos = new Vector3((float)(130 + 16 * (num - num2)) + vector.y + vector.x + scrollPos.y - num3, vector.y + scrollPos.y, 0f);
						GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, 90f), Vector3.one);
						if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9.0"))
						{
							GUI.matrix *= Matrix4x4.TRS(new Vector3(-0.5f, -0.5f, 0f), Quaternion.identity, Vector3.one);
						}
						GUI.Label(new Rect(2f - vector.x - scrollPos.y, scrollPos.y - num3, 100f, 16f), LayerMask.LayerToName(j), "RightLabel");
						num2++;
					}
				}
				GUI.matrix = Matrix4x4.identity;
				num2 = 0;
				for (int k = 0; k < 32; k++)
				{
					if (LayerMask.LayerToName(k) != string.Empty)
					{
						int num4 = 0;
						Rect rect2 = GUILayoutUtility.GetRect((float)(30 + 16 * num + 100), 16f);
						GUI.Label(new Rect(rect2.x + 30f, rect2.y, 100f, 16f), LayerMask.LayerToName(k), "RightLabel");
						for (int l = 31; l >= 0; l--)
						{
							if (LayerMask.LayerToName(l) != string.Empty)
							{
								if (num4 < num - num2)
								{
									GUIContent content = new GUIContent(string.Empty, LayerMask.LayerToName(k) + "/" + LayerMask.LayerToName(l));
									bool flag = getValue(k, l);
									bool flag2 = GUI.Toggle(new Rect(130f + rect2.x + (float)(num4 * 16), rect2.y, 16f, 16f), flag, content);
									if (flag2 != flag)
									{
										setValue(k, l, flag2);
									}
								}
								num4++;
							}
						}
						num2++;
					}
				}
				GUILayout.EndScrollView();
			}
		}