TitleLabel
How do I use Title Label
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
38 | GUIStyle titleLabelStyle = new GUIStyle(currentGUISkin.GetStyle("TitleLabel")); | 1 |
File name: MenuScript.cs
Copy
21 void OnGUI() {
22 if (this.gameScript.gameView == "menu") {
23 this.gameScript.mainCamera.transform.eulerAngles = new Vector3 (180, 23, 0);
24 this.gameScript.gameLight.intensity = 0;
25
26 //set the sizes appropriately
27 GUI.skin = this.gameScript.currentGUISkin;
28
29 GUIStyle playButtonStyle = new GUIStyle(currentGUISkin.GetStyle("Button"));
30 playButtonStyle.fontSize = Mathf.CeilToInt(Screen.height * 0.10F);
31 playButtonStyle.fontStyle = FontStyle.Italic;
32
33
34 GUIStyle menuButtonStyle = new GUIStyle(currentGUISkin.GetStyle("Button"));
35 menuButtonStyle.fontSize = Mathf.CeilToInt(Screen.height * 0.06F);
36
37
38 GUIStyle titleLabelStyle = new GUIStyle(currentGUISkin.GetStyle("TitleLabel"));
39 titleLabelStyle.fontSize = Mathf.CeilToInt(Screen.height * 0.13F);
40
41 GUI.Label (new Rect (0, 0, Screen.width, Screen.height * 0.06F), "2048 - 3D", titleLabelStyle);
42
43
44 GUI.Label (new Rect (0, Screen.height * 0.15F, Screen.width, Screen.height * 0.06F), "");
45
46
47 if (GUI.Button(new Rect(Screen.width * 0.20f, Screen.height * 0.25f, Screen.width * 0.60F, Screen.height * 0.10F),"Options", menuButtonStyle)) {
48 this.gameScript.gameView = "options";
49 }
50 if (GUI.Button(new Rect(Screen.width * 0.20f, Screen.height * 0.40f, Screen.width * 0.60F, Screen.height * 0.10F),"Instructions", menuButtonStyle)) {
51 this.gameScript.gameView = "instructions";
52 }
53 if (GUI.Button(new Rect(Screen.width * 0.20f, Screen.height * 0.55F, Screen.width * 0.60F, Screen.height * 0.10F),"Exit", menuButtonStyle)) {
54 Application.Quit();
55 }
56
57 if (GUI.Button(new Rect(Screen.width * .20f, Screen.height * 0.70F, Screen.width * 0.60F, Screen.height * 0.15F),"Play!",playButtonStyle)) {
58 this.gameScript.gameView = "game";
59 }
60
61 GUI.Label (new Rect (0, Screen.height * 0.94F, Screen.width, Screen.height * 0.06F), " 2018 - Brought To You By code-projects.org");
62
63 }
64 }
TitleLabel 131 lượt xem
Gõ tìm kiếm nhanh...