本次提交对事件系统进行了多项增强和修复,主要包括: - 为`Effect_SetVariable`添加了类型支持(Int, Float, String, Bool),允许更精确地设置变量类型 [在`EventDef_Wula.xml`, `EventDef_WULA_FE_Spiritualist.xml`, `Effect.cs`中]。 - 改进了`Condition`类,增加了类型检查和错误处理,避免了类型不匹配导致的错误 [在`Condition.cs`中]。 - 修复了`Effect_ModifyVariable`中的错误,允许使用变量名作为修改值,并支持int和float类型的操作 [在`Effect.cs`中]。 - 添加了`Effect_StoreFactionGoodwill`,用于存储派系好感度到变量中 [在`Effect.cs`中]。 - 增加了`Dialog_ManageEventVariables`,用于调试和管理事件变量 [在`DebugActions.cs`, `Dialog_ManageEventVariables.cs`中]。 - 改进了`EventVariableManager`,增加了类型转换的错误处理和日志记录,并添加了获取所有变量的函数 [在`EventVariableManager.cs`中]。 这些改动提高了事件系统的稳定性和可扩展性,并为调试提供了更多工具。
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using LudeonTK;
|
|
using Verse;
|
|
using RimWorld;
|
|
|
|
namespace WulaFallenEmpire
|
|
{
|
|
public static class WulaDebugActions
|
|
{
|
|
[DebugAction("Wula Fallen Empire", "Open Custom UI...", actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.Playing)]
|
|
private static void OpenCustomUI()
|
|
{
|
|
List<DebugMenuOption> list = new List<DebugMenuOption>();
|
|
foreach (EventDef localDef in DefDatabase<EventDef>.AllDefs)
|
|
{
|
|
EventDef currentDef = localDef;
|
|
list.Add(new DebugMenuOption(currentDef.defName, DebugMenuOptionMode.Action, delegate
|
|
{
|
|
Find.WindowStack.Add(new Dialog_CustomDisplay(currentDef));
|
|
}));
|
|
}
|
|
Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
|
|
}
|
|
}
|
|
|
|
public static class WulaDebugActionsVariables
|
|
{
|
|
[DebugAction("Wula Fallen Empire", "Manage Event Variables", actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
|
private static void ManageEventVariables()
|
|
{
|
|
Find.WindowStack.Add(new Dialog_ManageEventVariables());
|
|
}
|
|
}
|
|
} |