少年修仙传客户端基础资源
dabaoji
2025-06-09 8ee0256378cbf5dbc9d76ed10b60b65a844ef4dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using qtools.qhierarchy.pdata;
using System;
using qtools.qhierarchy.phelper;
using qtools.qhierarchy.pcomponent;
 
namespace qtools.qhierarchy.phierarchy
{
    public class QHierarchySettingsWindow : EditorWindow 
    {    
        // STATIC
        [MenuItem ("Tools/QHierarchy/Settings")]    
        public static void ShowWindow () 
        { 
            EditorWindow window = EditorWindow.GetWindow(typeof(QHierarchySettingsWindow));           
            window.minSize = new Vector2(350, 50);
 
            #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0
                window.title = "QHierarchy";
            #else
                window.titleContent = new GUIContent("QHierarchy");
            #endif
        }
 
        // PRIVATE
        private bool inited = false;
        private Rect lastRect;
        private bool isProSkin;
        private int indentLevel;
        private Texture2D checkBoxChecked;
        private Texture2D checkBoxUnchecked;
        private Texture2D restoreButtonTexture;
        private Vector2 scrollPosition = new Vector2();
        private Color separatorColor;
        private Color yellowColor;
        private float totalWidth;
        private QComponentsOrderList componentsOrderList;
 
        // INIT
        private void init() 
        { 
            inited            = true;
            isProSkin         = EditorGUIUtility.isProSkin;
            separatorColor    = isProSkin ? new Color(0.18f, 0.18f, 0.18f) : new Color(0.59f, 0.59f, 0.59f);
            yellowColor       = isProSkin ? new Color(1.00f, 0.90f, 0.40f) : new Color(0.31f, 0.31f, 0.31f);
            checkBoxChecked   = QResources.getInstance().getTexture(QTexture.QCheckBoxChecked);
            checkBoxUnchecked = QResources.getInstance().getTexture(QTexture.QCheckBoxUnchecked);
            restoreButtonTexture = QResources.getInstance().getTexture(QTexture.QRestoreButton);
            componentsOrderList = new QComponentsOrderList(this);
        } 
         
        // GUI
        void OnGUI()
        {
            if (!inited || isProSkin != EditorGUIUtility.isProSkin)  
                init();
 
            indentLevel = 8;
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            {
                Rect targetRect = EditorGUILayout.GetControlRect(GUILayout.Height(0));
                if (Event.current.type == EventType.Repaint) totalWidth = targetRect.width + 8;
 
                this.lastRect = new Rect(0, 1, 0, 0);
 
                // COMPONENTS
                drawSection("COMPONENTS SETTINGS");
                float sectionStartY = lastRect.y + lastRect.height;
 
                drawTreeMapComponentSettings();
                drawSeparator();
                drawMonoBehaviourIconComponentSettings();
                drawSeparator();
                drawSeparatorComponentSettings();
                drawSeparator();
                drawVisibilityComponentSettings();
                drawSeparator();
                drawLockComponentSettings();
                drawSeparator();
                drawStaticComponentSettings();
                drawSeparator();
                drawErrorComponentSettings();
                drawSeparator();
                drawRendererComponentSettings();
                drawSeparator();
                drawPrefabComponentSettings();
                drawSeparator();
                drawTagLayerComponentSettings();
                drawSeparator();
                drawColorComponentSettings();
                drawSeparator();
                drawGameObjectIconComponentSettings();
                drawSeparator();
                drawTagIconComponentSettings();
                drawSeparator();
                drawLayerIconComponentSettings();
                drawSeparator();
                drawChildrenCountComponentSettings();
                drawSeparator();
                drawVerticesAndTrianglesCountComponentSettings();
                drawSeparator();
                drawComponentsComponentSettings();
                drawLeftLine(sectionStartY, lastRect.y + lastRect.height, separatorColor);
 
                // ORDER
                drawSection("ORDER OF COMPONENTS");         
                sectionStartY = lastRect.y + lastRect.height;
                drawSpace(8);  
                drawOrderSettings();
                drawSpace(6);      
                drawLeftLine(sectionStartY, lastRect.y + lastRect.height, separatorColor);
 
                // ADDITIONAL
                drawSection("ADDITIONAL SETTINGS");             
                sectionStartY = lastRect.y + lastRect.height;
                drawSpace(3);  
                drawAdditionalSettings();
                drawLeftLine(sectionStartY, lastRect.y + lastRect.height + 4, separatorColor);
 
                indentLevel -= 1;
            }
 
            EditorGUILayout.EndScrollView();
        }
 
        // COMPONENTS
        private void drawTreeMapComponentSettings() 
        {
            if (drawComponentCheckBox("Hierarchy Tree", QSetting.TreeMapShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.TreeMapColor);
                    QSettings.getInstance().restore(QSetting.TreeMapEnhanced);
                    QSettings.getInstance().restore(QSetting.TreeMapTransparentBackground);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 3 + 5);
                drawSpace(4);
                drawColorPicker("Tree color", QSetting.TreeMapColor);
                drawCheckBoxRight("Transparent background", QSetting.TreeMapTransparentBackground);
                drawCheckBoxRight("Enhanced (\"Transform Sort\" only)", QSetting.TreeMapEnhanced);
                drawSpace(1);
            }
        }
        
        private void drawMonoBehaviourIconComponentSettings() 
        {
            if (drawComponentCheckBox("MonoBehaviour Icon", QSetting.MonoBehaviourIconShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.MonoBehaviourIconShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.MonoBehaviourIconColor);
                    QSettings.getInstance().restore(QSetting.MonoBehaviourIconIgnoreUnityMonobehaviour);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 3 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.MonoBehaviourIconShowDuringPlayMode);
                drawColorPicker("Icon color", QSetting.MonoBehaviourIconColor);
                drawCheckBoxRight("Ignore Unity MonoBehaviours", QSetting.MonoBehaviourIconIgnoreUnityMonobehaviour);
                drawSpace(1);
            }
        }
 
        private void drawSeparatorComponentSettings() 
        {
            if (drawComponentCheckBox("Separator", QSetting.SeparatorShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.SeparatorColor);
                    QSettings.getInstance().restore(QSetting.SeparatorShowRowShading);
                    QSettings.getInstance().restore(QSetting.SeparatorOddRowShadingColor);
                    QSettings.getInstance().restore(QSetting.SeparatorEvenRowShadingColor);
                }
                bool rowShading = QSettings.getInstance().get<bool>(QSetting.SeparatorShowRowShading);
 
                drawBackground(rect.x, rect.y, rect.width, 18 * (rowShading ? 4 : 2) + 5);
                drawSpace(4);
                drawColorPicker("Separator Color", QSetting.SeparatorColor);
                drawCheckBoxRight("Row shading", QSetting.SeparatorShowRowShading);
                if (rowShading)                
                {
                    drawColorPicker("Even row shading color", QSetting.SeparatorEvenRowShadingColor);
                    drawColorPicker("Odd row shading color" , QSetting.SeparatorOddRowShadingColor);
                }
                drawSpace(1);
            }
        }
 
        private void drawVisibilityComponentSettings() 
        {
            if (drawComponentCheckBox("Visibility", QSetting.VisibilityShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.VisibilityShowDuringPlayMode);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.VisibilityShowDuringPlayMode);
                drawSpace(1);
            }
        }
 
        private void drawLockComponentSettings() 
        {
            if (drawComponentCheckBox("Lock", QSetting.LockShow))
            {   
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.LockShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.LockPreventSelectionOfLockedObjects);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 2 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.LockShowDuringPlayMode);
                drawCheckBoxRight("Prevent selection of locked objects", QSetting.LockPreventSelectionOfLockedObjects);
                drawSpace(1);
            }
        }
 
        private void drawStaticComponentSettings() 
        {
            if (drawComponentCheckBox("Static", QSetting.StaticShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.StaticShowDuringPlayMode);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.StaticShowDuringPlayMode);
                drawSpace(1);
            }        
        }
 
        private void drawErrorComponentSettings() 
        {
            if (drawComponentCheckBox("Error", QSetting.ErrorShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.ErrorShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.ErrorShowIconOnParent);
                    QSettings.getInstance().restore(QSetting.ErrorShowForDisabledComponents);
                    QSettings.getInstance().restore(QSetting.ErrorShowForDisabledGameObjects);
                    QSettings.getInstance().restore(QSetting.ErrorShowScriptIsMissing);
                    QSettings.getInstance().restore(QSetting.ErrorShowReferenceIsMissing);
                    QSettings.getInstance().restore(QSetting.ErrorShowReferenceIsNull);
                    QSettings.getInstance().restore(QSetting.ErrorShowStringIsEmpty);
                    QSettings.getInstance().restore(QSetting.ErrorShowMissingEventMethod);
                    QSettings.getInstance().restore(QSetting.ErrorShowWhenTagOrLayerIsUndefined);
                    QSettings.getInstance().restore(QSetting.ErrorIgnoreString);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 12 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.ErrorShowDuringPlayMode);
                drawCheckBoxRight("Show error icon up of hierarchy (very slow)", QSetting.ErrorShowIconOnParent);
                drawCheckBoxRight("Show error icon for disabled components", QSetting.ErrorShowForDisabledComponents);
                drawCheckBoxRight("Show error icon for disabled GameObjects", QSetting.ErrorShowForDisabledGameObjects);
                drawLabel("Show error icon for the following:");
                indentLevel += 16;
                drawCheckBoxRight("- script is missing", QSetting.ErrorShowScriptIsMissing);
                drawCheckBoxRight("- reference is missing", QSetting.ErrorShowReferenceIsMissing);
                drawCheckBoxRight("- reference is null", QSetting.ErrorShowReferenceIsNull);
                drawCheckBoxRight("- string is empty", QSetting.ErrorShowStringIsEmpty);
                drawCheckBoxRight("- callback of event is missing (very slow)", QSetting.ErrorShowMissingEventMethod);
                drawCheckBoxRight("- tag or layer is undefined", QSetting.ErrorShowWhenTagOrLayerIsUndefined);
                indentLevel -= 16;
                drawTextField("Ignore packages/classes", QSetting.ErrorIgnoreString);
                drawSpace(1);
            }
        }
 
        private void drawRendererComponentSettings() 
        {
            if (drawComponentCheckBox("Renderer", QSetting.RendererShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.RendererShowDuringPlayMode);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.RendererShowDuringPlayMode);
                drawSpace(1);
            }
        }
 
        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 drawTagLayerComponentSettings()
        {
            if (drawComponentCheckBox("Tag And Layer", QSetting.TagAndLayerShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.TagAndLayerShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.TagAndLayerSizeShowType);
                    QSettings.getInstance().restore(QSetting.TagAndLayerType);
                    QSettings.getInstance().restore(QSetting.TagAndLayerSizeValueType);
                    QSettings.getInstance().restore(QSetting.TagAndLayerSizeValuePixel);
                    QSettings.getInstance().restore(QSetting.TagAndLayerSizeValuePercent);
                    QSettings.getInstance().restore(QSetting.TagAndLayerAligment);
                    QSettings.getInstance().restore(QSetting.TagAndLayerLabelSize);
                    QSettings.getInstance().restore(QSetting.TagAndLayerLabelAlpha);
                    QSettings.getInstance().restore(QSetting.TagAndLayerTagLabelColor);
                    QSettings.getInstance().restore(QSetting.TagAndLayerLayerLabelColor);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 10 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.TagAndLayerShowDuringPlayMode);  
                drawEnum("Show", QSetting.TagAndLayerSizeShowType, typeof(QHierarchyTagAndLayerShowType));
                drawEnum("Show tag and layer", QSetting.TagAndLayerType, typeof(QHierarchyTagAndLayerType));
 
                QHierarchyTagAndLayerSizeType newTagAndLayerSizeValueType = (QHierarchyTagAndLayerSizeType)drawEnum("Unit of width", QSetting.TagAndLayerSizeValueType, typeof(QHierarchyTagAndLayerSizeType));               
 
                if (newTagAndLayerSizeValueType == QHierarchyTagAndLayerSizeType.Pixel)                
                    drawIntSlider("Width in pixels", QSetting.TagAndLayerSizeValuePixel, 5, 250);                
                else                
                    drawFloatSlider("Percentage width", QSetting.TagAndLayerSizeValuePercent, 0, 0.5f);
                           
                drawEnum("Alignment", QSetting.TagAndLayerAligment, typeof(QHierarchyTagAndLayerAligment));
                drawEnum("Label size", QSetting.TagAndLayerLabelSize, typeof(QHierarchyTagAndLayerLabelSize));
                drawFloatSlider("Label alpha if default", QSetting.TagAndLayerLabelAlpha, 0, 1.0f);
                drawColorPicker("Tag label color", QSetting.TagAndLayerTagLabelColor);
                drawColorPicker("Layer label color", QSetting.TagAndLayerLayerLabelColor);
                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);
            }
        }
 
        private void drawGameObjectIconComponentSettings() 
        {
            if (drawComponentCheckBox("GameObject Icon", QSetting.GameObjectIconShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.GameObjectIconShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.GameObjectIconSize);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 2 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.GameObjectIconShowDuringPlayMode);
                drawEnum("Icon size", QSetting.GameObjectIconSize, typeof(QHierarchySizeAll));
                drawSpace(1);
            }
        }
 
        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));
                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, 34 + 16, 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);
            }
        }
 
        private void drawLayerIconComponentSettings() 
        {
            if (drawComponentCheckBox("Layer Icon", QSetting.LayerIconShow))
            {     
                string[] layers = UnityEditorInternal.InternalEditorUtility.layers;
                
                bool showLayerIconList = QSettings.getInstance().get<bool>(QSetting.LayerIconListFoldout);
                
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.LayerIconShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.LayerIconSize);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 3 + (showLayerIconList ? 18 * layers.Length : 0) + 4 + 5);    
                
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.LayerIconShowDuringPlayMode);
                drawEnum("Icon size", QSetting.LayerIconSize, typeof(QHierarchySizeAll));
                if (drawFoldout("Layer icon list", QSetting.LayerIconListFoldout))
                {
                    List<QLayerTexture> layerTextureList = QLayerTexture.loadLayerTextureList();
                    
                    bool changed = false;
                    for (int i = 0; i < layers.Length; i++) 
                    {
                        string layer = layers[i];
                        QLayerTexture layerTexture = layerTextureList.Find(t => t.layer == layer);
                        Texture2D newTexture = (Texture2D)EditorGUI.ObjectField(getControlRect(0, 16, 34 + 16, 6), 
                                                                                layer, layerTexture == null ? null : layerTexture.texture, typeof(Texture2D), false);
                        if (newTexture != null && layerTexture == null)
                        {
                            QLayerTexture newLayerTexture = new QLayerTexture(layer, newTexture);
                            layerTextureList.Add(newLayerTexture);
                            
                            changed = true;
                        }
                        else if (newTexture == null && layerTexture != null)
                        {
                            layerTextureList.Remove(layerTexture);                            
                            changed = true;
                        }
                        else if (layerTexture != null && layerTexture.texture != newTexture)
                        {
                            layerTexture.texture = newTexture;
                            changed = true;
                        }
                        
                        drawSpace(i == layers.Length - 1 ? 2 : 2);
                    }                 
                    
                    if (changed) 
                    {     
                        QLayerTexture.saveLayerTextureList(QSetting.LayerIconList, layerTextureList);
                        EditorApplication.RepaintHierarchyWindow();
                    }
                }
                
                drawSpace(1);
            }
        }
 
        private void drawChildrenCountComponentSettings() 
        {
            if (drawComponentCheckBox("Children Count", QSetting.ChildrenCountShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.ChildrenCountShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.ChildrenCountLabelSize);
                    QSettings.getInstance().restore(QSetting.ChildrenCountLabelColor);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 3 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.ChildrenCountShowDuringPlayMode);
                drawEnum("Label size", QSetting.ChildrenCountLabelSize, typeof(QHierarchySize));
                drawColorPicker("Label color", QSetting.ChildrenCountLabelColor);
                drawSpace(1);
            }
        }
        
        private void drawVerticesAndTrianglesCountComponentSettings()
        {
            if (drawComponentCheckBox("Vertices And Triangles Count", QSetting.VerticesAndTrianglesShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesShowVertices);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesShowTriangles);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesCalculateTotalCount);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesLabelSize);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesVerticesLabelColor);
                    QSettings.getInstance().restore(QSetting.VerticesAndTrianglesTrianglesLabelColor);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 7 + 5);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.VerticesAndTrianglesShowDuringPlayMode);                   
                if (drawCheckBoxRight("Show vertices count", QSetting.VerticesAndTrianglesShowVertices))
                {
                    if (QSettings.getInstance().get<bool>(QSetting.VerticesAndTrianglesShowVertices) == false &&
                        QSettings.getInstance().get<bool>(QSetting.VerticesAndTrianglesShowTriangles) == false)                    
                        QSettings.getInstance().set(QSetting.VerticesAndTrianglesShowTriangles, true);
                }
                if (drawCheckBoxRight("Show triangles count (very slow)", QSetting.VerticesAndTrianglesShowTriangles))
                {
                    if (QSettings.getInstance().get<bool>(QSetting.VerticesAndTrianglesShowVertices) == false &&
                        QSettings.getInstance().get<bool>(QSetting.VerticesAndTrianglesShowTriangles) == false)                 
                        QSettings.getInstance().set(QSetting.VerticesAndTrianglesShowVertices, true);
                }
                drawCheckBoxRight("Calculate the count including children (very slow)", QSetting.VerticesAndTrianglesCalculateTotalCount);
                drawEnum("Label size", QSetting.VerticesAndTrianglesLabelSize, typeof(QHierarchySize));
                drawColorPicker("Vertices label color", QSetting.VerticesAndTrianglesVerticesLabelColor);
                drawColorPicker("Triangles label color", QSetting.VerticesAndTrianglesTrianglesLabelColor);
                drawSpace(1);
            }
        }
 
        private void drawComponentsComponentSettings() 
        {
            if (drawComponentCheckBox("Components", QSetting.ComponentsShow))
            {
                Rect rect = getControlRect(0, 0);
                if (drawRestore())
                {
                    QSettings.getInstance().restore(QSetting.ComponentsShowDuringPlayMode);
                    QSettings.getInstance().restore(QSetting.ComponentsIconSize);
                }
                drawBackground(rect.x, rect.y, rect.width, 18 * 3 + 6);
                drawSpace(4);
                drawCheckBoxRight("Show component during play mode", QSetting.ComponentsShowDuringPlayMode);
                drawEnum("Icon size", QSetting.ComponentsIconSize, typeof(QHierarchySizeAll));
                drawTextField("Ignore packages/classes", QSetting.ComponentsIgnore);
                drawSpace(2);
            }
        }
 
        // COMPONENTS ORDER
        private void drawOrderSettings()
        {
            if (drawRestore())
            {
                QSettings.getInstance().restore(QSetting.ComponentsOrder);
            }
 
            indentLevel += 4;
            
            string componentOrder = QSettings.getInstance().get<string>(QSetting.ComponentsOrder);
            string[] componentIds = componentOrder.Split(';');
            
            Rect rect = getControlRect(position.width, 17 * componentIds.Length + 10, 0, 0);
            if (componentsOrderList == null) 
                componentsOrderList = new QComponentsOrderList(this);
            componentsOrderList.draw(rect, componentIds);
            
            indentLevel -= 4;
        }  
 
        // ADDITIONAL SETTINGS
        private void drawAdditionalSettings()
        {
            if (drawRestore())
            {
                QSettings.getInstance().restore(QSetting.AdditionalShowHiddenQHierarchyObjectList);
                QSettings.getInstance().restore(QSetting.AdditionalHideIconsIfNotFit);
                QSettings.getInstance().restore(QSetting.AdditionalIdentation);
                QSettings.getInstance().restore(QSetting.AdditionalShowModifierWarning);
                QSettings.getInstance().restore(QSetting.AdditionalBackgroundColor);
                QSettings.getInstance().restore(QSetting.AdditionalActiveColor);
                QSettings.getInstance().restore(QSetting.AdditionalInactiveColor);
                QSettings.getInstance().restore(QSetting.AdditionalSpecialColor);
            }
            drawSpace(4);
            drawCheckBoxRight("Show QHierarchyObjectList GameObject", QSetting.AdditionalShowHiddenQHierarchyObjectList);
            drawCheckBoxRight("Hide icons if not fit", QSetting.AdditionalHideIconsIfNotFit);
            drawIntSlider("Right indent", QSetting.AdditionalIdentation, 0, 500);      
            drawCheckBoxRight("Show warning when using modifiers + click", QSetting.AdditionalShowModifierWarning);
            drawColorPicker("Background color", QSetting.AdditionalBackgroundColor);
            drawColorPicker("Active color", QSetting.AdditionalActiveColor);
            drawColorPicker("Inactive color", QSetting.AdditionalInactiveColor);
            drawColorPicker("Special color", QSetting.AdditionalSpecialColor);
            drawSpace(1);
        }
 
        // PRIVATE
        private void drawSection(string title)
        {
            Rect rect = getControlRect(0, 24, -3, 0);
            rect.width *= 2;
            rect.x = 0;
            GUI.Box(rect, "");             
            
            drawLeftLine(rect.y, rect.y + 24, yellowColor);
            
            rect.x = lastRect.x + 8;
            rect.y += 4;
            EditorGUI.LabelField(rect, title);
        }
 
        private void drawSeparator(int spaceBefore = 0, int spaceAfter = 0, int height = 1)
        {
            if (spaceBefore > 0) drawSpace(spaceBefore);
            Rect rect = getControlRect(0, height, 0, 0);
            rect.width += 8;
            EditorGUI.DrawRect(rect, separatorColor);
            if (spaceAfter > 0) drawSpace(spaceAfter);
        }
 
        private bool drawComponentCheckBox(string label, QSetting setting)
        {
            indentLevel += 8;
 
            Rect rect = getControlRect(0, 28, 0, 0);
 
            float rectWidth = rect.width;
            bool isChecked = QSettings.getInstance().get<bool>(setting);
 
            rect.x -= 1;
            rect.y += 7;
            rect.width  = 14;
            rect.height = 14;
 
            if (GUI.Button(rect, isChecked ? checkBoxChecked : checkBoxUnchecked, GUIStyle.none))
            {
                QSettings.getInstance().set(setting, !isChecked);
            }
 
            rect.x += 14 + 10;
            rect.width = rectWidth - 14 - 8;
            rect.y -= (EditorGUIUtility.singleLineHeight - rect.height) * 0.5f;
            rect.height = EditorGUIUtility.singleLineHeight;
 
            EditorGUI.LabelField(rect, label);
 
            indentLevel -= 8;
 
            return isChecked;
        }
 
        private bool drawCheckBoxRight(string label, QSetting setting)
        {
            Rect rect = getControlRect(0, 18, 34, 6);
            bool result = false;
            bool isChecked = QSettings.getInstance().get<bool>(setting);
 
            float tempX = rect.x;
            rect.x += rect.width - 14;
            rect.y += 1;
            rect.width  = 14;
            rect.height = 14;
            
            if (GUI.Button(rect, isChecked ? checkBoxChecked : checkBoxUnchecked, GUIStyle.none))
            {
                QSettings.getInstance().set(setting, !isChecked);
                result = true;
            }
 
            rect.width = rect.x - tempX - 4;
            rect.x = tempX;
            rect.y -= (EditorGUIUtility.singleLineHeight - rect.height) * 0.5f;
            rect.height = EditorGUIUtility.singleLineHeight;
            
            EditorGUI.LabelField(rect, label);
 
            return result;
        }
 
        private void drawSpace(int value)
        {
            getControlRect(0, value, 0, 0);
        }
 
        private void drawBackground(float x, float y, float width, float height)
        {
            EditorGUI.DrawRect(new Rect(x, y, width, height), separatorColor);
        }
        
        private void drawLeftLine(float fromY, float toY, Color color, float width = 0)
        {
            EditorGUI.DrawRect(new Rect(0, fromY, width == 0 ? indentLevel : width, toY - fromY), color);
        }
        
        private Rect getControlRect(float width, float height, float addIndent = 0, float remWidth = 0)
        { 
            EditorGUILayout.GetControlRect(false, height, GUIStyle.none, GUILayout.ExpandWidth(true));
            Rect rect = new Rect(indentLevel + addIndent, lastRect.y + lastRect.height, (width == 0 ? totalWidth - indentLevel - addIndent - remWidth: width), height);
            lastRect = rect;
            return rect;
        }
 
        private bool drawRestore()
        {
            if (GUI.Button(new Rect(lastRect.x + lastRect.width - 16 - 5, lastRect.y - 20, 16, 16), restoreButtonTexture, GUIStyle.none))
            {
                if (EditorUtility.DisplayDialog("Restore", "Restore default settings?", "Ok", "Cancel"))
                {
                    return true;
                }
            }
            return false;
        }
 
        // GUI COMPONENTS
        private void drawLabel(string label)
        {
            Rect rect = getControlRect(0, 16, 34, 6);
            rect.y -= (EditorGUIUtility.singleLineHeight - rect.height) * 0.5f;
            EditorGUI.LabelField(rect, label);
            drawSpace(2);
        }
 
        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 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;
        }
 
        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);
        }
 
        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, 34, 6), label, currentEnum)).Equals(currentEnum))                
                QSettings.getInstance().set(setting, (int)(object)newEnumValue);                  
            drawSpace(2);
            return newEnumValue;
        }
 
        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 drawFloatSlider(string label, QSetting setting, float minValue, float maxValue)
        {
            Rect rect = getControlRect(0, 16, 34, 4);
            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);
        }
    }
}