// CONSTRUCTOR public QLayerIconComponent() { rect.width = 14; rect.height = 14; QSettings.getInstance().addEventListener(QSetting.LayerIconShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.LayerIconShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.LayerIconSize, settingsChanged); QSettings.getInstance().addEventListener(QSetting.LayerIconList, settingsChanged); settingsChanged(); }
private void drawTextField(string label, QSetting setting) { string currentValue = QSettings.getInstance().get <string>(setting); string newValue = EditorGUI.TextField(getControlRect(0, 16, 34, 6), label, currentValue); if (!currentValue.Equals(newValue)) { QSettings.getInstance().set(setting, newValue); } drawSpace(2); }
private void drawColorPicker(string label, QSetting setting) { Color currentColor = QSettings.getInstance().getColor(setting); Color newColor = EditorGUI.ColorField(getControlRect(0, 16, 34, 6), label, currentColor); if (!currentColor.Equals(newColor)) { QSettings.getInstance().setColor(setting, newColor); } drawSpace(2); }
// CONSTRUCTOR public QGameObjectIconComponent() { getIconMethodInfo = typeof(EditorGUIUtility).GetMethod("GetIconForObject", BindingFlags.NonPublic | BindingFlags.Static); getIconMethodParams = new object[1]; backgroundColor = QResources.getInstance().getColor(QColor.Background); QSettings.getInstance().addEventListener(QSetting.ShowGameObjectIconComponent, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowGameObjectIconComponentDuringPlayMode, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QSeparatorComponent() { separatorColor = new Color(0f, 0f, 0f, 0.15f); shadingColor = new Color(0f, 0f, 0f, 0.05f); showComponentDuringPlayMode = true; QSettings.getInstance().addEventListener(QSetting.ShowRowShading, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowSeparatorComponent, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QRendererComponent() { rendererWireframe = QResources.getInstance().getTexture(QTexture.QRendererWireframeButton); rendererOn = QResources.getInstance().getTexture(QTexture.QRendererOnButton); rendererOff = QResources.getInstance().getTexture(QTexture.QRendererOffButton); backgroundColor = QResources.getInstance().getColor(QColor.Background); QSettings.getInstance().addEventListener(QSetting.ShowRendererComponent, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowRendererComponentDuringPlayMode, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QSeparatorComponent() { showComponentDuringPlayMode = true; QSettings.getInstance().addEventListener(QSetting.SeparatorShowRowShading, settingsChanged); QSettings.getInstance().addEventListener(QSetting.SeparatorShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.SeparatorColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.SeparatorEvenRowShadingColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.SeparatorOddRowShadingColor, settingsChanged); settingsChanged(); }
private bool drawFoldout(string label, QSetting setting) { bool foldoutValue = QSettings.getInstance().get <bool>(setting); bool newFoldoutValue = EditorGUI.Foldout(getControlRect(0, 16, 19, 6), foldoutValue, label); if (foldoutValue != newFoldoutValue) { QSettings.getInstance().set(setting, newFoldoutValue); } drawSpace(2); return(newFoldoutValue); }
private Enum drawEnum(string label, QSetting setting, Type enumType) { Enum currentEnum = (Enum)Enum.ToObject(enumType, QSettings.getInstance().get <int>(setting)); Enum newEnumValue; if (!(newEnumValue = EditorGUI.EnumPopup(getControlRect(0, 16, 31, 6), label, currentEnum)).Equals(currentEnum)) { QSettings.getInstance().set(setting, (int)(object)newEnumValue); } drawSpace(2); return(newEnumValue); }
// CONSTRUCTOR public QColorComponent() { colorTexture = QResources.getInstance().getTexture(QTexture.QColorButton); rect.width = 8; rect.height = 16; QSettings.getInstance().addEventListener(QSetting.ColorShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ColorShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); settingsChanged(); }
private void drawFloatSlider(string label, QSetting setting, float minValue, float maxValue) { Rect rect = getControlRect(0, 16, 31, 6); float currentValue = QSettings.getInstance().get <float>(setting); float newValue = EditorGUI.Slider(rect, label, currentValue, minValue, maxValue); if (currentValue != newValue) { QSettings.getInstance().set(setting, newValue); } drawSpace(2); }
// CONSTRUCTOR public QStaticComponent() { rect.width = 11; rect.height = 10; QSettings.getInstance().addEventListener(QSetting.StaticShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.StaticShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalActiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QPrefabComponent() { rect.width = 9; prefabTexture = QResources.getInstance().getTexture(QTexture.QPrefabIcon); QSettings.getInstance().addEventListener(QSetting.PrefabShowBreakedPrefabsOnly, settingsChanged); QSettings.getInstance().addEventListener(QSetting.PrefabShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalActiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); settingsChanged(); }
private void drawIntSlider(string label, QSetting setting, int minValue, int maxValue) { Rect rect = getControlRect(0, 16, 34, 4); int currentValue = QSettings.getInstance().get <int>(setting); int newValue = EditorGUI.IntSlider(rect, label, currentValue, minValue, maxValue); if (currentValue != newValue) { QSettings.getInstance().set(setting, newValue); } drawSpace(2); }
private void drawTagIconComponentSettings() { if (drawComponentCheckBox(QSetting.ShowTagIconComponent, "Tag Icon")) { bool changed = false; List <QTagTexture> tagTextureList = QSettings.getInstance().get <List <QTagTexture> >(QSetting.CustomTagIcon); string[] tags = UnityEditorInternal.InternalEditorUtility.tags; Rect rect = getControlRect(0, 18); drawBackground(rect.x, rect.y, rect.width, 18 + 18 * tags.Length + 5); rect.x += 31; rect.width -= 31 + 6; drawCheckBoxRight(rect, QSetting.ShowTagIconComponentDuringPlayMode, "Show Component During Play Mode"); drawSpace(4); for (int i = 0; i < tags.Length; i++) { string tag = tags[i]; QTagTexture tagTexture = tagTextureList.Find(t => t.tag == tag); Texture2D newTexture = (Texture2D)EditorGUI.ObjectField(getControlRect(0, 16, 31, 6), tag, tagTexture == null ? null : tagTexture.texture, typeof(Texture2D), false); if (newTexture != null && tagTexture == null) { QTagTexture newTagTexture = new QTagTexture(tag, newTexture); tagTextureList.Add(newTagTexture); changed = true; } else if (newTexture == null && tagTexture != null) { tagTextureList.Remove(tagTexture); changed = true; } else if (tagTexture != null && tagTexture.texture != newTexture) { tagTexture.texture = newTexture; changed = true; } drawSpace(i == tags.Length - 1 ? 2 : 2); } if (changed) { QSettings.getInstance().set(QSetting.CustomTagIcon, tagTextureList); EditorApplication.RepaintHierarchyWindow(); } } }
// CONSTRUCTOR public QGameObjectIconComponent() { rect.width = 14; rect.height = 14; getIconMethodInfo = typeof(EditorGUIUtility).GetMethod("GetIconForObject", BindingFlags.NonPublic | BindingFlags.Static); getIconMethodParams = new object[1]; QSettings.getInstance().addEventListener(QSetting.GameObjectIconShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.GameObjectIconShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.GameObjectIconSize, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QVisibilityComponent() { visibilityOn = QResources.getInstance().getTexture(QTexture.QVisibilityOnButton); visibilityOnEdit = QResources.getInstance().getTexture(QTexture.QVisibilityOnEditButton); visibilityOff = QResources.getInstance().getTexture(QTexture.QVisibilityOffButton); visibilityOffEdit = QResources.getInstance().getTexture(QTexture.QVisibilityOffEditButton); visibilityOffParent = QResources.getInstance().getTexture(QTexture.QVisibilityOffParentButton); visibilityOffParentEdit = QResources.getInstance().getTexture(QTexture.QVisibilityOffParentEditButton); QSettings.getInstance().addEventListener(QSetting.ShowVisibilityComponent, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowVisibilityComponentDuringPlayMode, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QRendererComponent() { rect.width = 12; rendererButtonTexture = QResources.getInstance().getTexture(QTexture.QRendererButton); QSettings.getInstance().addEventListener(QSetting.RendererShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.RendererShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalActiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalSpecialColor, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QLockComponent() { rect.width = 13; lockButtonTexture = QResources.getInstance().getTexture(QTexture.QLockButton); QSettings.getInstance().addEventListener(QSetting.AdditionalShowModifierWarning, settingsChanged); QSettings.getInstance().addEventListener(QSetting.LockShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.LockShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalActiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QChildrenCountComponent() { backgroundColor = QResources.getInstance().getColor(QColor.Background); labelStyle = new GUIStyle(); labelStyle.normal.textColor = QResources.getInstance().getColor(QColor.Gray); labelStyle.fontSize = 9; labelStyle.clipping = TextClipping.Clip; labelStyle.alignment = TextAnchor.MiddleRight; QSettings.getInstance().addEventListener(QSetting.ShowChildrenCountComponent, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowChildrenCountComponentDuringPlayMode, settingsChanged); settingsChanged(); }
// CONSTRUCTOR public QVisibilityComponent() { rect.width = 18; visibilityButtonTexture = QResources.getInstance().getTexture(QTexture.QVisibilityButton); visibilityOffButtonTexture = QResources.getInstance().getTexture(QTexture.QVisibilityOffButton); QSettings.getInstance().addEventListener(QSetting.VisibilityShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.VisibilityShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalActiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalInactiveColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.AdditionalSpecialColor, settingsChanged); settingsChanged(); }
// PRIVATE private void settingsChanged() { enabled = QSettings.getInstance().get <bool>(QSetting.VerticesAndTrianglesShow); showComponentDuringPlayMode = QSettings.getInstance().get <bool>(QSetting.VerticesAndTrianglesShowDuringPlayMode); calculateTotalCount = QSettings.getInstance().get <bool>(QSetting.VerticesAndTrianglesCalculateTotalCount); showTrianglesCount = QSettings.getInstance().get <bool>(QSetting.VerticesAndTrianglesShowTriangles); showVerticesCount = QSettings.getInstance().get <bool>(QSetting.VerticesAndTrianglesShowVertices); verticesLabelColor = QSettings.getInstance().getColor(QSetting.VerticesAndTrianglesVerticesLabelColor); trianglesLabelColor = QSettings.getInstance().getColor(QSetting.VerticesAndTrianglesTrianglesLabelColor); QHierarchySize labelSize = (QHierarchySize)QSettings.getInstance().get <int>(QSetting.VerticesAndTrianglesLabelSize); labelStyle.fontSize = labelSize == QHierarchySize.Big ? 9 : 8; rect.width = labelSize == QHierarchySize.Big ? 33 : 25; }
// CONSTRUCTOR public QMonoBehaviorIconComponent() { rect.width = 14; rect.height = 16; monoBehaviourIconTexture = QResources.getInstance().getTexture(QTexture.QMonoBehaviourIcon); monoBehaviourIconObjectTexture = QResources.getInstance().getTexture(QTexture.QTreeMapObject); QSettings.getInstance().addEventListener(QSetting.MonoBehaviourIconIgnoreUnityMonobehaviour, settingsChanged); QSettings.getInstance().addEventListener(QSetting.MonoBehaviourIconShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.MonoBehaviourIconShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.MonoBehaviourIconColor, settingsChanged); QSettings.getInstance().addEventListener(QSetting.TreeMapShow, settingsChanged); settingsChanged(); }
private void drawPrefabComponentSettings() { if (drawComponentCheckBox("Prefab", QSetting.PrefabShow)) { Rect rect = getControlRect(0, 0); if (drawRestore()) { QSettings.getInstance().restore(QSetting.PrefabShowBreakedPrefabsOnly); } drawBackground(rect.x, rect.y, rect.width, 18 + 5); drawSpace(4); drawCheckBoxRight("Show icon for broken prefabs only", QSetting.PrefabShowBreakedPrefabsOnly); drawSpace(1); } }
private void drawColorComponentSettings() { if (drawComponentCheckBox("Color", QSetting.ColorShow)) { Rect rect = getControlRect(0, 0); if (drawRestore()) { QSettings.getInstance().restore(QSetting.ColorShowDuringPlayMode); } drawBackground(rect.x, rect.y, rect.width, 18 + 5); drawSpace(4); drawCheckBoxRight("Show component during play mode", QSetting.ColorShowDuringPlayMode); drawSpace(1); } }
// CONSTRUCTOR public QChildrenCountComponent() { labelStyle = new GUIStyle(); labelStyle.fontSize = 9; labelStyle.clipping = TextClipping.Clip; labelStyle.alignment = TextAnchor.MiddleRight; rect.width = 22; rect.height = 16; QSettings.getInstance().addEventListener(QSetting.ChildrenCountShow, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ChildrenCountShowDuringPlayMode, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ChildrenCountLabelSize, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ChildrenCountLabelColor, settingsChanged); settingsChanged(); }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect, Rect curRect) { string gameObjectTag = ""; try { gameObjectTag = gameObject.tag; } catch {} QTagTexture tagTexture = QSettings.getInstance().get <List <QTagTexture> >(QSetting.CustomTagIcon).Find(t => t.tag == gameObjectTag); EditorGUI.DrawRect(curRect, backgroundColor); if (tagTexture != null && tagTexture.texture != null) { curRect.width = 16; GUI.DrawTexture(curRect, tagTexture.texture, ScaleMode.ScaleToFit, true); } }
private bool drawFoldout(string label, QSetting setting) { #if UNITY_2019_1_OR_NEWER Rect foldoutRect = getControlRect(0, 16, 19, 6); #else Rect foldoutRect = getControlRect(0, 16, 22, 6); #endif bool foldoutValue = QSettings.getInstance().get <bool>(setting); bool newFoldoutValue = EditorGUI.Foldout(foldoutRect, foldoutValue, label); if (foldoutValue != newFoldoutValue) { QSettings.getInstance().set(setting, newFoldoutValue); } drawSpace(2); return(newFoldoutValue); }
// CONSTRUCTOR public QComponentsComponent() { this.backgroundColor = QResources.getInstance().getColor(QColor.Background); this.backgroundDarkColor = QResources.getInstance().getColor(QColor.BackgroundDark); this.grayColor = QResources.getInstance().getColor(QColor.Gray); this.componentIcon = QResources.getInstance().getTexture(QTexture.QComponentUnknownIcon); hintLabelStyle = new GUIStyle(); hintLabelStyle.normal.textColor = grayColor; hintLabelStyle.fontSize = 11; hintLabelStyle.clipping = TextClipping.Clip; QSettings.getInstance().addEventListener(QSetting.ShowComponentsComponent, settingsChanged); QSettings.getInstance().addEventListener(QSetting.ShowComponentsComponentDuringPlayMode, settingsChanged); settingsChanged(); }
// ADDITIONAL SETTINGS private void drawAdditionalSettings() { drawCheckBoxRight(getControlRect(0, 18, 5, 8), QSetting.HideIconsIfNotFit, "Hide Icons If Not Fit"); drawSpace(6); int identation = QSettings.getInstance().get <int>(QSetting.Identation); int newIdentation = EditorGUI.IntSlider(getControlRect(0, 16, 5, 8), "Right Indent", identation, 0, 500); if (newIdentation != identation) { QSettings.getInstance().set(QSetting.Identation, newIdentation); } drawCheckBoxRight(getControlRect(0, 18, 5, 8), QSetting.ShowModifierWarning, "Show Warning When Using Modifiers + Click"); drawSpace(6); }