// PRIVATE private void settingsChanged() { showAlways = QSettings.getInstance().get <int>(QSetting.TagAndLayerType) == (int)QHierarchyTagAndLayerType.Always; showType = (QHierarchyTagAndLayerShowType)QSettings.getInstance().get <int>(QSetting.TagAndLayerSizeShowType); sizeIsPixel = QSettings.getInstance().get <int>(QSetting.TagAndLayerSizeValueType) == (int)QHierarchyTagAndLayerSizeType.Pixel; pixelSize = QSettings.getInstance().get <int>(QSetting.TagAndLayerSizeValuePixel); percentSize = QSettings.getInstance().get <float>(QSetting.TagAndLayerSizeValuePercent); labelSize = (QHierarchyTagAndLayerLabelSize)QSettings.getInstance().get <int>(QSetting.TagAndLayerLabelSize); enabled = QSettings.getInstance().get <bool>(QSetting.TagAndLayerShow); tagColor = QSettings.getInstance().getColor(QSetting.TagAndLayerTagLabelColor); layerColor = QSettings.getInstance().getColor(QSetting.TagAndLayerLayerLabelColor); labelAlpha = QSettings.getInstance().get <float>(QSetting.TagAndLayerLabelAlpha); showComponentDuringPlayMode = QSettings.getInstance().get <bool>(QSetting.TagAndLayerShowDuringPlayMode); QHierarchyTagAndLayerAligment aligment = (QHierarchyTagAndLayerAligment)QSettings.getInstance().get <int>(QSetting.TagAndLayerAligment); switch (aligment) { case QHierarchyTagAndLayerAligment.Left: labelStyle.alignment = TextAnchor.MiddleLeft; break; case QHierarchyTagAndLayerAligment.Center: labelStyle.alignment = TextAnchor.MiddleCenter; break; case QHierarchyTagAndLayerAligment.Right: labelStyle.alignment = TextAnchor.MiddleRight; break; } }
void OnGUI() { bool fixedIconWidth = QHierarchySettings.getSetting <bool>(QHierarchySetting.FixedIconWidth); bool showErrorIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorIcon); bool showGameObjectIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowGameObjectIcon); bool showTagAndLayerText = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowTagAndLayerText); bool showCustomTagIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowCustomTagIcon); bool showLockButton = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowLockButton); bool showStaticIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowStaticIcon); bool showMonoBehaviourIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowMonoBehaviourIcon); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); { GUILayout.Space(5); if (drawTitle(QHierarchySetting.GeneralSettingsFoldout, " General Settings")) { bool showVisibilityButton = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowVisibilityButton); if (EditorGUILayout.ToggleLeft(" Show Visibility Button", showVisibilityButton) != showVisibilityButton) { QHierarchySettings.setSetting(QHierarchySetting.ShowVisibilityButton, !showVisibilityButton); } if (EditorGUILayout.ToggleLeft(" Show Lock Button", showLockButton) != showLockButton) { QHierarchySettings.setSetting(QHierarchySetting.ShowLockButton, !showLockButton); if (showLockButton) { QHierarchy.unlockAll(); } } bool showMeshButton = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowMeshButton); if (EditorGUILayout.ToggleLeft(" Show Renderer Button", showMeshButton) != showMeshButton) { QHierarchySettings.setSetting(QHierarchySetting.ShowMeshButton, !showMeshButton); } if (EditorGUILayout.ToggleLeft(" Show MonoBehavior Icon", showMonoBehaviourIcon) != showMonoBehaviourIcon) { QHierarchySettings.setSetting(QHierarchySetting.ShowMonoBehaviourIcon, !showMonoBehaviourIcon); } if (EditorGUILayout.ToggleLeft(" Show Error Icon", showErrorIcon) != showErrorIcon) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorIcon, !showErrorIcon); } if (EditorGUILayout.ToggleLeft(" Show Game Object icon", showGameObjectIcon) != showGameObjectIcon) { QHierarchySettings.setSetting(QHierarchySetting.ShowGameObjectIcon, !showGameObjectIcon); } if (EditorGUILayout.ToggleLeft(" Show Tag And Layer", showTagAndLayerText) != showTagAndLayerText) { QHierarchySettings.setSetting(QHierarchySetting.ShowTagAndLayerText, !showTagAndLayerText); } if (EditorGUILayout.ToggleLeft(" Show Custom Tag Icon", showCustomTagIcon) != showCustomTagIcon) { QHierarchySettings.setSetting(QHierarchySetting.ShowCustomTagIcon, !showCustomTagIcon); } if (EditorGUILayout.ToggleLeft(" Show Static Button", showStaticIcon) != showStaticIcon) { QHierarchySettings.setSetting(QHierarchySetting.ShowStaticIcon, !showStaticIcon); } } if (drawTitle(QHierarchySetting.AppearanceSettingsFoldout, " Appearance Settings")) { bool showTreeMap = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowTreeMap); if (EditorGUILayout.ToggleLeft(" Show Hierarchy Tree", showTreeMap) != showTreeMap) { QHierarchySettings.setSetting(QHierarchySetting.ShowTreeMap, !showTreeMap); } bool showHiddenObjectList = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowHiddenQHierarchyObjectList); if (EditorGUILayout.ToggleLeft(" Show QHierarchy GameObject", showHiddenObjectList) != showHiddenObjectList) { QHierarchySettings.setSetting(QHierarchySetting.ShowHiddenQHierarchyObjectList, !showHiddenObjectList); } bool showModifierWarning = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowModifierWarning); if (EditorGUILayout.ToggleLeft(" Show Warning When Using Modifier + Click", showModifierWarning) != showModifierWarning) { QHierarchySettings.setSetting(QHierarchySetting.ShowModifierWarning, !showModifierWarning); } if (EditorGUILayout.ToggleLeft(" Fixed Icons Width", fixedIconWidth) != fixedIconWidth) { fixedIconWidth = !fixedIconWidth; QHierarchySettings.setSetting(QHierarchySetting.FixedIconWidth, fixedIconWidth); if (fixedIconWidth) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerSizeType, (int)QHierarchyTagAndLayerSizeType.Fixed); } } int identation = QHierarchySettings.getSetting <int>(QHierarchySetting.Identation); int newIdentation = EditorGUILayout.IntSlider(" Indentation", identation, 0, 200); if (newIdentation != identation) { QHierarchySettings.setSetting(QHierarchySetting.Identation, newIdentation); } } if (drawTitle(QHierarchySetting.OrderSettingsFoldout, " Order Settings")) { List <QHierarchyIconType> iconOrder = QHierarchySettings.getSetting <List <QHierarchyIconType> >(QHierarchySetting.IconOrder); for (int i = 0; i < iconOrder.Count; i++) { QHierarchyIconType type = iconOrder[i]; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField((i + 1).ToString() + ".", GUILayout.Width(15)); Rect rect = EditorGUILayout.GetControlRect(GUILayout.Width(14), GUILayout.Height(14)); if (i > 0) { if (GUI.Button(rect, QHierarchyResource.getTexture(QHierarchyTexture.ButtonUp), GUIStyle.none)) { List <QHierarchyIconType> newIconOrder = new List <QHierarchyIconType>(); for (int j = 0; j < iconOrder.Count; j++) { if (j == i - 1) { newIconOrder.Add(iconOrder[i]); } else if (j == i) { newIconOrder.Add(iconOrder[i - 1]); } else { newIconOrder.Add(iconOrder[j]); } } QHierarchySettings.setSetting(QHierarchySetting.IconOrder, newIconOrder); } } rect.x += 18; if (i < iconOrder.Count - 1) { if (GUI.Button(rect, QHierarchyResource.getTexture(QHierarchyTexture.ButtonDown), GUIStyle.none)) { List <QHierarchyIconType> newIconOrder = new List <QHierarchyIconType>(); for (int j = 0; j < iconOrder.Count; j++) { if (j == i) { newIconOrder.Add(iconOrder[i + 1]); } else if (j == i + 1) { newIconOrder.Add(iconOrder[i]); } else { newIconOrder.Add(iconOrder[j]); } } QHierarchySettings.setSetting(QHierarchySetting.IconOrder, newIconOrder); } } rect.x += 16; rect.width = 200; rect.height = 20; GUI.Label(rect, addSpaces(type.ToString())); } EditorGUILayout.EndHorizontal(); } } if (showLockButton) { if (drawTitle(QHierarchySetting.LockSettingsFoldout, " Lock Settings")) { bool blockLockSelection = QHierarchySettings.getSetting <bool>(QHierarchySetting.PreventSelectionOfLockedObjects); if (EditorGUILayout.ToggleLeft(" Prevent selection of locked objects", blockLockSelection) != blockLockSelection) { QHierarchySettings.setSetting(QHierarchySetting.PreventSelectionOfLockedObjects, !blockLockSelection); } } } if (showMonoBehaviourIcon) { if (drawTitle(QHierarchySetting.MonoBehaviourIconFoldout, " MonoBehaviour Icon Settings")) { bool ignoreUnityMonobehaviour = QHierarchySettings.getSetting <bool>(QHierarchySetting.IgnoreUnityMonobehaviour); if (EditorGUILayout.ToggleLeft(" Ignore UnityEngine MonoBehaviours", ignoreUnityMonobehaviour) != ignoreUnityMonobehaviour) { QHierarchySettings.setSetting(QHierarchySetting.IgnoreUnityMonobehaviour, !ignoreUnityMonobehaviour); } } } if (showErrorIcon) { if (drawTitle(QHierarchySetting.ErrorIconSettingsFoldout, " Error Icon Settings")) { bool showErrorIconParent = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorIconParent); if (EditorGUILayout.ToggleLeft(" Show error icon on parent game object", showErrorIconParent) != showErrorIconParent) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorIconParent, !showErrorIconParent); } bool showErrorForDisabledComponents = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorForDisabledComponents); if (EditorGUILayout.ToggleLeft(" Show error for disabled components", showErrorForDisabledComponents) != showErrorForDisabledComponents) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorForDisabledComponents, !showErrorForDisabledComponents); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Show the following error types:"); bool showErrorIconTypeScriptMissing = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorIconScriptIsMissing); if (EditorGUILayout.ToggleLeft(" Script is missing", showErrorIconTypeScriptMissing) != showErrorIconTypeScriptMissing) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorIconScriptIsMissing, !showErrorIconTypeScriptMissing); } bool showErrorIconTypeReferenceIsNull = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorIconReferenceIsNull); if (EditorGUILayout.ToggleLeft(" Reference is null", showErrorIconTypeReferenceIsNull) != showErrorIconTypeReferenceIsNull) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorIconReferenceIsNull, !showErrorIconTypeReferenceIsNull); } bool showErrorIconTypeStringIsEmpty = QHierarchySettings.getSetting <bool>(QHierarchySetting.ShowErrorIconStringIsEmpty); if (EditorGUILayout.ToggleLeft(" String is empty", showErrorIconTypeStringIsEmpty) != showErrorIconTypeStringIsEmpty) { QHierarchySettings.setSetting(QHierarchySetting.ShowErrorIconStringIsEmpty, !showErrorIconTypeStringIsEmpty); } } } if (showTagAndLayerText) { if (drawTitle(QHierarchySetting.TagAndLayerSettingsFoldout, " Tag And Layer Settings")) { QHierarchyTagAndLayerType tagAndLayerType = (QHierarchyTagAndLayerType)QHierarchySettings.getSetting <int>(QHierarchySetting.TagAndLayerType); QHierarchyTagAndLayerType newTagAndLayerType; if ((newTagAndLayerType = (QHierarchyTagAndLayerType)EditorGUILayout.EnumPopup("Show", tagAndLayerType)) != tagAndLayerType) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerType, (int)newTagAndLayerType); } if (fixedIconWidth) { GUI.enabled = false; } QHierarchyTagAndLayerSizeType tagAndLayerSizeType = (QHierarchyTagAndLayerSizeType)QHierarchySettings.getSetting <int>(QHierarchySetting.TagAndLayerSizeType); QHierarchyTagAndLayerSizeType newTagAndLayerSizeType; if ((newTagAndLayerSizeType = (QHierarchyTagAndLayerSizeType)EditorGUILayout.EnumPopup("Layout", tagAndLayerSizeType)) != tagAndLayerSizeType) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerSizeType, (int)newTagAndLayerSizeType); } if (fixedIconWidth) { GUI.enabled = true; } if (newTagAndLayerSizeType != QHierarchyTagAndLayerSizeType.Float) { QHierarchyTagAndLayerSizeValueType tagAndLayerSizeValueType = (QHierarchyTagAndLayerSizeValueType)QHierarchySettings.getSetting <int>(QHierarchySetting.TagAndLayerSizeValueType); QHierarchyTagAndLayerSizeValueType newTagAndLayerSizeValueType; if ((newTagAndLayerSizeValueType = (QHierarchyTagAndLayerSizeValueType)EditorGUILayout.EnumPopup("Type", tagAndLayerSizeValueType)) != tagAndLayerSizeValueType) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerSizeValueType, (int)newTagAndLayerSizeValueType); } if (newTagAndLayerSizeValueType == QHierarchyTagAndLayerSizeValueType.Pixel) { int tagAndLayerSizeValue = QHierarchySettings.getSetting <int>(QHierarchySetting.TagAndLayerSizeValue); int newLayerSizeValue = EditorGUILayout.IntSlider("Pixel Width", tagAndLayerSizeValue, 1, 250); if (newLayerSizeValue != tagAndLayerSizeValue) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerSizeValue, newLayerSizeValue); } } else { float tagAndLayerSizeValuePercent = QHierarchySettings.getSetting <float>(QHierarchySetting.TagAndLayerSizeValuePercent); float newtagAndLayerSizeValuePercent = EditorGUILayout.Slider("Percent Width", tagAndLayerSizeValuePercent, 0, 0.5f); if (tagAndLayerSizeValuePercent != newtagAndLayerSizeValuePercent) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerSizeValuePercent, newtagAndLayerSizeValuePercent); } } QHierarchyTagAndLayerAligment tagAndLayerAligment = (QHierarchyTagAndLayerAligment)QHierarchySettings.getSetting <int>(QHierarchySetting.TagAndLayerAligment); QHierarchyTagAndLayerAligment newTagAndLayerAligment; if ((newTagAndLayerAligment = (QHierarchyTagAndLayerAligment)EditorGUILayout.EnumPopup("Alignment", tagAndLayerAligment)) != tagAndLayerAligment) { QHierarchySettings.setSetting(QHierarchySetting.TagAndLayerAligment, (int)newTagAndLayerAligment); } } } } if (showCustomTagIcon) { if (drawTitle(QHierarchySetting.CustomTagIconFoldout, " Custom Tag Icon")) { bool replaceGameObjectIcon = QHierarchySettings.getSetting <bool>(QHierarchySetting.CustomTagIconReplace); if (EditorGUILayout.ToggleLeft(" Replace Game Object Icon", replaceGameObjectIcon) != replaceGameObjectIcon) { QHierarchySettings.setSetting(QHierarchySetting.CustomTagIconReplace, !replaceGameObjectIcon); } bool customTagIconTextureListFoldout = QHierarchySettings.getSetting <bool>(QHierarchySetting.CustomTagIconTextureListFoldout); bool customTagIconTextureListFoldoutNew = EditorGUILayout.Foldout(customTagIconTextureListFoldout, " Custom Tag Icon Texture List"); if (customTagIconTextureListFoldoutNew != customTagIconTextureListFoldout) { QHierarchySettings.setSetting(QHierarchySetting.CustomTagIconTextureListFoldout, customTagIconTextureListFoldoutNew); } if (customTagIconTextureListFoldoutNew) { EditorGUI.indentLevel++; drawTagTextureList(); EditorGUI.indentLevel--; } } } EditorGUILayout.Space(); } EditorGUILayout.EndScrollView(); }
private void drawTagLayerComponentSettings() { if (drawComponentCheckBox(QSetting.ShowTagLayerComponent, "Tag And Layer")) { Rect rect = getControlRect(0, 16); drawBackground(rect.x, rect.y, rect.width, 18 * 6 + 5); rect.x += 31; rect.width -= 31 + 6; drawCheckBoxRight(rect, QSetting.ShowTagLayerComponentDuringPlayMode, "Show Component During Play Mode"); drawSpace(5); // SHOW QHierarchyTagAndLayerType tagAndLayerType = (QHierarchyTagAndLayerType)QSettings.getInstance().get <int>(QSetting.TagAndLayerType); QHierarchyTagAndLayerType newTagAndLayerType; if ((newTagAndLayerType = (QHierarchyTagAndLayerType)EditorGUI.EnumPopup(getControlRect(0, 16, 31, 6), "Show Tag And Layer", tagAndLayerType)) != tagAndLayerType) { QSettings.getInstance().set(QSetting.TagAndLayerType, (int)newTagAndLayerType); } drawSpace(2); // LABEL SIZE QHierarchyTagAndLayerLabelSize tagAndLayerLabelSize = (QHierarchyTagAndLayerLabelSize)QSettings.getInstance().get <int>(QSetting.TagAndLayerLabelSize); QHierarchyTagAndLayerLabelSize newTagAndLayerLabelSize; if ((newTagAndLayerLabelSize = (QHierarchyTagAndLayerLabelSize)EditorGUI.EnumPopup(getControlRect(0, 16, 31, 6), "Label Size", tagAndLayerLabelSize)) != tagAndLayerLabelSize) { QSettings.getInstance().set(QSetting.TagAndLayerLabelSize, (int)newTagAndLayerLabelSize); } drawSpace(2); // SIZE TYPE QHierarchyTagAndLayerSizeType tagAndLayerSizeValueType = (QHierarchyTagAndLayerSizeType)QSettings.getInstance().get <int>(QSetting.TagAndLayerSizeValueType); QHierarchyTagAndLayerSizeType newTagAndLayerSizeValueType; if ((newTagAndLayerSizeValueType = (QHierarchyTagAndLayerSizeType)EditorGUI.EnumPopup(getControlRect(0, 16, 31, 6), "Unit Of Width", tagAndLayerSizeValueType)) != tagAndLayerSizeValueType) { QSettings.getInstance().set(QSetting.TagAndLayerSizeValueType, (int)newTagAndLayerSizeValueType); } drawSpace(2); // SIZE if (newTagAndLayerSizeValueType == QHierarchyTagAndLayerSizeType.Pixel) { int tagAndLayerSizeValue = QSettings.getInstance().get <int>(QSetting.TagAndLayerSizeValuePixel); int newLayerSizeValue = EditorGUI.IntSlider(getControlRect(0, 16, 31, 6), "Width In Pixels", tagAndLayerSizeValue, 1, 250); if (newLayerSizeValue != tagAndLayerSizeValue) { QSettings.getInstance().set(QSetting.TagAndLayerSizeValuePixel, newLayerSizeValue); } } else { float tagAndLayerSizeValuePercent = QSettings.getInstance().get <float>(QSetting.TagAndLayerSizeValuePercent); float newtagAndLayerSizeValuePercent = EditorGUI.Slider(getControlRect(0, 16, 31, 6), "Percentage Width", tagAndLayerSizeValuePercent, 0, 0.5f); if (tagAndLayerSizeValuePercent != newtagAndLayerSizeValuePercent) { QSettings.getInstance().set(QSetting.TagAndLayerSizeValuePercent, newtagAndLayerSizeValuePercent); } } drawSpace(2); // ALIGNMENT QHierarchyTagAndLayerAligment tagAndLayerAligment = (QHierarchyTagAndLayerAligment)QSettings.getInstance().get <int>(QSetting.TagAndLayerAligment); QHierarchyTagAndLayerAligment newTagAndLayerAligment; if ((newTagAndLayerAligment = (QHierarchyTagAndLayerAligment)EditorGUI.EnumPopup(getControlRect(0, 16, 31, 6), "Alignment", tagAndLayerAligment)) != tagAndLayerAligment) { QSettings.getInstance().set(QSetting.TagAndLayerAligment, (int)newTagAndLayerAligment); } drawSpace(3); } }