int GetPropertyIndex(LevelSegment.ObjectProperty[] properties, LevelSegment.ObjectProperty property) { for (int i = 0; i < properties.Length; i++) { if (property == properties[i]) { return(i); } } return(0); }
void ObjectPropertiesUI(PropertyBinder[] binders, LevelSegment.ObjectProperty[] properties) { input.Update(); for (int i = 0; i < binders.Length; i++) { LevelSegment.ObjectProperty property = properties[binders[i].index]; if (selectedProperties.Contains(binders[i].index)) { GUI.backgroundColor = ForeverPrefs.highlightColor; GUI.contentColor = ForeverPrefs.highlightContentColor; } else { if (property.extrusionSettings.ignore) { GUI.backgroundColor = Color.gray; } else { GUI.backgroundColor = DreamteckEditorGUI.lightColor; } GUI.contentColor = new Color(1f, 1f, 1f, 0.8f); } GUILayout.BeginVertical(boxStyle); EditorGUILayout.LabelField(i + " " + binders[i].name); GUILayout.EndVertical(); Rect lastRect = GUILayoutUtility.GetLastRect(); lastRect.width -= 30; if (lastRect.Contains(Event.current.mousePosition) && input.mouseLeft) { if (Event.current.shift) { if (selectedProperties.Count == 0) { selectedProperties.Add(binders[i].index); } else { if (i < selectedProperties[0]) { for (int n = selectedProperties[0] - 1; n >= i; n--) { if (!selectedProperties.Contains(binders[n].index)) { selectedProperties.Add(binders[n].index); } } } else { for (int n = selectedProperties[0] + 1; n <= i; n++) { if (!selectedProperties.Contains(binders[n].index)) { selectedProperties.Add(binders[n].index); } } } } } else { if (Event.current.control) { if (!selectedProperties.Contains(binders[i].index)) { selectedProperties.Add(binders[i].index); } } else { selectedProperties.Clear(); selectedProperties.Add(binders[i].index); } } Repaint(); if (propertyWindow != null) { propertyWindow.Repaint(); } SceneView.RepaintAll(); } lastRect.width += 30; } GUI.backgroundColor = Color.white; GUI.contentColor = Color.white; }