com.typhoon.unitysdk 1.0.89 → 1.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/Editor/GUIDrawer.cs +1 -1
- package/Editor/HistoryVersionWindow.cs +5 -3
- package/Editor/OppoMiniConfig.cs +7 -7
- package/Editor/PreferencesWindow.cs +1 -2
- package/Editor/PublishSettingInspector.cs +2 -2
- package/Editor/PublishWindow.cs +20 -19
- package/Editor/Styles.cs +474 -181
- package/Editor/Texture/dark/blue_active.png +0 -0
- package/Editor/Texture/dark/blue_active.png.meta +144 -0
- package/Editor/Texture/dark/blue_hover.png +0 -0
- package/Editor/Texture/dark/blue_hover.png.meta +144 -0
- package/Editor/Texture/dark/blue_normal.png +0 -0
- package/Editor/Texture/dark/blue_normal.png.meta +144 -0
- package/Editor/Texture/dark/green_active.png +0 -0
- package/Editor/Texture/dark/green_active.png.meta +144 -0
- package/Editor/Texture/dark/green_hover.png +0 -0
- package/Editor/Texture/dark/green_hover.png.meta +144 -0
- package/Editor/Texture/dark/green_normal.png +0 -0
- package/Editor/Texture/dark/green_normal.png.meta +144 -0
- package/Editor/Texture/dark/help_box.png +0 -0
- package/Editor/Texture/dark/help_box.png.meta +144 -0
- package/Editor/Texture/dark/menu_active.png +0 -0
- package/Editor/Texture/dark/menu_active.png.meta +144 -0
- package/Editor/Texture/dark/n_active.png +0 -0
- package/Editor/Texture/dark/n_active.png.meta +144 -0
- package/Editor/Texture/dark/n_hover.png +0 -0
- package/Editor/Texture/dark/n_hover.png.meta +144 -0
- package/Editor/Texture/dark/n_normal.png +0 -0
- package/Editor/Texture/dark/n_normal.png.meta +144 -0
- package/Editor/Texture/dark/red_active.png +0 -0
- package/Editor/Texture/dark/red_active.png.meta +144 -0
- package/Editor/Texture/dark/red_hover.png +0 -0
- package/Editor/Texture/dark/red_hover.png.meta +144 -0
- package/Editor/Texture/dark/red_normal.png +0 -0
- package/Editor/Texture/dark/red_normal.png.meta +144 -0
- package/Editor/Texture/dark/square_b_active.png +0 -0
- package/Editor/Texture/dark/square_b_active.png.meta +144 -0
- package/Editor/Texture/dark/square_b_hover.png +0 -0
- package/Editor/Texture/dark/square_b_hover.png.meta +144 -0
- package/Editor/Texture/dark/square_b_normal.png +0 -0
- package/Editor/Texture/dark/square_b_normal.png.meta +144 -0
- package/Editor/Texture/dark/square_g_active.png +0 -0
- package/Editor/Texture/dark/square_g_active.png.meta +144 -0
- package/Editor/Texture/dark/square_g_hover.png +0 -0
- package/Editor/Texture/dark/square_g_hover.png.meta +144 -0
- package/Editor/Texture/dark/square_g_normal.png +0 -0
- package/Editor/Texture/dark/square_g_normal.png.meta +144 -0
- package/Editor/Texture/dark/square_menu_active.png +0 -0
- package/Editor/Texture/dark/square_menu_active.png.meta +144 -0
- package/Editor/Texture/dark/square_n_active.png +0 -0
- package/Editor/Texture/dark/square_n_active.png.meta +144 -0
- package/Editor/Texture/dark/square_n_hover.png +0 -0
- package/Editor/Texture/dark/square_n_hover.png.meta +144 -0
- package/Editor/Texture/dark/square_n_normal.png +0 -0
- package/Editor/Texture/dark/square_n_normal.png.meta +144 -0
- package/Editor/Texture/dark/square_r_active.png +0 -0
- package/Editor/Texture/dark/square_r_active.png.meta +144 -0
- package/Editor/Texture/dark/square_r_hover.png +0 -0
- package/Editor/Texture/dark/square_r_hover.png.meta +144 -0
- package/Editor/Texture/dark/square_r_normal.png +0 -0
- package/Editor/Texture/dark/square_r_normal.png.meta +144 -0
- package/Editor/Texture/dark/square_y_active.png +0 -0
- package/Editor/Texture/dark/square_y_active.png.meta +144 -0
- package/Editor/Texture/dark/square_y_hover.png +0 -0
- package/Editor/Texture/dark/square_y_hover.png.meta +144 -0
- package/Editor/Texture/dark/square_y_normal.png +0 -0
- package/Editor/Texture/dark/square_y_normal.png.meta +144 -0
- package/Editor/Texture/dark/title_bar.png +0 -0
- package/Editor/Texture/dark/title_bar.png.meta +144 -0
- package/Editor/Texture/dark/yellow_active.png +0 -0
- package/Editor/Texture/dark/yellow_active.png.meta +144 -0
- package/Editor/Texture/dark/yellow_hover.png +0 -0
- package/Editor/Texture/dark/yellow_hover.png.meta +144 -0
- package/Editor/Texture/dark/yellow_normal.png +0 -0
- package/Editor/Texture/dark/yellow_normal.png.meta +144 -0
- package/Editor/{Skin.guiskin.meta → Texture/dark.meta} +3 -3
- package/Editor/Texture/icon/error.png +0 -0
- package/Editor/Texture/icon/error.png.meta +144 -0
- package/Editor/Texture/icon/info.png +0 -0
- package/Editor/Texture/icon/info.png.meta +144 -0
- package/Editor/Texture/icon/warning.png +0 -0
- package/Editor/Texture/icon/warning.png.meta +144 -0
- package/Editor/{SkinLight.guiskin.meta → Texture/icon.meta} +3 -3
- package/Editor/Texture/light/blue_active.png +0 -0
- package/Editor/Texture/light/blue_active.png.meta +144 -0
- package/Editor/Texture/light/blue_hover.png +0 -0
- package/Editor/Texture/light/blue_hover.png.meta +144 -0
- package/Editor/Texture/light/blue_normal.png +0 -0
- package/Editor/Texture/light/blue_normal.png.meta +144 -0
- package/Editor/Texture/light/green_active.png +0 -0
- package/Editor/Texture/light/green_active.png.meta +144 -0
- package/Editor/Texture/light/green_hover.png +0 -0
- package/Editor/Texture/light/green_hover.png.meta +144 -0
- package/Editor/Texture/light/green_normal.png +0 -0
- package/Editor/Texture/light/green_normal.png.meta +144 -0
- package/Editor/Texture/light/help_box.png +0 -0
- package/Editor/Texture/light/help_box.png.meta +144 -0
- package/Editor/Texture/light/menu_active.png +0 -0
- package/Editor/Texture/light/menu_active.png.meta +144 -0
- package/Editor/Texture/light/n_active.png +0 -0
- package/Editor/Texture/light/n_active.png.meta +144 -0
- package/Editor/Texture/light/n_hover.png +0 -0
- package/Editor/Texture/light/n_hover.png.meta +144 -0
- package/Editor/Texture/light/n_normal.png +0 -0
- package/Editor/Texture/light/n_normal.png.meta +144 -0
- package/Editor/Texture/light/red_active.png +0 -0
- package/Editor/Texture/light/red_active.png.meta +144 -0
- package/Editor/Texture/light/red_hover.png +0 -0
- package/Editor/Texture/light/red_hover.png.meta +144 -0
- package/Editor/Texture/light/red_normal.png +0 -0
- package/Editor/Texture/light/red_normal.png.meta +144 -0
- package/Editor/Texture/light/square_b_active.png +0 -0
- package/Editor/Texture/light/square_b_active.png.meta +144 -0
- package/Editor/Texture/light/square_b_hover.png +0 -0
- package/Editor/Texture/light/square_b_hover.png.meta +144 -0
- package/Editor/Texture/light/square_b_normal.png +0 -0
- package/Editor/Texture/light/square_b_normal.png.meta +144 -0
- package/Editor/Texture/light/square_g_active.png +0 -0
- package/Editor/Texture/light/square_g_active.png.meta +144 -0
- package/Editor/Texture/light/square_g_hover.png +0 -0
- package/Editor/Texture/light/square_g_hover.png.meta +144 -0
- package/Editor/Texture/light/square_g_normal.png +0 -0
- package/Editor/Texture/light/square_g_normal.png.meta +144 -0
- package/Editor/Texture/light/square_menu_active.png +0 -0
- package/Editor/Texture/light/square_menu_active.png.meta +144 -0
- package/Editor/Texture/light/square_n_active.png +0 -0
- package/Editor/Texture/light/square_n_active.png.meta +144 -0
- package/Editor/Texture/light/square_n_hover.png +0 -0
- package/Editor/Texture/light/square_n_hover.png.meta +144 -0
- package/Editor/Texture/light/square_n_normal.png +0 -0
- package/Editor/Texture/light/square_n_normal.png.meta +144 -0
- package/Editor/Texture/light/square_r_active.png +0 -0
- package/Editor/Texture/light/square_r_active.png.meta +144 -0
- package/Editor/Texture/light/square_r_hover.png +0 -0
- package/Editor/Texture/light/square_r_hover.png.meta +144 -0
- package/Editor/Texture/light/square_r_normal.png +0 -0
- package/Editor/Texture/light/square_r_normal.png.meta +144 -0
- package/Editor/Texture/light/square_y_active.png +0 -0
- package/Editor/Texture/light/square_y_active.png.meta +144 -0
- package/Editor/Texture/light/square_y_hover.png +0 -0
- package/Editor/Texture/light/square_y_hover.png.meta +144 -0
- package/Editor/Texture/light/square_y_normal.png +0 -0
- package/Editor/Texture/light/square_y_normal.png.meta +144 -0
- package/Editor/Texture/light/title_bar.png +0 -0
- package/Editor/Texture/light/title_bar.png.meta +144 -0
- package/Editor/Texture/light/yellow_active.png +0 -0
- package/Editor/Texture/light/yellow_active.png.meta +144 -0
- package/Editor/Texture/light/yellow_hover.png +0 -0
- package/Editor/Texture/light/yellow_hover.png.meta +144 -0
- package/Editor/Texture/light/yellow_normal.png +0 -0
- package/Editor/Texture/light/yellow_normal.png.meta +144 -0
- package/Editor/Texture/light.meta +8 -0
- package/Editor/VariablePresetWindow.cs +1 -2
- package/Editor/VivoMiniConfig.cs +7 -7
- package/package.json +1 -1
- package/Editor/Skin.guiskin +0 -1928
- package/Editor/SkinLight.guiskin +0 -1994
- package/Runtime/ximaiti.otf +0 -0
- package/Runtime/ximaiti.otf.meta +0 -21
package/Editor/Styles.cs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
using UnityEditor;
|
|
3
4
|
using UnityEngine;
|
|
4
5
|
|
|
@@ -7,258 +8,550 @@ namespace TyphoonUnitySDK
|
|
|
7
8
|
//样式
|
|
8
9
|
public class Styles
|
|
9
10
|
{
|
|
10
|
-
|
|
11
|
-
? new Color(0.17f, 0.17f, 0.17f, 1f)
|
|
12
|
-
: new Color(0.65f, 0.65f, 0.65f, 1f);
|
|
11
|
+
#region 图片
|
|
13
12
|
|
|
14
|
-
private static
|
|
15
|
-
? new Color(0.93f, 0.93f, 0.93f, 1f)
|
|
16
|
-
: new Color(0.04f, 0.04f, 0.04f, 1f);
|
|
13
|
+
private static Dictionary<string, Texture2D> _texture2Ds = new Dictionary<string, Texture2D>();
|
|
17
14
|
|
|
18
|
-
private static
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
: new Color(0.9f, 0.9f, 0.9f, 1f);
|
|
15
|
+
private static Texture2D Get2D(string name)
|
|
16
|
+
{
|
|
17
|
+
if (_texture2Ds.TryGetValue(name, out var match))
|
|
18
|
+
{
|
|
19
|
+
return match;
|
|
20
|
+
}
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
: new Color(0.69f, 0.69f, 0.69f, 1f);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
29
24
|
|
|
30
|
-
private static Color Blue = EditorGUIUtility.isProSkin
|
|
31
|
-
? new Color(0.28f, 0.48f, 0.6f, 1f)
|
|
32
|
-
: new Color(0.47f, 0.8f, 1f, 1f);
|
|
33
25
|
|
|
34
|
-
private static GUIStyle
|
|
26
|
+
private static Dictionary<string, GUIStyle> _styles = new Dictionary<string, GUIStyle>();
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
private static GUIStyle GetStyle(string name)
|
|
37
29
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
e.border = new RectOffset(0, 0, 0, 0);
|
|
43
|
-
e.padding = new RectOffset(0, 0, 0, 0);
|
|
44
|
-
SetStyleStateColor(e, normal, hover, active);
|
|
45
|
-
e.normal.textColor = TextColor;
|
|
46
|
-
e.focused.textColor = TextColor;
|
|
47
|
-
e.hover.textColor = TextColor;
|
|
48
|
-
e.active.textColor = TextColor;
|
|
49
|
-
e.alignment = TextAnchor.MiddleCenter;
|
|
50
|
-
e.contentOffset = Vector2.zero;
|
|
51
|
-
e.fixedWidth = 0;
|
|
52
|
-
e.fixedHeight = 0;
|
|
53
|
-
e.stretchHeight = false;
|
|
54
|
-
e.stretchWidth = false;
|
|
55
|
-
});
|
|
30
|
+
if (_styles.TryGetValue(name, out var match))
|
|
31
|
+
{
|
|
32
|
+
return match;
|
|
33
|
+
}
|
|
56
34
|
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
57
37
|
|
|
58
|
-
private static GUIStyle _titleFoldoutButton = null;
|
|
59
38
|
|
|
60
|
-
public static
|
|
61
|
-
CreateStyle(ref _titleFoldoutButton, Button, (e) =>
|
|
62
|
-
{
|
|
63
|
-
e.fontSize = 16;
|
|
64
|
-
e.padding = new RectOffset(2, 2, 2, 2);
|
|
65
|
-
e.alignment = TextAnchor.MiddleLeft;
|
|
66
|
-
e.stretchWidth = true;
|
|
67
|
-
});
|
|
39
|
+
public static Texture2D Green2DNormal => LoadTheme2D("green_normal.png");
|
|
68
40
|
|
|
69
|
-
|
|
41
|
+
public static Texture2D Green2DHover => LoadTheme2D("green_hover.png");
|
|
70
42
|
|
|
71
|
-
public static
|
|
72
|
-
CreateStyle(ref _menuButtonNormal, Button, (e) =>
|
|
73
|
-
{
|
|
74
|
-
e.padding = new RectOffset(2, 2, 2, 2);
|
|
75
|
-
e.alignment = TextAnchor.MiddleLeft;
|
|
76
|
-
});
|
|
43
|
+
public static Texture2D Green2DActive => LoadTheme2D("green_active.png");
|
|
77
44
|
|
|
78
45
|
|
|
79
|
-
|
|
46
|
+
public static Texture2D Blue2DNormal => LoadTheme2D("blue_normal.png");
|
|
80
47
|
|
|
81
|
-
public static
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
48
|
+
public static Texture2D Blue2DHover => LoadTheme2D("blue_hover.png");
|
|
49
|
+
|
|
50
|
+
public static Texture2D Blue2DActive => LoadTheme2D("blue_active.png");
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
public static Texture2D Yellow2DNormal => LoadTheme2D("yellow_normal.png");
|
|
54
|
+
|
|
55
|
+
public static Texture2D Yellow2DHover => LoadTheme2D("yellow_hover.png");
|
|
56
|
+
|
|
57
|
+
public static Texture2D Yellow2DActive => LoadTheme2D("yellow_active.png");
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
public static Texture2D Red2DNormal => LoadTheme2D("red_normal.png");
|
|
61
|
+
|
|
62
|
+
public static Texture2D Red2DHover => LoadTheme2D("red_hover.png");
|
|
63
|
+
|
|
64
|
+
public static Texture2D Red2DActive => LoadTheme2D("red_active.png");
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
public static Texture2D General2DNormal => LoadTheme2D("n_normal.png");
|
|
68
|
+
|
|
69
|
+
public static Texture2D General2DHover => LoadTheme2D("n_hover.png");
|
|
70
|
+
|
|
71
|
+
public static Texture2D General2DActive => LoadTheme2D("n_active.png");
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
public static Texture2D Menu2DActive => LoadTheme2D("menu_active.png");
|
|
75
|
+
|
|
76
|
+
public static Texture2D HelpBox2D => LoadTheme2D("help_box.png");
|
|
77
|
+
|
|
78
|
+
public static Texture2D TitleBar2D => LoadTheme2D("title_bar.png");
|
|
79
|
+
|
|
80
|
+
public static Texture2D IconWarning => LoadIcon2D("warning.png");
|
|
81
|
+
public static Texture2D IconInfo => LoadIcon2D("info.png");
|
|
82
|
+
public static Texture2D IconError => LoadIcon2D("error.png");
|
|
83
|
+
|
|
84
|
+
#endregion
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
#region 默认按钮-圆角
|
|
88
|
+
|
|
89
|
+
public static GUIStyle Btn => CreateColorButtonStyle("Default.Btn", General2DNormal, General2DHover,
|
|
90
|
+
General2DActive, (style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
91
|
+
|
|
92
|
+
public static GUIStyle BtnLeft => CreateColorButtonStyle("Default.BtnLeft", General2DNormal, General2DHover,
|
|
93
|
+
General2DActive, (style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
94
|
+
|
|
95
|
+
public static GUIStyle BtnRight => CreateColorButtonStyle("Default.BtnRight", General2DNormal, General2DHover,
|
|
96
|
+
General2DActive, (style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
103
97
|
|
|
98
|
+
#endregion
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
#region 菜单栏按钮-圆角
|
|
106
101
|
|
|
107
|
-
public static GUIStyle
|
|
108
|
-
|
|
102
|
+
public static GUIStyle MenuButton => CreateColorButtonStyle("Default.MenuButton", General2DNormal,
|
|
103
|
+
General2DHover,
|
|
104
|
+
General2DActive, (style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
109
105
|
|
|
110
|
-
private static GUIStyle _boldButton = null;
|
|
111
106
|
|
|
112
|
-
public static GUIStyle
|
|
113
|
-
|
|
107
|
+
public static GUIStyle MenuButtonActive => CreateColorButtonStyle("Default.MenuButtonActive", Menu2DActive,
|
|
108
|
+
Menu2DActive,
|
|
109
|
+
Menu2DActive, (style) =>
|
|
114
110
|
{
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
style.alignment = TextAnchor.MiddleLeft;
|
|
112
|
+
style.fontStyle = FontStyle.Bold;
|
|
117
113
|
});
|
|
118
114
|
|
|
119
|
-
|
|
115
|
+
#endregion
|
|
120
116
|
|
|
121
|
-
|
|
117
|
+
#region 绿色按钮-圆角
|
|
118
|
+
|
|
119
|
+
public static GUIStyle BtnGreen => CreateColorButtonStyle("Default.BtnGreen", Green2DNormal, Green2DHover,
|
|
120
|
+
Green2DActive,
|
|
121
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
public static GUIStyle BtnGreenLeft => CreateColorButtonStyle("Default.BtnGreenLeft", Green2DNormal,
|
|
125
|
+
Green2DHover,
|
|
126
|
+
Green2DActive,
|
|
127
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
public static GUIStyle BtnGreenRight => CreateColorButtonStyle("Default.BtnGreenRight", Green2DNormal,
|
|
131
|
+
Green2DHover,
|
|
132
|
+
Green2DActive,
|
|
133
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
134
|
+
|
|
135
|
+
#endregion
|
|
136
|
+
|
|
137
|
+
#region 蓝色按钮-圆角
|
|
138
|
+
|
|
139
|
+
public static GUIStyle BtnBlue => CreateColorButtonStyle("Default.BtnBlue", Blue2DNormal, Blue2DHover,
|
|
140
|
+
Blue2DActive,
|
|
141
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
142
|
+
|
|
143
|
+
public static GUIStyle BtnBlueLeft => CreateColorButtonStyle("Default.BtnBlueLeft", Blue2DNormal, Blue2DHover,
|
|
144
|
+
Blue2DActive,
|
|
145
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
146
|
+
|
|
147
|
+
public static GUIStyle BtnBlueRight => CreateColorButtonStyle("Default.BtnBlueRight", Blue2DNormal, Blue2DHover,
|
|
148
|
+
Blue2DActive,
|
|
149
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
150
|
+
|
|
151
|
+
#endregion
|
|
152
|
+
|
|
153
|
+
#region 黄色按钮-圆角
|
|
154
|
+
|
|
155
|
+
public static GUIStyle BtnYellow => CreateColorButtonStyle("Default.BtnYellow", Yellow2DNormal, Yellow2DHover,
|
|
156
|
+
Yellow2DActive,
|
|
157
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
public static GUIStyle BtnYellowLeft => CreateColorButtonStyle("Default.BtnYellowLeft", Yellow2DNormal,
|
|
161
|
+
Yellow2DHover,
|
|
162
|
+
Yellow2DActive,
|
|
163
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
public static GUIStyle BtnYellowRight => CreateColorButtonStyle("Default.BtnYellowRight", Yellow2DNormal,
|
|
167
|
+
Yellow2DHover,
|
|
168
|
+
Yellow2DActive,
|
|
169
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
170
|
+
|
|
171
|
+
#endregion
|
|
172
|
+
|
|
173
|
+
#region 红色按钮-圆角
|
|
174
|
+
|
|
175
|
+
public static GUIStyle BtnRed => CreateColorButtonStyle("Default.BtnRed", Red2DNormal, Red2DHover,
|
|
176
|
+
Red2DActive,
|
|
177
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
178
|
+
|
|
179
|
+
public static GUIStyle BtnRedLeft => CreateColorButtonStyle("Default.BtnRedLeft", Red2DNormal, Red2DHover,
|
|
180
|
+
Red2DActive,
|
|
181
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
182
|
+
|
|
183
|
+
public static GUIStyle BtnRedRight => CreateColorButtonStyle("Default.BtnRedRight", Red2DNormal, Red2DHover,
|
|
184
|
+
Red2DActive,
|
|
185
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
186
|
+
|
|
187
|
+
#endregion
|
|
188
|
+
|
|
189
|
+
#region Label
|
|
190
|
+
|
|
191
|
+
public static GUIStyle HelpBox => CreateStyle("Default.HelpBox", GUI.skin.textArea, (style) =>
|
|
122
192
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
193
|
+
style.border = new RectOffset(6, 6, 6, 6);
|
|
194
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
195
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
196
|
+
style.normal.background = HelpBox2D;
|
|
197
|
+
style.normal.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
198
|
+
style.alignment = TextAnchor.UpperLeft;
|
|
199
|
+
style.stretchWidth = true;
|
|
200
|
+
style.fontSize = 11;
|
|
126
201
|
});
|
|
127
202
|
|
|
128
|
-
public static GUIStyle _italicLabel = null;
|
|
129
203
|
|
|
130
|
-
public static GUIStyle ItalicLabel => CreateStyle(
|
|
204
|
+
public static GUIStyle ItalicLabel => CreateStyle("Default.ItalicLabel", "label", (style) =>
|
|
131
205
|
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
206
|
+
style.border = new RectOffset(0, 0, 0, 0);
|
|
207
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
208
|
+
style.padding = new RectOffset(2, 0, 2, 0);
|
|
209
|
+
style.fontStyle = FontStyle.Italic;
|
|
210
|
+
style.alignment = TextAnchor.UpperLeft;
|
|
136
211
|
});
|
|
137
212
|
|
|
138
213
|
|
|
139
|
-
public static GUIStyle
|
|
214
|
+
public static GUIStyle ItalicLabelMiddle => CreateStyle("Default.ItalicLabelMiddle", "label", (style) =>
|
|
215
|
+
{
|
|
216
|
+
style.border = new RectOffset(0, 0, 0, 0);
|
|
217
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
218
|
+
style.padding = new RectOffset(2, 0, 2, 0);
|
|
219
|
+
style.fontStyle = FontStyle.Italic;
|
|
220
|
+
style.alignment = TextAnchor.MiddleLeft;
|
|
221
|
+
});
|
|
140
222
|
|
|
141
|
-
public static GUIStyle
|
|
223
|
+
public static GUIStyle BoldLabel => CreateStyle("Default.BoldLabel", "label", (style) =>
|
|
142
224
|
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
e.padding = new RectOffset(0, 0, 0, 0);
|
|
149
|
-
SetStyleStateOutlineColor(e, normal, hover, active, new Color(0.17f, 0.3f, 0.34f, 1f));
|
|
150
|
-
e.normal.textColor = TextColor;
|
|
151
|
-
e.focused.textColor = TextColor;
|
|
152
|
-
e.hover.textColor = TextColor;
|
|
153
|
-
e.active.textColor = TextColor;
|
|
154
|
-
e.alignment = TextAnchor.MiddleCenter;
|
|
155
|
-
e.contentOffset = Vector2.zero;
|
|
156
|
-
e.fixedWidth = 0;
|
|
157
|
-
e.fixedHeight = 0;
|
|
158
|
-
e.stretchHeight = false;
|
|
159
|
-
e.stretchWidth = true;
|
|
160
|
-
e.fontStyle = FontStyle.Bold;
|
|
225
|
+
style.border = new RectOffset(2, 2, 2, 2);
|
|
226
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
227
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
228
|
+
style.fontStyle = FontStyle.Bold;
|
|
229
|
+
style.alignment = TextAnchor.UpperLeft;
|
|
161
230
|
});
|
|
162
231
|
|
|
232
|
+
public static GUIStyle BoldLabelMiddle => CreateStyle("Default.BoldLabelMiddle", "label", (style) =>
|
|
233
|
+
{
|
|
234
|
+
style.border = new RectOffset(2, 2, 2, 2);
|
|
235
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
236
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
237
|
+
style.fontStyle = FontStyle.Bold;
|
|
238
|
+
style.alignment = TextAnchor.MiddleLeft;
|
|
239
|
+
});
|
|
163
240
|
|
|
164
|
-
|
|
241
|
+
|
|
242
|
+
public static GUIStyle TitleBar => CreateStyle("Default.TitleBar", "label", (style) =>
|
|
165
243
|
{
|
|
244
|
+
style.border = new RectOffset(2, 2, 2, 2);
|
|
245
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
246
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
247
|
+
style.overflow = new RectOffset(0, 0, 0, 0);
|
|
248
|
+
|
|
249
|
+
style.normal.background = TitleBar2D;
|
|
250
|
+
style.fontStyle = FontStyle.Bold;
|
|
251
|
+
style.stretchWidth = true;
|
|
252
|
+
style.alignment = TextAnchor.MiddleLeft;
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
#endregion
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
public class Square
|
|
259
|
+
{
|
|
260
|
+
//Square 绿色
|
|
261
|
+
public static Texture2D SquareGreen2DNormal => LoadTheme2D("square_g_normal.png");
|
|
262
|
+
public static Texture2D SquareGreen2DHover => LoadTheme2D("square_g_hover.png");
|
|
263
|
+
public static Texture2D SquareGreen2DActive => LoadTheme2D("square_g_active.png");
|
|
264
|
+
|
|
265
|
+
//Square 蓝色
|
|
266
|
+
public static Texture2D SquareBlue2DNormal => LoadTheme2D("square_b_normal.png");
|
|
267
|
+
public static Texture2D SquareBlue2DHover => LoadTheme2D("square_b_hover.png");
|
|
268
|
+
|
|
269
|
+
public static Texture2D SquareBlue2DActive => LoadTheme2D("square_b_active.png");
|
|
270
|
+
|
|
271
|
+
//Square 红色
|
|
272
|
+
public static Texture2D SquareRed2DNormal => LoadTheme2D("square_r_normal.png");
|
|
273
|
+
public static Texture2D SquareRed2DHover => LoadTheme2D("square_r_hover.png");
|
|
274
|
+
public static Texture2D SquareRed2DActive => LoadTheme2D("square_r_active.png");
|
|
275
|
+
|
|
276
|
+
//Square 黄色
|
|
277
|
+
public static Texture2D SquareYellow2DNormal => LoadTheme2D("square_y_normal.png");
|
|
278
|
+
public static Texture2D SquareYellow2DHover => LoadTheme2D("square_y_hover.png");
|
|
279
|
+
public static Texture2D SquareYellow2DActive => LoadTheme2D("square_y_active.png");
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
//Square 默认色
|
|
283
|
+
public static Texture2D SquareGeneral2DNormal => LoadTheme2D("square_n_normal.png");
|
|
284
|
+
public static Texture2D SquareGeneral2DHover => LoadTheme2D("square_n_hover.png");
|
|
285
|
+
public static Texture2D SquareGeneral2DActive => LoadTheme2D("square_n_active.png");
|
|
286
|
+
|
|
287
|
+
public static Texture2D SquareMenu2DActive => LoadTheme2D("square_menu_active.png");
|
|
288
|
+
|
|
289
|
+
#region 默认按钮-方形
|
|
290
|
+
|
|
291
|
+
public static GUIStyle Btn => CreateColorSquareButtonStyle("Square.Btn", SquareGeneral2DNormal,
|
|
292
|
+
SquareGeneral2DHover, SquareGeneral2DActive, (style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
public static GUIStyle BtnBold => CreateColorSquareButtonStyle("Square.BtnBold", SquareGeneral2DNormal,
|
|
296
|
+
SquareGeneral2DHover, SquareGeneral2DActive, (style) =>
|
|
297
|
+
{
|
|
298
|
+
style.alignment = TextAnchor.MiddleCenter;
|
|
299
|
+
style.fontStyle = FontStyle.Bold;
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
public static GUIStyle BtnLeft => CreateColorSquareButtonStyle("Square.BtnLeft",
|
|
304
|
+
SquareGeneral2DNormal,
|
|
305
|
+
SquareGeneral2DHover, SquareGeneral2DActive, (style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
306
|
+
|
|
307
|
+
public static GUIStyle BtnRight => CreateColorSquareButtonStyle("Square.BtnRight",
|
|
308
|
+
SquareGeneral2DNormal,
|
|
309
|
+
SquareGeneral2DHover, SquareGeneral2DActive, (style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
310
|
+
|
|
311
|
+
#endregion
|
|
312
|
+
|
|
313
|
+
#region 菜单栏按钮-方形
|
|
314
|
+
|
|
315
|
+
public static GUIStyle MenuButton => CreateColorSquareButtonStyle("Square.MenuButton",
|
|
316
|
+
SquareGeneral2DNormal,
|
|
317
|
+
SquareGeneral2DHover, SquareGeneral2DActive,
|
|
318
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
319
|
+
|
|
320
|
+
public static GUIStyle MenuButtonActive => CreateColorSquareButtonStyle("Square.MenuButtonActive",
|
|
321
|
+
SquareMenu2DActive,
|
|
322
|
+
SquareMenu2DActive, SquareMenu2DActive,
|
|
323
|
+
(style) =>
|
|
324
|
+
{
|
|
325
|
+
style.alignment = TextAnchor.MiddleLeft;
|
|
326
|
+
style.fontStyle = FontStyle.Bold;
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
#endregion
|
|
330
|
+
|
|
331
|
+
#region 绿色按钮-方形
|
|
332
|
+
|
|
333
|
+
public static GUIStyle BtnGreen => CreateColorSquareButtonStyle("Square.BtnGreen",
|
|
334
|
+
SquareGreen2DNormal,
|
|
335
|
+
SquareGreen2DHover,
|
|
336
|
+
SquareGreen2DActive,
|
|
337
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
public static GUIStyle BtnGreenLeft => CreateColorSquareButtonStyle("Square.BtnGreenLeft",
|
|
341
|
+
SquareGreen2DNormal,
|
|
342
|
+
SquareGreen2DHover,
|
|
343
|
+
SquareGreen2DActive,
|
|
344
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
public static GUIStyle BtnGreenRight => CreateColorSquareButtonStyle("Square.BtnGreenRight",
|
|
348
|
+
SquareGreen2DNormal,
|
|
349
|
+
SquareGreen2DHover,
|
|
350
|
+
SquareGreen2DActive,
|
|
351
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
352
|
+
|
|
353
|
+
#endregion
|
|
354
|
+
|
|
355
|
+
#region 蓝色按钮-方形
|
|
356
|
+
|
|
357
|
+
public static GUIStyle BtnBlue => CreateColorSquareButtonStyle("Square.BtnBlue",
|
|
358
|
+
SquareBlue2DNormal,
|
|
359
|
+
SquareBlue2DHover,
|
|
360
|
+
SquareBlue2DActive,
|
|
361
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
362
|
+
|
|
363
|
+
public static GUIStyle BtnBlueLeft => CreateColorSquareButtonStyle("Square.BtnBlueLeft",
|
|
364
|
+
SquareBlue2DNormal,
|
|
365
|
+
SquareBlue2DHover,
|
|
366
|
+
SquareBlue2DActive,
|
|
367
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
368
|
+
|
|
369
|
+
public static GUIStyle BtnBlueRight => CreateColorSquareButtonStyle("Square.BtnBlueRight",
|
|
370
|
+
SquareBlue2DNormal,
|
|
371
|
+
SquareBlue2DHover,
|
|
372
|
+
SquareBlue2DActive,
|
|
373
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
374
|
+
|
|
375
|
+
#endregion
|
|
376
|
+
|
|
377
|
+
#region 黄色按钮-方形
|
|
378
|
+
|
|
379
|
+
public static GUIStyle BtnYellow => CreateColorSquareButtonStyle("Square.BtnYellow",
|
|
380
|
+
SquareYellow2DNormal,
|
|
381
|
+
SquareYellow2DHover,
|
|
382
|
+
SquareYellow2DActive,
|
|
383
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
public static GUIStyle BtnYellowLeft => CreateColorSquareButtonStyle("Square.BtnYellowLeft",
|
|
387
|
+
SquareYellow2DNormal,
|
|
388
|
+
SquareYellow2DHover,
|
|
389
|
+
SquareYellow2DActive,
|
|
390
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
public static GUIStyle BtnYellowRight => CreateColorSquareButtonStyle("Square.BtnYellowRight",
|
|
394
|
+
SquareYellow2DNormal,
|
|
395
|
+
SquareYellow2DHover,
|
|
396
|
+
SquareYellow2DActive,
|
|
397
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
398
|
+
|
|
399
|
+
#endregion
|
|
400
|
+
|
|
401
|
+
#region 红色按钮-方形
|
|
402
|
+
|
|
403
|
+
public static GUIStyle BtnRed => CreateColorSquareButtonStyle("Square.BtnRed",
|
|
404
|
+
SquareRed2DNormal,
|
|
405
|
+
SquareRed2DHover,
|
|
406
|
+
SquareRed2DActive,
|
|
407
|
+
(style) => { style.alignment = TextAnchor.MiddleCenter; });
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
public static GUIStyle BtnRedLeft => CreateColorSquareButtonStyle("Square.BtnRedLeft",
|
|
411
|
+
SquareRed2DNormal,
|
|
412
|
+
SquareRed2DHover,
|
|
413
|
+
SquareRed2DActive,
|
|
414
|
+
(style) => { style.alignment = TextAnchor.MiddleLeft; });
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
public static GUIStyle BtnRedRight => CreateColorSquareButtonStyle("Square.BtnRedRight",
|
|
418
|
+
SquareRed2DNormal,
|
|
419
|
+
SquareRed2DHover,
|
|
420
|
+
SquareRed2DActive,
|
|
421
|
+
(style) => { style.alignment = TextAnchor.MiddleRight; });
|
|
422
|
+
|
|
423
|
+
#endregion
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
private static GUIStyle CreateStyle(string name, string proto, Action<GUIStyle> onCreate)
|
|
427
|
+
{
|
|
428
|
+
var style = GetStyle(name);
|
|
166
429
|
if (style == null)
|
|
167
430
|
{
|
|
168
431
|
style = new GUIStyle(proto);
|
|
169
432
|
onCreate?.Invoke(style);
|
|
433
|
+
_styles.Add(name, style);
|
|
170
434
|
}
|
|
171
435
|
|
|
172
436
|
return style;
|
|
173
437
|
}
|
|
174
438
|
|
|
175
|
-
private static GUIStyle CreateStyle(
|
|
439
|
+
private static GUIStyle CreateStyle(string name, GUIStyle proto, Action<GUIStyle> onCreate)
|
|
176
440
|
{
|
|
441
|
+
var style = GetStyle(name);
|
|
177
442
|
if (style == null)
|
|
178
443
|
{
|
|
179
444
|
style = new GUIStyle(proto);
|
|
180
445
|
onCreate?.Invoke(style);
|
|
446
|
+
_styles.Add(name, style);
|
|
181
447
|
}
|
|
182
448
|
|
|
183
449
|
return style;
|
|
184
450
|
}
|
|
185
451
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
public static Texture2D MakeColorTex(Color color)
|
|
452
|
+
private static GUIStyle CreateColorButtonStyle(string name, Texture2D normal, Texture2D hover,
|
|
453
|
+
Texture2D active, Action<GUIStyle> onCreate)
|
|
189
454
|
{
|
|
190
|
-
|
|
191
|
-
tex.SetPixels(new[]
|
|
455
|
+
return CreateStyle(name, "button", (style) =>
|
|
192
456
|
{
|
|
193
|
-
|
|
194
|
-
|
|
457
|
+
style.border = new RectOffset(6, 6, 6, 6);
|
|
458
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
459
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
460
|
+
style.overflow = new RectOffset(0, 0, 0, 0);
|
|
461
|
+
style.alignment = TextAnchor.MiddleCenter;
|
|
462
|
+
style.normal.background = normal;
|
|
463
|
+
style.normal.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
464
|
+
|
|
465
|
+
style.hover.background = hover;
|
|
466
|
+
style.hover.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
467
|
+
|
|
468
|
+
style.focused.background = active;
|
|
469
|
+
style.focused.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
470
|
+
|
|
471
|
+
style.active.background = active;
|
|
472
|
+
style.active.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
style.onNormal.background = normal;
|
|
476
|
+
style.onNormal.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
477
|
+
|
|
478
|
+
style.onHover.background = hover;
|
|
479
|
+
style.onHover.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
480
|
+
|
|
481
|
+
style.onActive.background = active;
|
|
482
|
+
style.onActive.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
483
|
+
|
|
484
|
+
style.onFocused.background = active;
|
|
485
|
+
style.onFocused.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
486
|
+
onCreate?.Invoke(style);
|
|
195
487
|
});
|
|
196
|
-
tex.Apply();
|
|
197
|
-
return tex;
|
|
198
488
|
}
|
|
199
489
|
|
|
200
|
-
|
|
201
|
-
|
|
490
|
+
//方形按钮
|
|
491
|
+
private static GUIStyle CreateColorSquareButtonStyle(string name, Texture2D normal, Texture2D hover,
|
|
492
|
+
Texture2D active, Action<GUIStyle> onCreate)
|
|
202
493
|
{
|
|
203
|
-
|
|
204
|
-
tex.SetPixels(new[]
|
|
494
|
+
return CreateStyle(name, "button", (style) =>
|
|
205
495
|
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
496
|
+
style.border = new RectOffset(2, 2, 2, 2);
|
|
497
|
+
style.margin = new RectOffset(2, 2, 2, 2);
|
|
498
|
+
style.padding = new RectOffset(4, 4, 4, 4);
|
|
499
|
+
style.overflow = new RectOffset(0, 0, 0, 0);
|
|
500
|
+
style.alignment = TextAnchor.MiddleCenter;
|
|
501
|
+
style.normal.background = normal;
|
|
502
|
+
style.normal.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
503
|
+
|
|
504
|
+
style.hover.background = hover;
|
|
505
|
+
style.hover.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
506
|
+
|
|
507
|
+
style.focused.background = active;
|
|
508
|
+
style.focused.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
509
|
+
|
|
510
|
+
style.active.background = active;
|
|
511
|
+
style.active.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
style.onNormal.background = normal;
|
|
515
|
+
style.onNormal.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
516
|
+
|
|
517
|
+
style.onHover.background = hover;
|
|
518
|
+
style.onHover.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
519
|
+
|
|
520
|
+
style.onActive.background = active;
|
|
521
|
+
style.onActive.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
522
|
+
|
|
523
|
+
style.onFocused.background = active;
|
|
524
|
+
style.onFocused.scaledBackgrounds = Array.Empty<Texture2D>();
|
|
525
|
+
onCreate?.Invoke(style);
|
|
210
526
|
});
|
|
211
|
-
tex.Apply();
|
|
212
|
-
return tex;
|
|
213
527
|
}
|
|
214
528
|
|
|
215
|
-
|
|
216
|
-
public static void SetStyleStateColor(GUIStyle style, Color normal, Color hover, Color active)
|
|
529
|
+
private static Texture2D LoadIcon2D(string name)
|
|
217
530
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
style.onFocused = new GUIStyleState();
|
|
226
|
-
var normalTex = MakeColorTex(normal);
|
|
227
|
-
var hoverTex = MakeColorTex(hover);
|
|
228
|
-
var activeTex = MakeColorTex(active);
|
|
229
|
-
style.normal.background = normalTex;
|
|
230
|
-
style.hover.background = hoverTex;
|
|
231
|
-
style.active.background = activeTex;
|
|
232
|
-
style.focused.background = activeTex;
|
|
233
|
-
style.onNormal.background = normalTex;
|
|
234
|
-
style.onHover.background = hoverTex;
|
|
235
|
-
style.onActive.background = activeTex;
|
|
236
|
-
style.onFocused.background = activeTex;
|
|
237
|
-
}
|
|
531
|
+
var tex = Get2D(name);
|
|
532
|
+
if (tex == null)
|
|
533
|
+
{
|
|
534
|
+
var path = $"{UniEditor.PathRoot}/Editor/Texture/icon/{name}";
|
|
535
|
+
tex = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
|
536
|
+
_texture2Ds.Add(name, tex);
|
|
537
|
+
}
|
|
238
538
|
|
|
539
|
+
return tex;
|
|
540
|
+
}
|
|
239
541
|
|
|
240
|
-
|
|
241
|
-
Color outline)
|
|
542
|
+
private static Texture2D LoadTheme2D(string name)
|
|
242
543
|
{
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
style.normal.background = normalTex;
|
|
255
|
-
style.hover.background = hoverTex;
|
|
256
|
-
style.active.background = activeTex;
|
|
257
|
-
style.focused.background = activeTex;
|
|
258
|
-
style.onNormal.background = normalTex;
|
|
259
|
-
style.onHover.background = hoverTex;
|
|
260
|
-
style.onActive.background = activeTex;
|
|
261
|
-
style.onFocused.background = activeTex;
|
|
544
|
+
var tex = Get2D(name);
|
|
545
|
+
if (tex == null)
|
|
546
|
+
{
|
|
547
|
+
var path = EditorGUIUtility.isProSkin
|
|
548
|
+
? $"{UniEditor.PathRoot}/Editor/Texture/dark/{name}"
|
|
549
|
+
: $"{UniEditor.PathRoot}/Editor/Texture/light/{name}";
|
|
550
|
+
tex = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
|
551
|
+
_texture2Ds.Add(name, tex);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return tex;
|
|
262
555
|
}
|
|
263
556
|
}
|
|
264
557
|
}
|