Background
How do I use Background
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ChatGui.cs
Copy
58 public void Start()
59 {
60 DontDestroyOnLoad(this.gameObject);
61 Application.runInBackground = true; // this must run in background or it will drop connection if not focussed.
62
63 if (string.IsNullOrEmpty(this.UserName))
64 {
65 this.UserName = "user" + Environment.TickCount%99; //made-up username
66 }
67
68 chatClient = new ChatClient(this);
69 chatClient.Connect(ChatAppId, "1.0", this.UserName, null);
70
71 if (this.AlignBottom)
72 {
73 this.GuiRect.y = Screen.height - this.GuiRect.height;
74 }
75 if (this.FullScreen)
76 {
77 this.GuiRect.x = 0;
78 this.GuiRect.y = 0;
79 this.GuiRect.width = Screen.width;
80 this.GuiRect.height = Screen.height;
81 }
82
83 Debug.Log(this.UserName);
84 }
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
33 {
34 get
35 {
36 if( m_DefaultContainerStyle == null )
37 {
38 m_DefaultContainerStyle = new GUIStyle();
39 m_DefaultContainerStyle.border = new RectOffset( 2, 2, 1, 2 );
40 m_DefaultContainerStyle.margin = new RectOffset( 5, 5, 5, 5 );
41 m_DefaultContainerStyle.padding = new RectOffset( 1, 1, 2, 2 );
42 m_DefaultContainerStyle.normal.background = ReorderableListResources.texContainerBackground;
43 }
44
45 return m_DefaultContainerStyle;
46 }
47 }
File name: PhotonGUI.cs
Copy
51 {
52 get
53 {
54 if( m_DefaultAddButtonStyle == null )
55 {
56 m_DefaultAddButtonStyle = new GUIStyle();
57 m_DefaultAddButtonStyle.fixedWidth = 30;
58 m_DefaultAddButtonStyle.fixedHeight = 16;
59 m_DefaultAddButtonStyle.normal.background = ReorderableListResources.texAddButton;
60 m_DefaultAddButtonStyle.active.background = ReorderableListResources.texAddButtonActive;
61 }
62
63 return m_DefaultAddButtonStyle;
64 }
65 }
File name: PhotonGUI.cs
Copy
69 {
70 get
71 {
72 if( m_DefaultRemoveButtonStyle == null )
73 {
74 m_DefaultRemoveButtonStyle = new GUIStyle();
75 m_DefaultRemoveButtonStyle.fixedWidth = 30;
76 m_DefaultRemoveButtonStyle.fixedHeight = 20;
77 m_DefaultRemoveButtonStyle.active.background = ReorderableListResources.CreatePixelTexture( "Dark Pixel (List GUI)", new Color32( 18, 18, 18, 255 ) );
78 m_DefaultRemoveButtonStyle.imagePosition = ImagePosition.ImageOnly;
79 m_DefaultRemoveButtonStyle.alignment = TextAnchor.MiddleCenter;
80 }
81
82 return m_DefaultRemoveButtonStyle;
83 }
84 }
File name: PhotonGUI.cs
Copy
88 {
89 get
90 {
91 if( m_DefaultContainerRowStyle == null )
92 {
93 m_DefaultContainerRowStyle = new GUIStyle();
94 m_DefaultContainerRowStyle.border = new RectOffset( 2, 2, 2, 2 );
95
96 m_DefaultContainerRowStyle.margin = new RectOffset( 5, 5, 5, 5 );
97 m_DefaultContainerRowStyle.padding = new RectOffset( 1, 1, 2, 2 );
98 m_DefaultContainerRowStyle.normal.background = ReorderableListResources.texContainerBackground;
99 }
100
101 return m_DefaultContainerRowStyle;
102 }
103 }
File name: ReorderableListResources.cs
Copy
28 {
29 add_button = 0,
30 add_button_active,
31 container_background,
32 grab_handle,
33 remove_button,
34 remove_button_active,
35 title_background,
36 }
File name: ReorderableListResources.cs
Copy
89 {
90 get { return s_Cached[ (int)ResourceName.container_background ]; }
91 }
File name: ReorderableListResources.cs
Copy
117 {
118 get { return s_Cached[ (int)ResourceName.title_background ]; }
119 }
File name: ReorderableListResources.cs
Copy
224 public static void DrawTexture( Rect position, Texture2D texture )
225 {
226 if( Event.current.type != EventType.Repaint )
227 return;
228
229 s_TempStyle.normal.background = texture;
230
231 s_TempStyle.Draw( position, GUIContent.none, false, false, false, false );
232 }
Download file with original file name:Background
Background 173 lượt xem
Gõ tìm kiếm nhanh...