This commit is contained in:
2025-11-21 15:37:42 +08:00
parent 4a44ad5005
commit 45dd33e7ba
15 changed files with 162 additions and 16 deletions

View File

@@ -5,8 +5,8 @@
<defName>WULA_Example_Loop</defName>
<characterName>循环大师</characterName>
<description>这是一个演示循环效果列表功能的事件。
首先,设置一个循环次数,然后看看会发生什么!</description>
首先,设置一个循环次数,然后看看会发生什么!</description>
<options>
<li>
<label>设置循环次数为 3</label>

View File

@@ -5,8 +5,8 @@
<defName>WULA_Example_RandomList</defName>
<characterName>系统管理员</characterName>
<description>这是一个演示随机效果列表功能的事件。
点击下面的选项,你会看到一条固定消息,然后会随机获得一件物品。</description>
点击下面的选项,你会看到一条固定消息,然后会随机获得一件物品。</description>
<options>
<li>
<label>试一试!</label>

View File

@@ -69,7 +69,7 @@
<portraitPath>Wula/Events/Portraits/WULA_Legion_5</portraitPath>
<characterName>「军团」,P.I.A</characterName>
<descriptions>
<li>好的好的,那么,你们需要什么?</li>
<li>好的,那么,你们需要什么?</li>
<li>嗯嗯,你们遇到什么麻烦了?</li>
<li>希望你们没给我捅什么大篓子。</li>
</descriptions>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- Wula_UI_Anisia_1_NewWindow -->
<Wula_UI_Anisia_1_NewWindow.label>来自守密者的问候</Wula_UI_Anisia_1_NewWindow.label>
<Wula_UI_Anisia_1_NewWindow.characterName>URa-1138「艾妮西娅」</Wula_UI_Anisia_1_NewWindow.characterName>
<Wula_UI_Anisia_1_NewWindow.description>很高兴看到你们的殖民地没有变成荒野中的烂泥。那么,今天找我有什么事情?</Wula_UI_Anisia_1_NewWindow.description>
<Wula_UI_Anisia_1_NewWindow.description>宇宙生存法则第一条:不要惹平胸火气大的女人。</Wula_UI_Anisia_1_NewWindow.description>
<Wula_UI_Anisia_1_NewWindow.description>什么样的结局,才配得上这一路的颠沛流离?无论你们走向何方,我都将见证你们。</Wula_UI_Anisia_1_NewWindow.description>
<Wula_UI_Anisia_1_NewWindow.option.0.label>我想问你点问题</Wula_UI_Anisia_1_NewWindow.option.0.label>
<Wula_UI_Anisia_1_NewWindow.option.1.label>有事情想拜托你</Wula_UI_Anisia_1_NewWindow.option.1.label>
<Wula_UI_Anisia_1_NewWindow.option.2.label>再见</Wula_UI_Anisia_1_NewWindow.option.2.label>
<!-- Wula_Test_Raid_Event -->
<Wula_Test_Raid_Event.label>测试袭击事件</Wula_Test_Raid_Event.label>
<Wula_Test_Raid_Event.description>这是一个测试,用于触发一个带有自定义 pawn 组的袭击。</Wula_Test_Raid_Event.description>
<Wula_Test_Raid_Event.option.0.label>触发袭击</Wula_Test_Raid_Event.option.0.label>
<Wula_Test_Raid_Event.option.1.label>关闭</Wula_Test_Raid_Event.option.1.label>
<!-- Wula_HiddenEvent_TriggerRaid -->
<Wula_HiddenEvent_TriggerRaid.letterLabel>警报!</Wula_HiddenEvent_TriggerRaid.letterLabel>
<Wula_HiddenEvent_TriggerRaid.letterText>一个隐藏的信号被触发,吸引了一群海盗前来!</Wula_HiddenEvent_TriggerRaid.letterText>
</LanguageData>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- Wula_TestEvent_HideWhenDisabled -->
<Wula_TestEvent_HideWhenDisabled.label><![CDATA[<color=cyan>测试事件</color><i><color=yellow>富文本</color></i>]]></Wula_TestEvent_HideWhenDisabled.label>
<Wula_TestEvent_HideWhenDisabled.characterName><![CDATA[<color=#ff8c00><b>测试者</b></color>]]></Wula_TestEvent_HideWhenDisabled.characterName>
<Wula_TestEvent_HideWhenDisabled.description.0><![CDATA[这是一个用于演示<b>富文本</b>功能的测试事件。你可以看到<color=red>红色</color>、<color=green>绿色</color>和<color=blue>蓝色</color>的文本,以及<i>斜体</i>和<b>粗体</b>样式。当前机械族好感度: {MechanoidGoodwill}]]></Wula_TestEvent_HideWhenDisabled.description.0>
<Wula_TestEvent_HideWhenDisabled.conditionalDescription.0.text><![CDATA[\n\n<color=magenta><b>变量 TestVar 的值现在是 1</b></color>,所以你看到了这段<color=yellow><i>额外</i></color>的描述。]]></Wula_TestEvent_HideWhenDisabled.conditionalDescription.0.text>
<Wula_TestEvent_HideWhenDisabled.option.0.label><![CDATA[选项一 (<color=green>设置 TestVar = 1</color>)]]></Wula_TestEvent_HideWhenDisabled.option.0.label>
<Wula_TestEvent_HideWhenDisabled.option.1.label><![CDATA[选项二 (需要 <color=orange>TestVar = 1</color>, 禁用但可见)]]></Wula_TestEvent_HideWhenDisabled.option.1.label>
<Wula_TestEvent_HideWhenDisabled.option.2.label><![CDATA[选项三 (需要 <color=orange>TestVar = 1</color>, 禁用时隐藏)]]></Wula_TestEvent_HideWhenDisabled.option.2.label>
<Wula_TestEvent_HideWhenDisabled.option.3.label><![CDATA[选项四 (<color=red>移除 TestVar</color>)]]></Wula_TestEvent_HideWhenDisabled.option.3.label>
<Wula_TestEvent_HideWhenDisabled.option.4.label><![CDATA[选项五 (检查<color=#add8e6>机械族</color>好感度)]]></Wula_TestEvent_HideWhenDisabled.option.4.label>
</LanguageData>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- WULA_Example_Loop -->
<WULA_Example_Loop.characterName>循环大师</WULA_Example_Loop.characterName>
<WULA_Example_Loop.description>这是一个演示循环效果列表功能的事件。
首先,设置一个循环次数,然后看看会发生什么!</WULA_Example_Loop.description>
<WULA_Example_Loop.option.0.label>设置循环次数为 3</WULA_Example_Loop.option.0.label>
<WULA_Example_Loop.option.1.label>执行循环(使用变量)</WULA_Example_Loop.option.1.label>
<WULA_Example_Loop.option.2.label>执行循环(固定次数)</WULA_Example_Loop.option.2.label>
<WULA_Example_Loop.option.3.label>关闭</WULA_Example_Loop.option.3.label>
</LanguageData>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- WULA_Example_RandomList -->
<WULA_Example_RandomList_CharacterName>系统管理员</WULA_Example_RandomList_CharacterName>
<WULA_Example_RandomList_Description>这是一个演示随机效果列表功能的事件。
点击下面的选项,你会看到一条固定消息,然后会随机获得一件物品。</WULA_Example_RandomList_Description>
<WULA_Example_RandomList_Option_0>试一试!</WULA_Example_RandomList_Option_0>
<WULA_Example_RandomList_Option_1>关闭</WULA_Example_RandomList_Option_1>
</LanguageData>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- Wula_Test_VariableEvent -->
<Wula_Test_VariableEvent.label>变量测试事件</Wula_Test_VariableEvent.label>
<Wula_Test_VariableEvent.characterName>测试员</Wula_Test_VariableEvent.characterName>
<Wula_Test_VariableEvent.description.0>变量 testNumber 的当前值为 {testNumber}。点击下面的按钮来改变它。</Wula_Test_VariableEvent.description.0>
<Wula_Test_VariableEvent.option.0.label>将 testNumber 增加50并重新打开</Wula_Test_VariableEvent.option.0.label>
<Wula_Test_VariableEvent.option.1.label>关闭</Wula_Test_VariableEvent.option.1.label>
</LanguageData>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- WULA_Debug_StoreAllStats -->
<WULA_Debug_StoreAllStats.label>Debug: Store All Stats</WULA_Debug_StoreAllStats.label>
<WULA_Debug_StoreAllStats.description>一个用于将各种游戏统计数据存储到变量中的调试事件。</WULA_Debug_StoreAllStats.description>
</LanguageData>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- Wula_UI_Legion_1 -->
<Wula_UI_Legion_1.label>和P.I.A的通讯</Wula_UI_Legion_1.label>
<Wula_UI_Legion_1.characterName>「军团」,P.I.A</Wula_UI_Legion_1.characterName>
<Wula_UI_Legion_1.description>这里是乌拉帝国行星封锁机关P.I.A通讯信号良好等待输入。</Wula_UI_Legion_1.description>
<Wula_UI_Legion_1.description>那句话怎么说来着?天下无敌,天上来敌。</Wula_UI_Legion_1.description>
<Wula_UI_Legion_1.description>早在这些生物的祖先还在有机汤里面翻滚时,我们就已经是这个银河系的霸主了——以前如此,今后也会如此。</Wula_UI_Legion_1.description>
<Wula_UI_Legion_1.description>一般来说,我们并不喜欢暴力和流血冲突,如果这些星系的原住民能更配合点就好了。</Wula_UI_Legion_1.description>
<Wula_UI_Legion_1.option.0.label>我想问些事情</Wula_UI_Legion_1.option.0.label>
<Wula_UI_Legion_1.option.1.label>我们要申请支援!</Wula_UI_Legion_1.option.1.label>
<Wula_UI_Legion_1.option.2.label>再见</Wula_UI_Legion_1.option.2.label>
<!-- Wula_UI_Legion_30 -->
<Wula_UI_Legion_30.label>和P.I.A的通讯</Wula_UI_Legion_30.label>
<Wula_UI_Legion_30.characterName>「军团」,P.I.A</Wula_UI_Legion_30.characterName>
<Wula_UI_Legion_30.description>好的,那么,你们需要什么?</Wula_UI_Legion_30.description>
<Wula_UI_Legion_30.description>嗯嗯,你们遇到什么麻烦了?</Wula_UI_Legion_30.description>
<Wula_UI_Legion_30.description>希望你们没给我捅什么大篓子。</Wula_UI_Legion_30.description>
<Wula_UI_Legion_30.option.0.label>我们需要资金支持</Wula_UI_Legion_30.option.0.label>
<Wula_UI_Legion_30.option.0.disabledReason>应急资金,我好像已经发给你们了?</Wula_UI_Legion_30.option.0.disabledReason>
<Wula_UI_Legion_30.option.1.label>我们需要一只新的机械乌拉</Wula_UI_Legion_30.option.1.label>
<Wula_UI_Legion_30.option.1.disabledReason>你们不会自己去造吗?</Wula_UI_Legion_30.option.1.disabledReason>
<Wula_UI_Legion_30.option.2.label>我们需要直接的武力支援</Wula_UI_Legion_30.option.2.label>
<Wula_UI_Legion_30.option.2.disabledReason>我们的特遣队都在忙,请稍后再试——好吧我骗你们的,你们就不能自己搞两杆枪吗?</Wula_UI_Legion_30.option.2.disabledReason>
<Wula_UI_Legion_30.option.3.label>还有其他事情···</Wula_UI_Legion_30.option.3.label>
<!-- Wula_UI_Legion_31 -->
<Wula_UI_Legion_31.label>和P.I.A的通讯</Wula_UI_Legion_31.label>
<Wula_UI_Legion_31.characterName>「军团」,P.I.A</Wula_UI_Legion_31.characterName>
<Wula_UI_Legion_31.description>原来是来要钱的嘛···我可以给你们调拨一轮紧急资金,但是这是有限的,并且仅能作殖民地发展之用。\n\n话说回来你们真的缺钱吗我怎么有点不信</Wula_UI_Legion_31.description>
<Wula_UI_Legion_31.option.0.label>对的对的,我们是真穷!</Wula_UI_Legion_31.option.0.label>
<Wula_UI_Legion_31.option.0.disabledReason>殖民地的表现让P.I.A相当不满意不会为殖民地派出任何额外增援</Wula_UI_Legion_31.option.0.disabledReason>
<Wula_UI_Legion_31.option.1.label>还是算了</Wula_UI_Legion_31.option.1.label>
<!-- Wula_UI_Anisia_32 -->
<Wula_UI_Anisia_32.label>和P.I.A的通讯</Wula_UI_Anisia_32.label>
<Wula_UI_Anisia_32.characterName>「军团」,P.I.A</Wula_UI_Anisia_32.characterName>
<Wula_UI_Anisia_32.description>唔,现在我手上确实有一台乌拉帝国合成人还没有分配殖民地,你们需要的话可以划拨给你们。但是下次你们得记得自己造——造合成人的材料是要花项目资金的。</Wula_UI_Anisia_32.description>
<Wula_UI_Anisia_32.option.0.label>我们欣然接受</Wula_UI_Anisia_32.option.0.label>
<Wula_UI_Anisia_32.option.0.disabledReason>殖民地的表现让P.I.A相当不满意不会为殖民地派出任何额外增援</Wula_UI_Anisia_32.option.0.disabledReason>
<Wula_UI_Anisia_32.option.1.label>还是算了</Wula_UI_Anisia_32.option.1.label>
<!-- Wula_UI_Anisia_33 -->
<Wula_UI_Anisia_33.label>和P.I.A的通讯</Wula_UI_Anisia_33.label>
<Wula_UI_Anisia_33.characterName>「军团」,P.I.A</Wula_UI_Anisia_33.characterName>
<Wula_UI_Anisia_33.description>遇到麻烦了?我可以把手上的特遣队丢下去,你们记得找好掩体。</Wula_UI_Anisia_33.description>
<Wula_UI_Anisia_33.option.0.label>再不来我们要死完啦</Wula_UI_Anisia_33.option.0.label>
<Wula_UI_Anisia_33.option.0.disabledReason>殖民地的表现让P.I.A相当不满意不会为殖民地派出任何额外增援</Wula_UI_Anisia_33.option.0.disabledReason>
<Wula_UI_Anisia_33.option.1.label>还是算了</Wula_UI_Anisia_33.option.1.label>
<!-- Wula_UI_Legion_Reply_1 -->
<Wula_UI_Legion_Reply_1.label>和P.I.A的通讯</Wula_UI_Legion_Reply_1.label>
<Wula_UI_Legion_Reply_1.characterName>「军团」,P.I.A</Wula_UI_Legion_Reply_1.characterName>
<Wula_UI_Legion_Reply_1.description>请,不要,往舰队扔尸体、废物殖民者、动物和有毒垃圾!</Wula_UI_Legion_Reply_1.description>
<Wula_UI_Legion_Reply_1.description>你们是把舰队当成垃圾处理厂了吗?把你的尸体、废物殖民者、动物和有毒垃圾搬走!</Wula_UI_Legion_Reply_1.description>
<Wula_UI_Legion_Reply_1.option.0.label>好的</Wula_UI_Legion_Reply_1.option.0.label>
</LanguageData>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- WULA_Example_RandomList -->
<WULA_Example_RandomList.characterName>系统管理员</WULA_Example_RandomList.characterName>
<WULA_Example_RandomList.description>这是一个演示随机效果列表功能的事件。
点击下面的选项,你会看到一条固定消息,然后会随机获得一件物品。</WULA_Example_RandomList.description>
<WULA_Example_RandomList.option.0.label>试一试!</WULA_Example_RandomList.option.0.label>
<WULA_Example_RandomList.option.1.label>关闭</WULA_Example_RandomList.option.1.label>
</LanguageData>

View File

@@ -55,14 +55,14 @@ namespace WulaFallenEmpire
{
if (def.descriptionMode == DescriptionSelectionMode.Random)
{
selectedDescription = def.descriptions.RandomElement();
selectedDescription = def.descriptions.RandomElement().Translate();
}
else
else
{
string indexVarName = $"_seq_desc_index_{def.defName}";
int currentIndex = eventVarManager.GetVariable<int>(indexVarName, 0);
selectedDescription = def.descriptions[currentIndex];
selectedDescription = def.descriptions[currentIndex].Translate();
int nextIndex = (currentIndex + 1) % def.descriptions.Count;
eventVarManager.SetVariable(indexVarName, nextIndex);
@@ -118,7 +118,7 @@ namespace WulaFallenEmpire
string reason;
if (AreConditionsMet(condDesc.conditions, out reason))
{
selectedDescription += "\n\n" + condDesc.text;
selectedDescription += "\n\n" + condDesc.text.Translate();
}
}
}
@@ -179,7 +179,7 @@ namespace WulaFallenEmpire
Text.Anchor = TextAnchor.MiddleCenter;
Text.Font = Config.labelFont;
Widgets.Label(labelRect, def.label);
Widgets.Label(labelRect, def.label.Translate());
Text.Font = GameFont.Small;
Text.Anchor = TextAnchor.UpperLeft;
@@ -201,7 +201,7 @@ namespace WulaFallenEmpire
Text.Anchor = TextAnchor.MiddleCenter;
Text.Font = GameFont.Medium;
Widgets.Label(nameRect, def.characterName);
Widgets.Label(nameRect, def.characterName.Translate());
Text.Font = GameFont.Small;
Text.Anchor = TextAnchor.UpperLeft;
@@ -368,7 +368,7 @@ namespace WulaFallenEmpire
// 设置文本居中
Text.Anchor = TextAnchor.MiddleCenter;
if (Widgets.ButtonText(optionRect, option.label))
if (Widgets.ButtonText(optionRect, option.label.Translate()))
{
HandleAction(option.optionEffects);
}
@@ -402,7 +402,7 @@ namespace WulaFallenEmpire
Text.Anchor = TextAnchor.MiddleCenter;
// 绘制居中的文本
Rect textRect = optionRect.ContractedBy(4f);
Widgets.Label(textRect, option.label);
Widgets.Label(textRect, option.label.Translate());
// 可选:在文本上添加删除线效果
if (Config.drawBorders)
{
@@ -414,7 +414,7 @@ namespace WulaFallenEmpire
1f
);
}
TooltipHandler.TipRegion(optionRect, GetDisabledReason(option, reason));
TooltipHandler.TipRegion(optionRect, GetDisabledReason(option, reason).Translate());
}
finally
{
@@ -495,7 +495,7 @@ namespace WulaFallenEmpire
{
if (!option.disabledReason.NullOrEmpty())
{
return option.disabledReason;
return option.disabledReason.Translate();
}
return reason;
}

View File

@@ -15,14 +15,17 @@ namespace WulaFallenEmpire
public class EventDef : Def
{
public string portraitPath;
[MustTranslate]
public string characterName;
// New system: list of descriptions
[MustTranslate]
public List<string> descriptions;
public DescriptionSelectionMode descriptionMode = DescriptionSelectionMode.Random;
public bool hiddenWindow = false;
// Backwards compatibility: old single description field
[MustTranslate]
public new string description = null;
public Vector2 windowSize = Vector2.zero;
@@ -66,8 +69,10 @@ namespace WulaFallenEmpire
public class EventOption
{
[MustTranslate]
public string label;
public List<Condition> conditions;
[MustTranslate]
public string disabledReason;
public bool hideWhenDisabled = true;
public List<ConditionalEffects> optionEffects;
@@ -160,6 +165,7 @@ namespace WulaFallenEmpire
public class ConditionalDescription
{
public List<Condition> conditions;
[MustTranslate]
public string text;
}
}

View File

@@ -47,7 +47,7 @@ namespace WulaFallenEmpire
Find.LetterStack.RemoveLetter(this);
};
var diaOption = new DiaOption(currentOption.label)
var diaOption = new DiaOption(currentOption.label.Translate())
{
action = choiceAction,
resolveTree = true