Panel
How do I use Panel
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonConverter.cs
Copy
120 public static void PickFolderAndConvertScripts()
121 {
122 string folderPath = EditorUtility.OpenFolderPanel("Pick source folder to convert", Directory.GetCurrentDirectory(), "");
123 if (string.IsNullOrEmpty(folderPath))
124 {
125 EditorUtility.DisplayDialog("Script Conversion", "No folder was selected. No files were changed. Please start over.", "Ok.");
126 return;
127 }
128
129 bool result = EditorUtility.DisplayDialog("Script Conversion", "Scripts in this folder will be modified:\n\n" + folderPath + "\n\nMake sure you have backups of these scripts.\nConversion is not guaranteed to work!", "Backup done. Go!", "Abort");
130 if (!result)
131 {
132 return;
133 }
134
135 List
136 ConvertScripts(scripts);
137
138 EditorUtility.DisplayDialog("Script Conversion", "Scripts are now converted to PUN.\n\nYou will need to update\n- scenes\n- components\n- prefabs and\n- add \"PhotonNetwork.ConnectWithDefaultSettings();\"", "Ok");
139 }
File name: GameManagerScript.cs
Copy
56 public void pauseGame () {
57 pausePanel.SetActive (true);
58 bestScore.text = "Best Score: " + PlayerPrefs.GetInt ("bestScore");
59 highCoinScore.text = "Best Coin Score: " +PlayerPrefs.GetInt ("bestCoinScore");
60 Time.timeScale = 0f;
61 }
File name: GameManagerScript.cs
Copy
63 public void resumeGame () {
64 pausePanel.SetActive (false);
65 scoreText.text = "Score: " + PlayerMoveScript.instance.scoreCount;
66 Time.timeScale = 1f;
67 }
File name: GameManagerScript.cs
Copy
69 public void playAgain () {
70 Time.timeScale = 1f;
71 pauseButton.gameObject.SetActive (true);
72 SceneManager.LoadScene ("Gameplay");
73 gameOverPanel.SetActive (false);
74 }
File name: GameManagerScript.cs
Copy
88 public void gameOver (int score, int coins) {
89 coinScore.gameObject.SetActive (false);
90 pauseButton.gameObject.SetActive (false);
91 gameOverPanel.SetActive (true);
92 gameOverBestScore.text = "Your Score: " + score;
93 gameOverHighCoinScore.text = "Your Coin Score: " + coins;
94
95 }
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: GameplayController.cs
Copy
34 void Update () {
35 if(Input.GetKeyDown(KeyCode.Escape)){
36 PausePanel ();
37 }
38 }
File name: GameplayController.cs
Copy
40 void InitializeGameplayVariables(){
41 if(GameController.instance != null){
42 InitializeCoins ();
43 InitializeWeaponLevel ();
44 InitializeUpgradePrice ();
45 }
46 InitializePlayer ();
47 statusTab.SetActive (true);
48 deployButton.SetActive (true);
49 upgradeButton.SetActive (true);
50 coinTab.SetActive (false);
51 gameoverPanel.SetActive (false);
52 startMoving = false;
53 }
File name: GameplayController.cs
Copy
178 public void UpgradeButton(){
179 upgradMenuPanel.SetActive (true);
180 }
Download file with original file name:Panel
Panel 113 lượt xem
Gõ tìm kiếm nhanh...