diff --git a/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/Assemblies/WulaFallenEmpire.dll index bd2044e6..74336113 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml b/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml index c5fa43c5..789a7274 100644 --- a/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml +++ b/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml @@ -7,6 +7,8 @@ Small false + true + true diff --git a/Documentation/EventSystem_Documentation.md b/Documentation/EventSystem_Documentation.md index f245cf4a..59fa83d4 100644 --- a/Documentation/EventSystem_Documentation.md +++ b/Documentation/EventSystem_Documentation.md @@ -403,4 +403,13 @@ ``` +### `Condition_VariableNotEqual` +检查一个变量是否 **不等于** 一个特定值。 +```xml +
  • + QuestStage + 3 +
  • +``` + --- diff --git a/Source/WulaFallenEmpire/EventSystem/Condition.cs b/Source/WulaFallenEmpire/EventSystem/Condition.cs index 2bb758d2..1ce61c9e 100644 --- a/Source/WulaFallenEmpire/EventSystem/Condition.cs +++ b/Source/WulaFallenEmpire/EventSystem/Condition.cs @@ -112,4 +112,10 @@ namespace WulaFallenEmpire protected override bool Compare(float var1, float var2) => var1 <= var2; protected override string GetOperatorString() => "<="; } + + public class Condition_VariableNotEqual : Condition_CompareVariable + { + protected override bool Compare(float var1, float var2) => var1 != var2; + protected override string GetOperatorString() => "!="; + } } diff --git a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs index c1202d1e..6ef3144f 100644 --- a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs +++ b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs @@ -95,14 +95,20 @@ namespace WulaFallenEmpire } // 2. Draw Top-left defName and Label - Text.Font = GameFont.Tiny; - GUI.color = Color.gray; - Widgets.Label(new Rect(5, 5, inRect.width - 10, 20f), def.defName); - GUI.color = Color.white; + if (Config.showDefName) + { + Text.Font = GameFont.Tiny; + GUI.color = Color.gray; + Widgets.Label(new Rect(5, 5, inRect.width - 10, 20f), def.defName); + GUI.color = Color.white; + } - Text.Font = Config.labelFont; - Widgets.Label(new Rect(5, 20f, inRect.width - 10, 30f), def.label); - Text.Font = GameFont.Small; // Reset to default + if (Config.showLabel) + { + Text.Font = Config.labelFont; + Widgets.Label(new Rect(5, 20f, inRect.width - 10, 30f), def.label); + Text.Font = GameFont.Small; // Reset to default + } // 3. Calculate Layout based on ConfigDef float virtualWidth = Config.lihuiSize.x + Config.textSize.x; diff --git a/Source/WulaFallenEmpire/EventSystem/Effect.cs b/Source/WulaFallenEmpire/EventSystem/Effect.cs index ce70d404..c7e548a4 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect.cs @@ -293,7 +293,12 @@ namespace WulaFallenEmpire return; } - float currentValue = EventContext.GetVariable(name, 0f); + if (!EventContext.HasVariable(name)) + { + EventContext.SetVariable(name, 0f); + } + + float currentValue = EventContext.GetVariable(name); switch (operation) { diff --git a/Source/WulaFallenEmpire/EventSystem/EventContext.cs b/Source/WulaFallenEmpire/EventSystem/EventContext.cs index 68a2717e..94a1b3fa 100644 --- a/Source/WulaFallenEmpire/EventSystem/EventContext.cs +++ b/Source/WulaFallenEmpire/EventSystem/EventContext.cs @@ -43,6 +43,11 @@ namespace WulaFallenEmpire return defaultValue; } + public static bool HasVariable(string name) + { + return variables.ContainsKey(name); + } + public static void Clear() { variables.Clear(); diff --git a/Source/WulaFallenEmpire/EventSystem/EventUIConfigDef.cs b/Source/WulaFallenEmpire/EventSystem/EventUIConfigDef.cs index e968157c..bfc19f9b 100644 --- a/Source/WulaFallenEmpire/EventSystem/EventUIConfigDef.cs +++ b/Source/WulaFallenEmpire/EventSystem/EventUIConfigDef.cs @@ -8,6 +8,8 @@ namespace WulaFallenEmpire // General Style public GameFont labelFont = GameFont.Small; public bool drawBorders = true; + public bool showDefName = true; + public bool showLabel = true; public string defaultBackgroundImagePath; public Vector2 defaultWindowSize = new Vector2(750f, 500f);