WulaFallenEmpireSettings.cs - 添加了 public bool enableDebugLogs = false; 字段和保存配置

 WulaLog.cs - 修改了DebugEnabled属性,仅检查enableDebugLogs设置(不检查DevMode)
 WulaFallenEmpireMod.cs - 在DoSettingsWindowContents中添加了UI复选框,显示"Enable Debug Logs"选项
 替换了所有848个Log.Message/Error/Warning调用为WulaLog.Debug()
This commit is contained in:
2025-12-15 13:05:50 +08:00
parent 9bdcd8e308
commit 98a0400c78
134 changed files with 1000 additions and 1019 deletions

View File

@@ -1,4 +1,4 @@
using Verse;
using Verse;
using RimWorld;
namespace WulaFallenEmpire
@@ -58,7 +58,7 @@ namespace WulaFallenEmpire
}
catch (System.Exception e)
{
Log.Warning($"[EventSystem] Condition_VariableEquals: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}");
WulaLog.Debug($"[EventSystem] Condition_VariableEquals: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}");
reason = "Type mismatch or parsing error during comparison.";
return false;
}
@@ -89,7 +89,7 @@ namespace WulaFallenEmpire
var eventVarManager = Find.World.GetComponent<EventVariableManager>();
if (!eventVarManager.HasVariable(name))
{
Log.Message($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f.");
WulaLog.Debug($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f.");
eventVarManager.SetVariable(name, 0f);
}
@@ -102,13 +102,13 @@ namespace WulaFallenEmpire
if (float.IsNaN(compareValue))
{
reason = $"Comparison variable '{valueVariableName}' not set or not a number.";
Log.Warning($"[EventSystem] {GetType().Name} check for '{name}' failed: {reason}");
WulaLog.Debug($"[EventSystem] {GetType().Name} check for '{name}' failed: {reason}");
return false;
}
}
bool met = Compare(variable, compareValue);
Log.Message($"[EventSystem] {GetType().Name} check: Name='{name}', CurrentValue='{variable}', CompareValue='{compareValue}', Met={met}");
WulaLog.Debug($"[EventSystem] {GetType().Name} check: Name='{name}', CurrentValue='{variable}', CompareValue='{compareValue}', Met={met}");
if (!met)
{
reason = $"Requires {name} {GetOperatorString()} {compareValue} (Current: {variable})";
@@ -195,12 +195,12 @@ namespace WulaFallenEmpire
}
catch (System.Exception e)
{
Log.Warning($"[EventSystem] Condition_VariableNotEqual: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}");
WulaLog.Debug($"[EventSystem] Condition_VariableNotEqual: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}");
reason = "Type mismatch or parsing error during comparison.";
return false;
}
Log.Message($"[EventSystem] Condition_VariableNotEqual check: Name='{name}', Type='{variable?.GetType().Name ?? "null"}', CurrentValue='{variable}', CompareValue='{compareValueStr}', Met={met}");
WulaLog.Debug($"[EventSystem] Condition_VariableNotEqual check: Name='{name}', Type='{variable?.GetType().Name ?? "null"}', CurrentValue='{variable}', CompareValue='{compareValueStr}', Met={met}");
if (!met)
{
reason = $"Requires {name} != {compareValueStr} (Current: {variable})";