mirror of
				https://github.com/DerTyp7/industrialize-unity.git
				synced 2025-10-31 05:17:10 +01:00 
			
		
		
		
	menus
This commit is contained in:
		
							
								
								
									
										44
									
								
								Assets/Scripts/Menus/MenuManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								Assets/Scripts/Menus/MenuManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| using UnityEngine; | ||||
| public class MenuManager : MonoBehaviour | ||||
| { | ||||
|     public static void OpenMenu(string id) | ||||
|     { | ||||
|         MenuDictionary.instance.GetEntryById(id).Open(); | ||||
|     } | ||||
|  | ||||
|     public static void CloseMenu(string id) | ||||
|     { | ||||
|         MenuDictionary.instance.GetEntryById(id).Close(); | ||||
|     } | ||||
|  | ||||
|     public static void ToggleMenu(string id) | ||||
|     { | ||||
|         MenuDictionary.instance.GetEntryById(id).Toggle(); | ||||
|     } | ||||
|  | ||||
|     public static void CloseAllMenus() | ||||
|     { | ||||
|         foreach (Menu menu in MenuDictionary.instance.entries) | ||||
|         { | ||||
|             menu.Close(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void Start() | ||||
|     { | ||||
|         CloseAllMenus(); | ||||
|     } | ||||
|  | ||||
|     private void Update() | ||||
|     { | ||||
|         if (Input.GetKeyDown(KeyCode.Escape)) | ||||
|         { | ||||
|             CloseAllMenus(); | ||||
|         } | ||||
|  | ||||
|         if (Input.GetButtonDown("BuildingMenu")) | ||||
|         { | ||||
|             ToggleMenu("menu_building"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Janis
					Janis