DefaultTitleStyle
How do I use Default Title Style
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
14 | if( m_DefaultTitleStyle == null ) | 1 |
271 | PhotonGUI.DefaultTitleStyle.Draw( controlRect, GUIContent.none, controlID ); | 2 |
File name: PhotonGUI.cs
Copy
11 {
12 get
13 {
14 if( m_DefaultTitleStyle == null )
15 {
16 m_DefaultTitleStyle = new GUIStyle();
17 m_DefaultTitleStyle.border = new RectOffset( 2, 2, 2, 1 );
18 m_DefaultTitleStyle.margin = new RectOffset( 5, 5, 5, 0 );
19 m_DefaultTitleStyle.padding = new RectOffset( 5, 5, 0, 0 );
20 m_DefaultTitleStyle.alignment = TextAnchor.MiddleLeft;
21 m_DefaultTitleStyle.normal.background = ReorderableListResources.texTitleBackground;
22 m_DefaultTitleStyle.normal.textColor = EditorGUIUtility.isProSkin
23 ? new Color( 0.8f, 0.8f, 0.8f )
24 : new Color( 0.2f, 0.2f, 0.2f );
25 }
26
27 return m_DefaultTitleStyle;
28 }
29 }
File name: PhotonGUI.cs
Copy
262 static Rect DoContainerHeader( string headline, float height, float contentOffset )
263 {
264 GUILayout.Space( 5 );
265 Rect controlRect = EditorGUILayout.GetControlRect( false, height );
266
267 int controlID = GUIUtility.GetControlID( FocusType.Passive, controlRect );
268
269 if( Event.current.type == EventType.Repaint )
270 {
271 PhotonGUI.DefaultTitleStyle.Draw( controlRect, GUIContent.none, controlID );
272
273 Rect labelRect = new Rect( controlRect.xMin + 5 + contentOffset, controlRect.yMin + 5, controlRect.width, controlRect.height );
274 GUI.Label( labelRect, headline, EditorStyles.boldLabel );
275 }
276
277 return controlRect;
278 }
DefaultTitleStyle 90 lượt xem
Gõ tìm kiếm nhanh...