Cleanup compile warnings, cleanup logs, spruce up level selection menu

This commit is contained in:
Michal Pikulski
2025-10-28 14:31:17 +01:00
parent a5b1a4f8a0
commit 43779c560e
67 changed files with 4814 additions and 1050 deletions

View File

@@ -7,11 +7,10 @@ namespace AppleHills.Core.Settings
/// </summary>
public enum LogVerbosity
{
None = 0,
Errors = 1,
Warnings = 2,
Info = 3,
Verbose = 4
None = -1,
Debug = 0,
Warning = 1,
Error = 2
}
/// <summary>
@@ -23,12 +22,26 @@ namespace AppleHills.Core.Settings
{
[Header("Visual Debugging Options")]
[Tooltip("Should debug messages be show on screen in Editor")]
[SerializeField] private bool showDebugUiMessages = false;
[SerializeField] public bool showDebugUiMessages = false;
[Header("Game Behavior Options")]
[Tooltip("Should Time.timeScale be set to 0 when the game is paused")]
[SerializeField] private bool pauseTimeOnPauseGame = true;
[SerializeField] public bool pauseTimeOnPauseGame = true;
[Header("Logging Options")]
[Tooltip("Logging level for bootstrap services")]
[SerializeField] public LogVerbosity bootstrapLogVerbosity = LogVerbosity.Warning;
[Tooltip("Logging level for settings-related services")]
[SerializeField] public LogVerbosity settingsLogVerbosity = LogVerbosity.Warning;
[Tooltip("Logging level for Game Manager")]
[SerializeField] public LogVerbosity gameManagerLogVerbosity = LogVerbosity.Warning;
[Tooltip("Logging level for Scene management services - orientation, loading etc.")]
[SerializeField] public LogVerbosity sceneLogVerbosity = LogVerbosity.Warning;
[Tooltip("Logging level for Scene Orientation Enforcer")]
[SerializeField] public LogVerbosity saveLoadLogVerbosity = LogVerbosity.Warning;
[Tooltip("Logging level for Input management services")]
[SerializeField] public LogVerbosity inputLogVerbosity = LogVerbosity.Warning;
// Property getters
public bool ShowDebugUiMessages => showDebugUiMessages;
public bool PauseTimeOnPauseGame => pauseTimeOnPauseGame;

View File

@@ -87,10 +87,6 @@ namespace AppleHills.Core.Settings
[Tooltip("Maximum normalized movement speed allowed for tiles")]
[SerializeField] private float maxNormalizedTileMoveSpeed = 1.2f;
// Legacy settings - keeping for backward compatibility
[HideInInspector] [SerializeField] private float moveSpeed = 3f;
[HideInInspector] [SerializeField] private float maxMoveSpeed = 12f;
[Tooltip("Interval for velocity calculations (seconds)")]
[SerializeField] private float velocityCalculationInterval = 0.5f;

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using Core;
using AppleHills.Core.Settings;
using UnityEngine;
namespace AppleHills.Core.Settings
namespace Core.Settings
{
/// <summary>
/// Service Locator implementation for managing settings services.
@@ -11,7 +11,7 @@ namespace AppleHills.Core.Settings
/// </summary>
public static class ServiceLocator
{
private static readonly Dictionary<Type, object> _services = new Dictionary<Type, object>();
private static readonly Dictionary<Type, object> Services = new Dictionary<Type, object>();
/// <summary>
/// Register a service with the service locator.
@@ -20,8 +20,8 @@ namespace AppleHills.Core.Settings
/// <param name="service">The service implementation</param>
public static void Register<T>(T service) where T : class
{
_services[typeof(T)] = service;
Logging.Debug($"Service registered: {typeof(T).Name}");
Services[typeof(T)] = service;
LogDebugMessage($"Service registered: {typeof(T).Name}");
}
/// <summary>
@@ -31,12 +31,12 @@ namespace AppleHills.Core.Settings
/// <returns>The service implementation, or null if not found</returns>
public static T Get<T>() where T : class
{
if (_services.TryGetValue(typeof(T), out object service))
if (Services.TryGetValue(typeof(T), out object service))
{
return service as T;
}
Logging.Warning($"Service of type {typeof(T).Name} not found!");
Logging.Warning($"[ServiceLocator] Service of type {typeof(T).Name} not found!");
return null;
}
@@ -45,8 +45,17 @@ namespace AppleHills.Core.Settings
/// </summary>
public static void Clear()
{
_services.Clear();
Logging.Debug("All services cleared");
Services.Clear();
LogDebugMessage("All services cleared");
}
private static void LogDebugMessage(string message)
{
if (DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().settingsLogVerbosity <=
LogVerbosity.Debug)
{
Logging.Debug($"[ServiceLocator] {message}");
}
}
}
}