少年修仙传客户端基础资源
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
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using qtools.qhierarchy.pcomponent.pbase;
using qtools.qhierarchy.pdata;
using qtools.qhierarchy.phelper;
 
namespace qtools.qhierarchy.pcomponent
{
    public class QSeparatorComponent: QBaseComponent
    {
        // PRIVATE
        private Color separatorColor;
        private Color evenShadingColor;
        private Color oddShadingColor;
        private bool showRowShading;
 
        // 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
        private void settingsChanged()
        {
            showRowShading   = QSettings.getInstance().get<bool>(QSetting.SeparatorShowRowShading);
            enabled          = QSettings.getInstance().get<bool>(QSetting.SeparatorShow);
            evenShadingColor = QSettings.getInstance().getColor(QSetting.SeparatorEvenRowShadingColor);
            oddShadingColor  = QSettings.getInstance().getColor(QSetting.SeparatorOddRowShadingColor);
            separatorColor   = QSettings.getInstance().getColor(QSetting.SeparatorColor);
        }
 
        // DRAW
        public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect)
        {
            rect.y = selectionRect.y;
            rect.width = selectionRect.width + selectionRect.x;
            rect.height = 1;
            rect.x = 0;
 
            EditorGUI.DrawRect(rect, separatorColor);
 
            if (showRowShading)
            {
                selectionRect.width += selectionRect.x;
                selectionRect.x = 0;
                selectionRect.height -=1;
                selectionRect.y += 1;
                EditorGUI.DrawRect(selectionRect, ((Mathf.FloorToInt(((selectionRect.y - 4) / 16) % 2) == 0)) ? evenShadingColor : oddShadingColor);
            }
        }
    }
}