feat: 扩展事件系统,改进变量处理和调试功能
本次提交对事件系统进行了多项增强和修复,主要包括: - 为`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`中]。 这些改动提高了事件系统的稳定性和可扩展性,并为调试提供了更多工具。
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using LudeonTK;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using LudeonTK;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
@@ -13,7 +13,6 @@ namespace WulaFallenEmpire
|
||||
List<DebugMenuOption> list = new List<DebugMenuOption>();
|
||||
foreach (EventDef localDef in DefDatabase<EventDef>.AllDefs)
|
||||
{
|
||||
// Capture the local variable for the lambda
|
||||
EventDef currentDef = localDef;
|
||||
list.Add(new DebugMenuOption(currentDef.defName, DebugMenuOptionMode.Action, delegate
|
||||
{
|
||||
@@ -23,4 +22,13 @@ namespace WulaFallenEmpire
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user