This commit is contained in:
2025-07-31 15:19:46 +08:00
parent f46e589727
commit cf292541b3
8 changed files with 43 additions and 8 deletions

Binary file not shown.

View File

@@ -7,6 +7,8 @@
<!-- General Style -->
<labelFont>Small</labelFont>
<drawBorders>false</drawBorders>
<showDefName>true</showDefName>
<showLabel>true</showLabel>
<defaultBackgroundImagePath></defaultBackgroundImagePath>
<!-- Virtual Layout Dimensions -->

View File

@@ -403,4 +403,13 @@
</li>
```
### `Condition_VariableNotEqual`
检查一个变量是否 **不等于** 一个特定值。
```xml
<li Class="WulaFallenEmpire.Condition_VariableNotEqual">
<name>QuestStage</name>
<value>3</value>
</li>
```
---

View File

@@ -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() => "!=";
}
}

View File

@@ -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;

View File

@@ -293,7 +293,12 @@ namespace WulaFallenEmpire
return;
}
float currentValue = EventContext.GetVariable<float>(name, 0f);
if (!EventContext.HasVariable(name))
{
EventContext.SetVariable(name, 0f);
}
float currentValue = EventContext.GetVariable<float>(name);
switch (operation)
{

View File

@@ -43,6 +43,11 @@ namespace WulaFallenEmpire
return defaultValue;
}
public static bool HasVariable(string name)
{
return variables.ContainsKey(name);
}
public static void Clear()
{
variables.Clear();

View File

@@ -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);