PlayButton
How do I use Play Button
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: MenuManager.cs
Copy
33 public void instructionMenu () {
34 instructionPanel.SetActive (true);
35 playButton.gameObject.SetActive (false);
36 quitButton.gameObject.SetActive (false);
37 menuButton.gameObject.SetActive (false);
38 image.SetActive (false);
39 }
File name: MenuManager.cs
Copy
45 public void closeInstruction () {
46 instructionPanel.SetActive (false);
47 playButton.gameObject.SetActive (true);
48 quitButton.gameObject.SetActive (true);
49 menuButton.gameObject.SetActive (true);
50 image.SetActive (true);
51 }
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 }
File name: MainMenuController.cs
Copy
41 public void PlayButton(){
42 SceneManager.LoadScene("Level Menu");
43 }
File name: Button.cs
Copy
17 public override void OnTouchDown()
18 {
19 if (InputController.Name != InputNames.DIALOG) return;
20 base.OnTouchDown();
21 transform.localScale = new Vector3(0.9f, 0.9f, transform.localScale.z);
22 SoundManager.playButtonSound();
23 }
File name: NextGuideClickListener.cs
Copy
22 public override void OnTouchDown()
23 {
24 if (InputController.Name != InputNames.DIALOG) return;
25 base.OnTouchDown();
26 gameObject.GetComponent
27 SoundManager.playButtonSound();
28 }
File name: PauseLayerClickListener.cs
Copy
16 public override void OnTouchDown()
17 {
18 if (InputController.Name != InputNames.DIALOG) return;
19 base.OnTouchDown();
20 gameObject.transform.localScale = new Vector3(0.9f, 0.9f, gameObject.transform.localScale.z);
21 SoundManager.playButtonSound();
22 }
File name: ButtonStartClickListener.cs
Copy
18 public override void OnTouchDown()
19 {
20 if (InputController.Name != InputNames.DIALOG) return;
21 base.OnTouchDown();
22 gameObject.GetComponent
23 SoundManager.playButtonSound();
24 }
File name: ResultClickListener.cs
Copy
6 public override void OnTouchDown()
7 {
8 if (InputController.Name != InputNames.DIALOG) return;
9 base.OnTouchDown();
10 gameObject.transform.localScale = new Vector3(0.9f, 0.9f, gameObject.transform.localScale.z);
11 SoundManager.playButtonSound();
12 }
File name: PauseButtonClickListener.cs
Copy
10 public override void OnTouchDown()
11 {
12 if (InputController.Name != InputNames.GAMESCREEN) return;
13 base.OnTouchDown();
14 gameObject.GetComponent
15 SoundManager.playButtonSound();
16 }
Download file with original file name:PlayButton
PlayButton 121 lượt xem
Gõ tìm kiếm nhanh...