Removed TOTU 103
This commit is contained in:
		
							
								
								
									
										19
									
								
								Assets/Scripts/DebugLogger/DebugLoggerInitializer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Assets/Scripts/DebugLogger/DebugLoggerInitializer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| using UnityEngine; | ||||
|  | ||||
| public class DebugLoggerInitializer : MonoBehaviour | ||||
| { | ||||
|     private static bool isInitialized = false; | ||||
|  | ||||
|     private void Awake() | ||||
|     { | ||||
|         if (!isInitialized) | ||||
|         { | ||||
|             DontDestroyOnLoad(gameObject); // Evita que este objeto se destruya | ||||
|             isInitialized = true; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             Destroy(gameObject); // Previene duplicados | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugLoggerInitializer.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugLoggerInitializer.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 237f2195a9d7dd54cb946761ace85155 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										34
									
								
								Assets/Scripts/DebugLogger/DebugLoggerUI.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Assets/Scripts/DebugLogger/DebugLoggerUI.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| using System.Collections.Generic; | ||||
| using TMPro; | ||||
| using UnityEngine; | ||||
|  | ||||
| public class DebugLoggerUI : MonoBehaviour | ||||
| { | ||||
|     //FindObjectOfType<DebugLoggerUI>().AddMessage(""); | ||||
|     public TextMeshProUGUI debugText; // Referencia al componente TextMeshPro | ||||
|     public int maxMessages = 10; // N<>mero m<>ximo de mensajes visibles | ||||
|  | ||||
|     private List<string> messageList = new List<string>(); // Historial de mensajes | ||||
|  | ||||
|     // M<>todo para a<>adir un mensaje | ||||
|     public void AddMessage(string message) | ||||
|     { | ||||
|         // Si supera el l<>mite, elimina el mensaje m<>s antiguo | ||||
|         if (messageList.Count >= maxMessages) | ||||
|         { | ||||
|             messageList.RemoveAt(0); | ||||
|         } | ||||
|  | ||||
|         // A<>adir el mensaje a la lista | ||||
|         messageList.Add(message); | ||||
|  | ||||
|         // Actualizar el texto | ||||
|         UpdateText(); | ||||
|     } | ||||
|  | ||||
|     // Actualiza el contenido del texto para mostrar el historial | ||||
|     private void UpdateText() | ||||
|     { | ||||
|         debugText.text = string.Join("\n", messageList); // Combina los mensajes en un solo string | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugLoggerUI.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugLoggerUI.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: fab85559114c59046b1ae8e812bc2163 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										14
									
								
								Assets/Scripts/DebugLogger/DebugToggleManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Assets/Scripts/DebugLogger/DebugToggleManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| using UnityEngine; | ||||
|  | ||||
| public class DebugToggleManager : MonoBehaviour | ||||
| { | ||||
|     public GameObject debugPanel; // El panel que contiene el logger | ||||
|  | ||||
|     public void ToggleDebugPanel() | ||||
|     { | ||||
|         if (debugPanel != null) | ||||
|         { | ||||
|             debugPanel.SetActive(!debugPanel.activeSelf); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugToggleManager.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/DebugLogger/DebugToggleManager.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 69aa4566e251fc340834b5ecc6a15af5 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										23
									
								
								Assets/Scripts/DebugLogger/PersistentSceneManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Assets/Scripts/DebugLogger/PersistentSceneManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| using UnityEngine; | ||||
| using UnityEngine.SceneManagement; | ||||
|  | ||||
| public class PersistentSceneManager : MonoBehaviour | ||||
| { | ||||
|     private static bool isInitialized = false; | ||||
|  | ||||
|     private void Awake() | ||||
|     { | ||||
|         if (!isInitialized) | ||||
|         { | ||||
|             DontDestroyOnLoad(gameObject); // Previene la destrucci<63>n de este objeto al cambiar de escena | ||||
|             isInitialized = true; | ||||
|  | ||||
|             // Cargar la escena principal en modo aditivo | ||||
|             SceneManager.LoadScene("MainScreen", LoadSceneMode.Additive); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             Destroy(gameObject); // Evitar duplicados | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/DebugLogger/PersistentSceneManager.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/DebugLogger/PersistentSceneManager.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: caa6ee8d648c1194a9cd77afed65cd90 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
		Reference in New Issue
	
	Block a user
	 Ignacio Gómez Puga
					Ignacio Gómez Puga