Strip UI debug stuff from the game
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using AppleHills.Core.Settings;
|
||||||
|
using Core;
|
||||||
|
|
||||||
public class DebugUIMessage : MonoBehaviour
|
public class DebugUIMessage : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -17,6 +19,14 @@ public class DebugUIMessage : MonoBehaviour
|
|||||||
/// <param name="displayColor"></param>
|
/// <param name="displayColor"></param>
|
||||||
public static void Show(string message, Color displayColor, float duration = 2f)
|
public static void Show(string message, Color displayColor, float duration = 2f)
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
var divingDevSettings = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>();
|
||||||
|
if (divingDevSettings && !divingDevSettings.ShowDebugUiMessages)
|
||||||
|
{
|
||||||
|
Logging.Debug($"[DebugUIMessage] Loggig debug message: {message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
var go = new GameObject("DebugUIMessage");
|
var go = new GameObject("DebugUIMessage");
|
||||||
@@ -25,6 +35,9 @@ public class DebugUIMessage : MonoBehaviour
|
|||||||
DontDestroyOnLoad(go);
|
DontDestroyOnLoad(go);
|
||||||
}
|
}
|
||||||
instance.ShowMessage(message, duration, displayColor);
|
instance.ShowMessage(message, duration, displayColor);
|
||||||
|
# else
|
||||||
|
Logging.Debug($"[DebugUIMessage] Loggig debug message: {message}");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -21,31 +21,12 @@ namespace AppleHills.Core.Settings
|
|||||||
[CreateAssetMenu(fileName = "DebugSettings", menuName = "AppleHills/Developer Settings/Debug", order = 2)]
|
[CreateAssetMenu(fileName = "DebugSettings", menuName = "AppleHills/Developer Settings/Debug", order = 2)]
|
||||||
public class DebugSettings : BaseDeveloperSettings
|
public class DebugSettings : BaseDeveloperSettings
|
||||||
{
|
{
|
||||||
[Header("Visualization")]
|
[Header("Visual Debugging Options")]
|
||||||
[Tooltip("Show colliders for game objects")]
|
[Tooltip("Should debug messages be show on screen in Editor")]
|
||||||
[SerializeField] private bool showColliders = false;
|
[SerializeField] private bool showDebugUiMessages = false;
|
||||||
|
|
||||||
[Tooltip("Show performance statistics (FPS, memory usage, etc.)")]
|
|
||||||
[SerializeField] private bool showPerformanceStats = false;
|
|
||||||
|
|
||||||
[Header("Logging")]
|
|
||||||
[Tooltip("Level of detail for logging")]
|
|
||||||
[SerializeField] private LogVerbosity logLevel = LogVerbosity.Warnings;
|
|
||||||
|
|
||||||
[Header("Gameplay")]
|
|
||||||
[Tooltip("Make player invulnerable and ignore gameplay restrictions")]
|
|
||||||
[SerializeField] private bool godMode = false;
|
|
||||||
|
|
||||||
[Tooltip("Global time scale for debugging animations and effects")]
|
|
||||||
[Range(0.1f, 10f)]
|
|
||||||
[SerializeField] private float timeScale = 1.0f;
|
|
||||||
|
|
||||||
// Property getters
|
// Property getters
|
||||||
public bool ShowColliders => showColliders;
|
public bool ShowDebugUiMessages => showDebugUiMessages;
|
||||||
public bool ShowPerformanceStats => showPerformanceStats;
|
|
||||||
public LogVerbosity LogLevel => logLevel;
|
|
||||||
public bool GodMode => godMode;
|
|
||||||
public float TimeScale => timeScale;
|
|
||||||
|
|
||||||
public override void OnValidate()
|
public override void OnValidate()
|
||||||
{
|
{
|
||||||
@@ -54,8 +35,7 @@ namespace AppleHills.Core.Settings
|
|||||||
// Apply any immediate effects when values change in the editor
|
// Apply any immediate effects when values change in the editor
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
// Set time scale directly when changed in editor
|
|
||||||
Time.timeScale = timeScale;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,4 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: d9fd485d4ab84bea9946425e742ccd9c, type: 3}
|
m_Script: {fileID: 11500000, guid: d9fd485d4ab84bea9946425e742ccd9c, type: 3}
|
||||||
m_Name: DebugSettings
|
m_Name: DebugSettings
|
||||||
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Core.Settings.DebugSettings
|
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Core.Settings.DebugSettings
|
||||||
showColliders: 0
|
showDebugUiMessages: 1
|
||||||
showPerformanceStats: 0
|
|
||||||
logLevel: 2
|
|
||||||
godMode: 0
|
|
||||||
timeScale: 7.09
|
|
||||||
|
|||||||
Reference in New Issue
Block a user