Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/QuestNodes/QuestNode_Hyperlinks.cs
ProjectKoi-Kalo\Kalo 98a0400c78 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()
2025-12-15 13:05:50 +08:00

76 lines
2.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using RimWorld;
using RimWorld.QuestGen;
using System.Collections.Generic;
using Verse;
namespace WulaFallenEmpire
{
public class QuestNode_Hyperlinks : QuestNode
{
// 输入参数 - 使用 SlateRef 来支持从任务slate中获取值
public SlateRef<List<ThingDef>> thingDefs;
public SlateRef<List<Pawn>> pawns;
public SlateRef<List<FactionDef>> factionDefs; // 改为 FactionDef 而不是 Faction
public SlateRef<List<ResearchProjectDef>> researchProjects;
protected override bool TestRunInt(Slate slate)
{
// 测试模式下只要参数有效就返回true
return true;
}
protected override void RunInt()
{
Slate slate = QuestGen.slate;
Quest quest = QuestGen.quest;
// 获取实际的值
List<ThingDef> actualThingDefs = thingDefs.GetValue(slate);
List<Pawn> actualPawns = pawns.GetValue(slate);
List<FactionDef> actualFactionDefs = factionDefs.GetValue(slate);
List<ResearchProjectDef> actualResearchProjects = researchProjects.GetValue(slate);
// 创建任务部分
QuestPart_Hyperlinks hyperlinksPart = new QuestPart_Hyperlinks();
// 设置超链接数据
if (actualThingDefs != null)
{
hyperlinksPart.thingDefs.AddRange(actualThingDefs);
}
if (actualPawns != null)
{
hyperlinksPart.pawns.AddRange(actualPawns);
}
if (actualFactionDefs != null)
{
// 将 FactionDef 转换为 Faction
foreach (FactionDef factionDef in actualFactionDefs)
{
Faction faction = Find.FactionManager.FirstFactionOfDef(factionDef);
if (faction != null)
{
hyperlinksPart.factions.Add(faction);
}
else
{
WulaLog.Debug($"QuestNode_Hyperlinks: Could not find faction for def {factionDef.defName}");
}
}
}
if (actualResearchProjects != null)
{
hyperlinksPart.researchProjects.AddRange(actualResearchProjects);
}
// 添加到任务
quest.AddPart(hyperlinksPart);
WulaLog.Debug($"QuestNode_Hyperlinks: Added hyperlinks - Things: {actualThingDefs?.Count ?? 0}, Pawns: {actualPawns?.Count ?? 0}, Factions: {actualFactionDefs?.Count ?? 0}, Research: {actualResearchProjects?.Count ?? 0}");
}
}
}