// PRIVATE private void drawComponentLabel(Rect rect, QHierarchyComponentEnum type, bool withBackground = false) { if (withBackground) { EditorGUI.DrawRect(new Rect(rect.x, rect.y - 2, rect.width, 20), backgroundColor); } GUI.DrawTexture(new Rect(rect.x, rect.y - 2, 20, 20), dragButton); Rect labelRect = new Rect(rect.x + 31, rect.y, rect.width - 20, 16); labelRect.y -= (EditorGUIUtility.singleLineHeight - labelRect.height) * 0.5f; EditorGUI.LabelField(labelRect, getTextWithSpaces(type.ToString())); }
// PRIVATE private void drawComponentLabel(Rect rect, QHierarchyComponentEnum type, bool withBackground = false) { if (withBackground) { EditorGUI.DrawRect(new Rect(rect.x, rect.y - 2, rect.width, 20), backgroundColor); } GUI.DrawTexture(new Rect(rect.x, rect.y - 2, 20, 20), dragButton); GUI.Label(new Rect(rect.x + 27, rect.y, rect.width - 20, 16), getTextWithSpaces(type.ToString())); }
// ORDER private void drawOrderSettings() { indentLevel += 8; string componentOrder = QSettings.getInstance().get <string>(QSetting.ComponentOrder); string[] componentIds = componentOrder.Split(';'); for (int i = 0; i < componentIds.Length; i++) { QHierarchyComponentEnum type = (QHierarchyComponentEnum)int.Parse(componentIds[i]); Rect rect = getControlRect(14, 17); if (i > 0) { if (GUI.Button(rect, orderUp, GUIStyle.none)) { string newIconOrder = ""; for (int j = 0; j < componentIds.Length; j++) { if (j == i - 1) { newIconOrder += componentIds[i] + ";"; } else if (j == i) { newIconOrder += componentIds[i - 1] + ";"; } else { newIconOrder += componentIds[j] + ";"; } } newIconOrder = newIconOrder.TrimEnd(';'); QSettings.getInstance().set(QSetting.ComponentOrder, newIconOrder); } } rect.x += 17; if (i < componentIds.Length - 1) { if (GUI.Button(rect, orderDown, GUIStyle.none)) { string newIconOrder = ""; for (int j = 0; j < componentIds.Length; j++) { if (j == i) { newIconOrder += componentIds[i + 1] + ";"; } else if (j == i + 1) { newIconOrder += componentIds[i] + ";"; } else { newIconOrder += componentIds[j] + ";"; } } newIconOrder = newIconOrder.TrimEnd(';'); QSettings.getInstance().set(QSetting.ComponentOrder, newIconOrder); } } rect.x += 19; rect.y -= 1; rect.width = 200; rect.height = 22; GUI.Label(rect, getTextWithSpaces(type.ToString())); } indentLevel -= 8; }