-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCoreConsole.cs
More file actions
49 lines (44 loc) · 1.61 KB
/
CoreConsole.cs
File metadata and controls
49 lines (44 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using MSCLoader;
using System;
namespace MWC_Localization_Core
{
/// <summary>
/// Core console utilities for MWC Localization Core mod
/// </summary>
public static class CoreConsole
{
// Use delegates to defer value lookup, avoiding timing issues
private static Func<bool> getShowDebugLogs;
private static Func<bool> getShowWarningLogs;
public static void Initialize(SettingsCheckBox showDebugLogs, SettingsCheckBox showWarningLogs)
{
// Store lambdas that safely get current values
getShowDebugLogs = () => showDebugLogs?.GetValue() ?? true; // Default true if null
getShowWarningLogs = () => showWarningLogs?.GetValue() ?? true; // Default true if null
}
/// <summary>
/// Print a debug message to the ModConsole
/// </summary>
public static void Print(string message)
{
if (getShowDebugLogs == null || getShowDebugLogs())
ModConsole.Print("[MWC_LC] " + message);
}
/// <summary>
/// Print a warning message to the ModConsole
/// </summary>
public static void Warning(string message)
{
if (getShowWarningLogs == null || getShowWarningLogs())
ModConsole.Warning("[MWC_LC] " + message);
}
/// <summary>
/// Print an error message to the ModConsole
/// </summary>
public static void Error(string message)
{
if (getShowWarningLogs == null || getShowWarningLogs())
ModConsole.Error("[MWC_LC] " + message);
}
}
}