// PRIVATE private void settingsChanged() { enabled = QSettings.getInstance().get <bool>(QSetting.TagIconShow); showComponentDuringPlayMode = QSettings.getInstance().get <bool>(QSetting.TagIconShowDuringPlayMode); QHierarchySizeAll size = (QHierarchySizeAll)QSettings.getInstance().get <int>(QSetting.TagIconSize); rect.width = rect.height = (size == QHierarchySizeAll.Normal ? 15 : (size == QHierarchySizeAll.Big ? 16 : 13)); this.tagTextureList = QTagTexture.loadTagTextureList(); }
private void drawTagIconComponentSettings() { if (drawComponentCheckBox("Tag Icon", QSetting.TagIconShow)) { string[] tags = UnityEditorInternal.InternalEditorUtility.tags; bool showTagIconList = QSettings.getInstance().get <bool>(QSetting.TagIconListFoldout); Rect rect = getControlRect(0, 0); if (drawRestore()) { QSettings.getInstance().restore(QSetting.TagIconShowDuringPlayMode); QSettings.getInstance().restore(QSetting.TagIconSize); } drawBackground(rect.x, rect.y, rect.width, 18 * 3 + (showTagIconList ? 18 * tags.Length : 0) + 4 + 5); drawSpace(4); drawCheckBoxRight("Show component during play mode", QSetting.TagIconShowDuringPlayMode); drawEnum("Icon size", QSetting.TagIconSize, typeof(QHierarchySizeAll)); drawSpace(4); if (drawFoldout("Tag icon list", QSetting.TagIconListFoldout)) { List <QTagTexture> tagTextureList = QTagTexture.loadTagTextureList(); bool changed = false; 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) { QTagTexture.saveTagTextureList(QSetting.TagIconList, tagTextureList); EditorApplication.RepaintHierarchyWindow(); } } drawSpace(1); } }