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); }
public static void DoGUI(string title, ref bool show, ref Vector2 scrollPos, LayerMatrixGUI.GetValueFunc getValue, LayerMatrixGUI.SetValueFunc setValue) { int num = 100; int num2 = 0; for (int i = 0; i < 32; i++) { if (LayerMask.LayerToName(i) != "") { num2++; } } for (int j = 0; j < 32; j++) { Vector2 vector = GUI.skin.label.CalcSize(new GUIContent(LayerMask.LayerToName(j))); if ((float)num < vector.x) { num = (int)vector.x; } } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(0f); show = EditorGUILayout.Foldout(show, title, true); GUILayout.EndHorizontal(); if (show) { scrollPos = GUILayout.BeginScrollView(scrollPos, new GUILayoutOption[] { GUILayout.MinHeight((float)(num + 20)), GUILayout.MaxHeight((float)(num + (num2 + 1) * 16)) }); Rect rect = GUILayoutUtility.GetRect((float)(16 * num2 + num), (float)num); Rect topmostRect = GUIClip.topmostRect; Vector2 vector2 = GUIClip.Unclip(new Vector2(rect.x, rect.y)); int num3 = 0; for (int k = 0; k < 32; k++) { if (LayerMask.LayerToName(k) != "") { float num4 = (float)(num + 30 + (num2 - num3) * 16) - (topmostRect.width + scrollPos.x); if (num4 < 0f) { num4 = 0f; } Vector3 pos = new Vector3((float)(num + 30 + 16 * (num2 - num3)) + vector2.y + vector2.x + scrollPos.y - num4, vector2.y + scrollPos.y, 0f); GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, 90f), Vector3.one); GUI.Label(new Rect(2f - vector2.x - scrollPos.y, scrollPos.y - num4, (float)num, 16f), LayerMask.LayerToName(k), "RightLabel"); num3++; } } GUI.matrix = Matrix4x4.identity; num3 = 0; for (int l = 0; l < 32; l++) { if (LayerMask.LayerToName(l) != "") { int num5 = 0; Rect rect2 = GUILayoutUtility.GetRect((float)(30 + 16 * num2 + num), 16f); GUI.Label(new Rect(rect2.x + 30f, rect2.y, (float)num, 16f), LayerMask.LayerToName(l), "RightLabel"); for (int m = 31; m >= 0; m--) { if (LayerMask.LayerToName(m) != "") { if (num5 < num2 - num3) { GUIContent content = new GUIContent("", LayerMask.LayerToName(l) + "/" + LayerMask.LayerToName(m)); bool flag = getValue(l, m); bool flag2 = GUI.Toggle(new Rect((float)(num + 30) + rect2.x + (float)(num5 * 16), rect2.y, 16f, 16f), flag, content); if (flag2 != flag) { setValue(l, m, flag2); } } num5++; } } num3++; } } 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) != "") { num++; } } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(0f); show = EditorGUILayout.Foldout(show, title, true); 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) != "") { 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) != "") { 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) != "") { if (num4 < num - num2) { GUIContent content = new GUIContent("", 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(); } }
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(); }