internal static void DrawPreview(IPreviewable defaultPreview, Rect previewArea, UnityEngine.Object[] targets) { if (ObjectPreview.s_Styles == null) { ObjectPreview.s_Styles = new ObjectPreview.Styles(); } string text = string.Empty; Event current = Event.current; if (targets.Length > 1) { Rect rect = new RectOffset(16, 16, 20, 25).Remove(previewArea); int num = Mathf.Max(1, Mathf.FloorToInt((rect.height + 10f) / 77f)); int num2 = Mathf.Max(1, Mathf.FloorToInt((rect.width + 10f) / 65f)); int num3 = num * num2; int num4 = Mathf.Min(targets.Length, 25); bool flag = true; int[] array = new int[] { num2, num }; if (num4 < num3) { array = ObjectPreview.GetGridDivision(rect, num4, 12); flag = false; } int num5 = Mathf.Min(array[0] * array[1], targets.Length); rect.width += 10f; rect.height += 10f; Vector2 vector = new Vector2((float)Mathf.FloorToInt(rect.width / (float)array[0] - 10f), (float)Mathf.FloorToInt(rect.height / (float)array[1] - 10f)); float num6 = Mathf.Min(vector.x, vector.y - 12f); if (flag) { num6 = Mathf.Min(num6, 55f); } bool flag2 = current.type == EventType.MouseDown && current.button == 0 && current.clickCount == 2 && previewArea.Contains(current.mousePosition); defaultPreview.ResetTarget(); for (int i = 0; i < num5; i++) { Rect position = new Rect(rect.x + (float)(i % array[0]) * rect.width / (float)array[0], rect.y + (float)(i / array[0]) * rect.height / (float)array[1], vector.x, vector.y); if (flag2 && position.Contains(Event.current.mousePosition)) { Selection.objects = new UnityEngine.Object[] { defaultPreview.target }; } position.height -= 12f; Rect position2 = new Rect(position.x + (position.width - num6) * 0.5f, position.y + (position.height - num6) * 0.5f, num6, num6); GUI.BeginGroup(position2); Editor.m_AllowMultiObjectAccess = false; defaultPreview.OnInteractivePreviewGUI(new Rect(0f, 0f, num6, num6), ObjectPreview.s_Styles.preBackgroundSolid); Editor.m_AllowMultiObjectAccess = true; GUI.EndGroup(); position.y = position2.yMax; position.height = 16f; GUI.Label(position, targets[i].name, ObjectPreview.s_Styles.previewMiniLabel); defaultPreview.MoveNextTarget(); } defaultPreview.ResetTarget(); if (Event.current.type == EventType.Repaint) { text = string.Format("Previewing {0} of {1} Objects", num5, targets.Length); } } else { defaultPreview.OnInteractivePreviewGUI(previewArea, ObjectPreview.s_Styles.preBackground); if (Event.current.type == EventType.Repaint) { text = defaultPreview.GetInfoString(); if (text != string.Empty) { text = text.Replace("\n", " "); text = string.Format("{0}\n{1}", defaultPreview.target.name, text); } } } if (Event.current.type == EventType.Repaint && text != string.Empty) { float num7 = ObjectPreview.s_Styles.dropShadowLabelStyle.CalcHeight(GUIContent.Temp(text), previewArea.width); EditorGUI.DropShadowLabel(new Rect(previewArea.x, previewArea.yMax - num7 - 5f, previewArea.width, num7), text); } }
internal static void DrawPreview(IPreviewable defaultPreview, Rect previewArea, Object[] targets) { if (ObjectPreview.s_Styles == null) { ObjectPreview.s_Styles = new ObjectPreview.Styles(); } string str1 = string.Empty; Event current = Event.current; if (targets.Length > 1) { Rect rect = new RectOffset(16, 16, 20, 25).Remove(previewArea); int num1 = Mathf.Max(1, Mathf.FloorToInt((float)(((double)rect.height + 10.0) / 77.0))); int num2 = Mathf.Max(1, Mathf.FloorToInt((float)(((double)rect.width + 10.0) / 65.0))); int num3 = num1 * num2; int minimumNr = Mathf.Min(targets.Length, 25); bool flag1 = true; int[] numArray = new int[2] { num2, num1 }; if (minimumNr < num3) { numArray = ObjectPreview.GetGridDivision(rect, minimumNr, 12); flag1 = false; } int num4 = Mathf.Min(numArray[0] * numArray[1], targets.Length); rect.width += 10f; rect.height += 10f; Vector2 vector2 = new Vector2((float)Mathf.FloorToInt((float)((double)rect.width / (double)numArray[0] - 10.0)), (float)Mathf.FloorToInt((float)((double)rect.height / (double)numArray[1] - 10.0))); float num5 = Mathf.Min(vector2.x, vector2.y - 12f); if (flag1) { num5 = Mathf.Min(num5, 55f); } bool flag2 = current.type == EventType.MouseDown && current.button == 0 && current.clickCount == 2 && previewArea.Contains(current.mousePosition); defaultPreview.ResetTarget(); for (int index = 0; index < num4; ++index) { Rect position1 = new Rect(rect.x + (float)(index % numArray[0]) * rect.width / (float)numArray[0], rect.y + (float)(index / numArray[0]) * rect.height / (float)numArray[1], vector2.x, vector2.y); if (flag2 && position1.Contains(Event.current.mousePosition)) { Selection.objects = new Object[1] { defaultPreview.target } } ; position1.height -= 12f; Rect position2 = new Rect(position1.x + (float)(((double)position1.width - (double)num5) * 0.5), position1.y + (float)(((double)position1.height - (double)num5) * 0.5), num5, num5); GUI.BeginGroup(position2); Editor.m_AllowMultiObjectAccess = false; defaultPreview.OnInteractivePreviewGUI(new Rect(0.0f, 0.0f, num5, num5), ObjectPreview.s_Styles.preBackgroundSolid); Editor.m_AllowMultiObjectAccess = true; GUI.EndGroup(); position1.y = position2.yMax; position1.height = 16f; GUI.Label(position1, targets[index].name, ObjectPreview.s_Styles.previewMiniLabel); defaultPreview.MoveNextTarget(); } defaultPreview.ResetTarget(); if (Event.current.type == EventType.Repaint) { str1 = string.Format("Previewing {0} of {1} Objects", (object)num4, (object)targets.Length); } } else { defaultPreview.OnInteractivePreviewGUI(previewArea, ObjectPreview.s_Styles.preBackground); if (Event.current.type == EventType.Repaint) { str1 = defaultPreview.GetInfoString(); if (str1 != string.Empty) { string str2 = str1.Replace("\n", " "); str1 = string.Format("{0}\n{1}", (object)defaultPreview.target.name, (object)str2); } } } if (Event.current.type != EventType.Repaint || !(str1 != string.Empty)) { return; } float height = ObjectPreview.s_Styles.dropShadowLabelStyle.CalcHeight(GUIContent.Temp(str1), previewArea.width); EditorGUI.DropShadowLabel(new Rect(previewArea.x, (float)((double)previewArea.yMax - (double)height - 5.0), previewArea.width, height), str1); }