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 RimWorld;
using RimWorld;
using Verse;
using System.Collections.Generic;
using System.Linq;
@@ -21,7 +21,7 @@ namespace WulaFallenEmpire
if (availableFlyOvers.Count == 0)
{
Log.Error($"[GlobalFlyOverCooldown] No available FlyOver with BombardmentFacility found");
WulaLog.Debug($"[GlobalFlyOverCooldown] No available FlyOver with BombardmentFacility found");
return;
}
@@ -31,14 +31,14 @@ namespace WulaFallenEmpire
if (facilitiesComp == null)
{
Log.Error($"[GlobalFlyOverCooldown] Selected FlyOver has no CompFlyOverFacilities");
WulaLog.Debug($"[GlobalFlyOverCooldown] Selected FlyOver has no CompFlyOverFacilities");
return;
}
// 设置冷却时间
SetCooldown(selectedFlyOver, Props.globalCooldownTicks);
Log.Message($"[GlobalFlyOverCooldown] Set cooldown on FlyOver at {selectedFlyOver.Position} for {Props.globalCooldownTicks} ticks");
WulaLog.Debug($"[GlobalFlyOverCooldown] Set cooldown on FlyOver at {selectedFlyOver.Position} for {Props.globalCooldownTicks} ticks");
}
public override bool GizmoDisabled(out string reason)
@@ -73,7 +73,7 @@ namespace WulaFallenEmpire
}
catch (System.Exception ex)
{
Log.Error($"[GlobalFlyOverCooldown] Error in ExtraLabelMouseAttachment: {ex}");
WulaLog.Debug($"[GlobalFlyOverCooldown] Error in ExtraLabelMouseAttachment: {ex}");
return "WULA_GlobalFlyOverCooldown.FacilityStatusError".Translate();
}
}
@@ -144,7 +144,7 @@ namespace WulaFallenEmpire
}
catch (System.Exception ex)
{
Log.Error($"[GlobalFlyOverCooldown] Error in GetAvailableFlyOvers: {ex}");
WulaLog.Debug($"[GlobalFlyOverCooldown] Error in GetAvailableFlyOvers: {ex}");
return new List<FlyOver>();
}
}
@@ -188,7 +188,7 @@ namespace WulaFallenEmpire
}
catch (System.Exception ex)
{
Log.Error($"[GlobalFlyOverCooldown] Error in GetTotalFlyOvers: {ex}");
WulaLog.Debug($"[GlobalFlyOverCooldown] Error in GetTotalFlyOvers: {ex}");
return new List<FlyOver>();
}
}
@@ -214,7 +214,7 @@ namespace WulaFallenEmpire
var cooldownComp = flyOver.GetComp<CompFlyOverCooldown>();
if (cooldownComp == null)
{
Log.Error($"[GlobalFlyOverCooldown] FlyOver at {flyOver.Position} has no CompFlyOverCooldown");
WulaLog.Debug($"[GlobalFlyOverCooldown] FlyOver at {flyOver.Position} has no CompFlyOverCooldown");
return;
}

View File

@@ -1,4 +1,4 @@
using RimWorld;
using RimWorld;
using Verse;
namespace WulaFallenEmpire
@@ -39,7 +39,7 @@ namespace WulaFallenEmpire
int actualCooldown = cooldownTicks > 0 ? cooldownTicks : Props.baseCooldownTicks;
cooldownEndTick = Find.TickManager.TicksGame + actualCooldown;
Log.Message($"[FlyOverCooldown] Cooldown started for {actualCooldown} ticks, ends at tick {cooldownEndTick}");
WulaLog.Debug($"[FlyOverCooldown] Cooldown started for {actualCooldown} ticks, ends at tick {cooldownEndTick}");
}
// 强制结束冷却