summaryrefslogtreecommitdiff
path: root/Assets/ActionTool/Editor/ActionEditorStyles.cs
blob: 3b03cde85bddd7fd7e752ed137aa785960a82b16 (plain)
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace ActionTool
{
    internal class ActionEditorStyles
    {
        public GUIStyle textBoldBig;
        public GUIStyle textBoldSmall;
        public GUIStyle textBold;
        public GUIStyle selectObj;
        public GUIStyle textSmall;
		public GUIStyle textMiddle;
		public GUIStyle textMiddleBold;
        public GUIStyle boxToggle;
        public GUIStyle keyFrameButton;

        public GUIStyle toggleSmallBold;

        public GUIStyle foldout;

        public Texture2D selectIcon;
		public Texture2D keyFrameIcon;
        public Texture2D addFileIcon;
        public Texture2D saveFileIcon;
        public Texture2D deleteIcon;
        public Texture2D infoIcon;

        private static ActionEditorStyles s_instance;
        public static ActionEditorStyles Get()
        {
            bool flag = s_instance == null;
            if (flag)
            {
                s_instance = new ActionEditorStyles();
            }
            return s_instance;
        }

        private ActionEditorStyles()
        {
            selectIcon = (Texture2D)Resources.Load<Texture2D>("select_white");
            selectIcon.filterMode = FilterMode.Point;

			keyFrameIcon = EditorGUIUtility.FindTexture("animationkeyframe");
            addFileIcon = EditorGUIUtility.FindTexture("d_Collab.FileAdded");
            saveFileIcon = EditorGUIUtility.FindTexture("d_Collab.FileUpdated");
            deleteIcon = EditorGUIUtility.FindTexture("d_P4_DeletedLocal");
            infoIcon = EditorGUIUtility.FindTexture("console.infoicon");

            InitStyle(out textBoldBig, GUI.skin.label, s => {
                s.fontStyle = FontStyle.Bold;
                s.fontSize = 18;
                s.alignment = TextAnchor.MiddleCenter;
            });

            InitStyle(out textBold, GUI.skin.label, s => {
                s.fontStyle = FontStyle.Bold;
            });
            InitStyle(out textBoldSmall, GUI.skin.label, s => {
                s.fontSize = 9;
                s.fontStyle = FontStyle.Bold;
            });
            InitStyle(out selectObj, GUI.skin.button, s => {
                s.normal.background = selectIcon;
                s.active.background = selectIcon;
                s.focused.background = selectIcon;
                s.hover.background = selectIcon;
            });
            InitStyle(out textSmall,  GUI.skin.label, s => {
                s.fontSize = 8;
            });
            InitStyle(out textMiddle, GUI.skin.label, s => {
                s.fontSize = 10;
            });
            InitStyle(out textMiddleBold, GUI.skin.label, s => {
                s.fontSize = 10;
                s.fontStyle = FontStyle.Bold;
            });
            InitStyle(out boxToggle, EditorStyles.miniButtonLeft, s => {
                s.fontSize = 8;
				s.normal.textColor = Color.white;
				s.onNormal.textColor = Color.white;
				s.active.textColor = Color.white;
				s.onActive.textColor = Color.white;
			});
            InitStyle(out keyFrameButton, GUI.skin.button, s => {
                s.fontSize = 9; 
                s.clipping = TextClipping.Overflow;
                s.alignment = TextAnchor.MiddleCenter;
                s.fontStyle = FontStyle.Bold;
                s.normal.textColor = Color.yellow;
                s.active.textColor = Color.yellow;
                s.focused.textColor = Color.yellow;
                s.hover.textColor = Color.yellow;
            });
            InitStyle(out toggleSmallBold, GUI.skin.toggle, s => {
                s.fontSize = 10;
                //s.fontStyle = FontStyle.Bold;
            });
            InitStyle(out foldout, EditorStyles.foldout, s => {
            });
        }

        private delegate void Initter(GUIStyle style);
        private static void InitStyle(out GUIStyle normal, GUIStyle other, Initter initter)
        {
            normal = new GUIStyle(other);
            initter(normal);
        }
        private static void InitStyle(out GUIStyle normal, Initter initter)
        {
            normal = new GUIStyle();
            initter(normal);
        }

    }
}