1
24
1.6/1.6/Defs/EventDefs/EventDef_Wula/Wula_MainEvent.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Defs>
|
||||||
|
<WulaFallenEmpire.EventDef>
|
||||||
|
<defName>Wula_UI_Legion_1</defName>
|
||||||
|
<label>和P.I.A的通讯</label>
|
||||||
|
<portraitPath>Wula/Events/Portraits/WULA_Legion_1</portraitPath>
|
||||||
|
<characterName>「军团」</characterName>
|
||||||
|
<descriptions>
|
||||||
|
<li>这里是P.I.A,通讯信号良好,等待输入。</li>
|
||||||
|
</descriptions>
|
||||||
|
<options>
|
||||||
|
<li>
|
||||||
|
<label>再见</label>
|
||||||
|
<optionEffects>
|
||||||
|
<li>
|
||||||
|
<effects>
|
||||||
|
<li Class="WulaFallenEmpire.Effect_CloseDialog" />
|
||||||
|
</effects>
|
||||||
|
</li>
|
||||||
|
</optionEffects>
|
||||||
|
</li>
|
||||||
|
</options>
|
||||||
|
</WulaFallenEmpire.EventDef>
|
||||||
|
</Defs>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Defs>
|
<Defs>
|
||||||
<StorytellerDef ParentName="BaseStoryteller">
|
<StorytellerDef ParentName="BaseStoryteller">
|
||||||
<defName>WULA_Anisia</defName>
|
<defName>WULA_Legion</defName>
|
||||||
<label>URa-1138「艾妮西娅」</label>
|
<label>「军团」</label>
|
||||||
<description>一位诞生于乌拉帝国黄金时代的合成人,是黄金时代禁忌科技的守密者。她在边缘世界一带强制唤醒了大量的旧时代乌拉帝国合成人,无人知晓她真正的目的。\n\n艾妮西娅喜欢大场面,因此她不会安排任何小型袭击,而是安排比其他叙事者所安排的大型袭击更加强大的袭击。不过,在两次袭击间她将安排充足的时间让殖民地进行发展,并让殖民者得到放松以充分消化战利品和修补战线。</description>
|
<description>一个超级AI,负责控制调度乌拉帝国行星封锁机关P.I.A的舰队,是帝国开发署扩张领地的先锋。当帝国需要对一个星球进行控制和介入时,她会指挥庞大的先锋舰队攻占轨道,以不容置疑的实力向星球宣示帝国的权威。\n\n作为讲述者,她不会为你留下任何保护措施,所有的袭击和恶性事件从落地开始就有可能生成,并且袭击的频率要比常规情况下更高——尽管它们还是有周期规律的。</description>
|
||||||
<portraitLarge>Wula/Storyteller/WULA_Anisia</portraitLarge>
|
<portraitLarge>Wula/Storyteller/WULA_Legion</portraitLarge>
|
||||||
<portraitTiny>Wula/Storyteller/WULA_Anisia_TINY</portraitTiny>
|
<portraitTiny>Wula/Storyteller/WULA_Legion_TINY</portraitTiny>
|
||||||
<listOrder>20</listOrder>
|
<listOrder>20</listOrder>
|
||||||
<comps>
|
<comps>
|
||||||
<!-- Intro -->
|
<!-- Intro -->
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
<!-- 袭击生成器 -->
|
<!-- 袭击生成器 -->
|
||||||
<li Class="StorytellerCompProperties_OnOffCycle">
|
<li Class="StorytellerCompProperties_OnOffCycle">
|
||||||
<category>ThreatBig</category> <!-- 大型袭击 -->
|
<category>ThreatBig</category> <!-- 大型袭击 -->
|
||||||
<minDaysPassed>15.0</minDaysPassed> <!-- 最低在15日后开始生成 -->
|
<minDaysPassed>0</minDaysPassed>
|
||||||
<onDays>2</onDays> <!-- 每个周期(12天)有多少天允许生成袭击 -->
|
<onDays>2</onDays> <!-- 每个周期(12天)有多少天允许生成袭击 -->
|
||||||
<offDays>9</offDays> <!-- 每个周期(12天)有多少天不生成袭击 -->
|
<offDays>5</offDays> <!-- 每个周期(12天)有多少天不生成袭击 -->
|
||||||
<minSpacingDays>0.25</minSpacingDays> <!-- 事件最小间隔 -->
|
<minSpacingDays>0.25</minSpacingDays> <!-- 事件最小间隔 -->
|
||||||
<numIncidentsRange>2~3</numIncidentsRange> <!-- 事件点数 -->
|
<numIncidentsRange>2~3</numIncidentsRange> <!-- 事件点数 -->
|
||||||
<!-- <forceRaidEnemyBeforeDaysPassed>20</forceRaidEnemyBeforeDaysPassed> -->
|
<!-- <forceRaidEnemyBeforeDaysPassed>20</forceRaidEnemyBeforeDaysPassed> -->
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
<li>Map_RaidBeacon</li>
|
<li>Map_RaidBeacon</li>
|
||||||
</disallowedTargetTags>
|
</disallowedTargetTags>
|
||||||
</li>
|
</li>
|
||||||
<!-- <li Class="StorytellerCompProperties_OnOffCycle">
|
<li Class="StorytellerCompProperties_OnOffCycle">
|
||||||
<category>ThreatSmall</category>
|
<category>ThreatSmall</category>
|
||||||
<minDaysPassed>11.0</minDaysPassed>
|
<minDaysPassed>0</minDaysPassed>
|
||||||
<onDays>4.6</onDays>
|
<onDays>2.6</onDays>
|
||||||
<offDays>6.0</offDays>
|
<offDays>3.0</offDays>
|
||||||
<numIncidentsRange>0.2~1</numIncidentsRange>
|
<numIncidentsRange>0.2~1</numIncidentsRange>
|
||||||
<acceptPercentFactorPerThreatPointsCurve>
|
<acceptPercentFactorPerThreatPointsCurve>
|
||||||
<points>
|
<points>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<li>(2800, 0)</li>
|
<li>(2800, 0)</li>
|
||||||
</points>
|
</points>
|
||||||
</acceptPercentFactorPerThreatPointsCurve>
|
</acceptPercentFactorPerThreatPointsCurve>
|
||||||
</li> -->
|
</li>
|
||||||
<li Class="StorytellerCompProperties_ThreatsGenerator">
|
<li Class="StorytellerCompProperties_ThreatsGenerator">
|
||||||
<allowedTargetTags>
|
<allowedTargetTags>
|
||||||
<li>Map_RaidBeacon</li>
|
<li>Map_RaidBeacon</li>
|
||||||
@@ -55,17 +55,17 @@
|
|||||||
<allowedTargetTags>
|
<allowedTargetTags>
|
||||||
<li>Map_PlayerHome</li>
|
<li>Map_PlayerHome</li>
|
||||||
</allowedTargetTags>
|
</allowedTargetTags>
|
||||||
<minDaysPassed>5</minDaysPassed>
|
<minDaysPassed>0</minDaysPassed>
|
||||||
<mtbDays>4.8</mtbDays>
|
<mtbDays>4.8</mtbDays>
|
||||||
</li>
|
</li>
|
||||||
<li Class="StorytellerCompProperties_ShipChunkDrop"/>
|
<li Class="StorytellerCompProperties_ShipChunkDrop"/>
|
||||||
<li Class="StorytellerCompProperties_Disease">
|
<li Class="StorytellerCompProperties_Disease">
|
||||||
<category>DiseaseHuman</category>
|
<category>DiseaseHuman</category>
|
||||||
<minDaysPassed>9</minDaysPassed>
|
<minDaysPassed>0</minDaysPassed>
|
||||||
</li>
|
</li>
|
||||||
<li Class="StorytellerCompProperties_Disease">
|
<li Class="StorytellerCompProperties_Disease">
|
||||||
<category>DiseaseAnimal</category>
|
<category>DiseaseAnimal</category>
|
||||||
<minDaysPassed>9</minDaysPassed>
|
<minDaysPassed>0</minDaysPassed>
|
||||||
</li>
|
</li>
|
||||||
<!-- Ally/neutral interaction -->
|
<!-- Ally/neutral interaction -->
|
||||||
<li Class="StorytellerCompProperties_FactionInteraction">
|
<li Class="StorytellerCompProperties_FactionInteraction">
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<allowedTargetTags>
|
<allowedTargetTags>
|
||||||
<li>World</li>
|
<li>World</li>
|
||||||
</allowedTargetTags>
|
</allowedTargetTags>
|
||||||
<minDaysPassed>15</minDaysPassed>
|
<minDaysPassed>0</minDaysPassed>
|
||||||
<mtbDays>15</mtbDays>
|
<mtbDays>15</mtbDays>
|
||||||
</li>
|
</li>
|
||||||
<!-- Orbital trader -->
|
<!-- Orbital trader -->
|
||||||
@@ -180,11 +180,6 @@
|
|||||||
<offDays>8</offDays>
|
<offDays>8</offDays>
|
||||||
<numIncidentsRange>1</numIncidentsRange>
|
<numIncidentsRange>1</numIncidentsRange>
|
||||||
</li>
|
</li>
|
||||||
<!-- Triggered -->
|
|
||||||
<li Class="StorytellerCompProperties_Triggered">
|
|
||||||
<incident>StrangerInBlackJoin</incident>
|
|
||||||
<delayTicks>180</delayTicks>
|
|
||||||
</li>
|
|
||||||
</comps>
|
</comps>
|
||||||
</StorytellerDef>
|
</StorytellerDef>
|
||||||
</Defs>
|
</Defs>
|
||||||
@@ -831,7 +831,7 @@
|
|||||||
</comps>
|
</comps>
|
||||||
</ThingDef>
|
</ThingDef>
|
||||||
|
|
||||||
<!-- 制造机 -->
|
<!-- 订单机 -->
|
||||||
<ThingDef ParentName="BuildingBase">
|
<ThingDef ParentName="BuildingBase">
|
||||||
<defName>WULA_WeaponArmor_Productor_Cleanzone</defName>
|
<defName>WULA_WeaponArmor_Productor_Cleanzone</defName>
|
||||||
<label>乌拉帝国作业通讯台</label>
|
<label>乌拉帝国作业通讯台</label>
|
||||||
@@ -988,9 +988,9 @@
|
|||||||
<overrideExistingFaction>false</overrideExistingFaction>
|
<overrideExistingFaction>false</overrideExistingFaction>
|
||||||
</li>
|
</li>
|
||||||
<li Class="WulaFallenEmpire.CompProperties_OpenCustomUI">
|
<li Class="WulaFallenEmpire.CompProperties_OpenCustomUI">
|
||||||
<uiDefName>Wula_UI_Main_1</uiDefName>
|
<uiDefName>Wula_UI_Legion_1</uiDefName>
|
||||||
<label>联络乌拉帝国</label>
|
<label>联络行星封锁机关</label>
|
||||||
<failReason>无法接触通讯站。</failReason>
|
<failReason>无法接触。</failReason>
|
||||||
</li>
|
</li>
|
||||||
</comps>
|
</comps>
|
||||||
</ThingDef>
|
</ThingDef>
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
<label>自律核心数据包(射击)</label>
|
<label>自律核心数据包(射击)</label>
|
||||||
<description>包含了射击经验的自律核心数据包,可以被乌拉帝国拥有自律核心的武器吸收以提升其品质。</description>
|
<description>包含了射击经验的自律核心数据包,可以被乌拉帝国拥有自律核心的武器吸收以提升其品质。</description>
|
||||||
<graphicData>
|
<graphicData>
|
||||||
<texPath>Wula/Item/WULA_Dark_Matter_Item</texPath>
|
<texPath>Wula/Item/WULA_ExperienceDataPack</texPath>
|
||||||
<graphicClass>Graphic_Single</graphicClass>
|
<graphicClass>Graphic_Single</graphicClass>
|
||||||
|
<drawSize>0.8</drawSize>
|
||||||
</graphicData>
|
</graphicData>
|
||||||
<tickerType>Never</tickerType>
|
<tickerType>Never</tickerType>
|
||||||
<smeltable>false</smeltable>
|
<smeltable>false</smeltable>
|
||||||
@@ -35,8 +36,9 @@
|
|||||||
<label>自律核心数据包(近战)</label>
|
<label>自律核心数据包(近战)</label>
|
||||||
<description>包含了近战经验的自律核心数据包,可以被乌拉帝国拥有自律核心的武器吸收以提升其品质。</description>
|
<description>包含了近战经验的自律核心数据包,可以被乌拉帝国拥有自律核心的武器吸收以提升其品质。</description>
|
||||||
<graphicData>
|
<graphicData>
|
||||||
<texPath>Wula/Item/WULA_Dark_Matter_Item</texPath>
|
<texPath>Wula/Item/WULA_ExperienceDataPack</texPath>
|
||||||
<graphicClass>Graphic_Single</graphicClass>
|
<graphicClass>Graphic_Single</graphicClass>
|
||||||
|
<drawSize>0.8</drawSize>
|
||||||
</graphicData>
|
</graphicData>
|
||||||
<tickerType>Never</tickerType>
|
<tickerType>Never</tickerType>
|
||||||
<smeltable>false</smeltable>
|
<smeltable>false</smeltable>
|
||||||
@@ -62,7 +64,7 @@
|
|||||||
</ThingDef>
|
</ThingDef>
|
||||||
|
|
||||||
<!-- 近战 -->
|
<!-- 近战 -->
|
||||||
<ThingDef Name="WULA_ExperienceCore_Weapon_Melee" ParentName="BaseMeleeWeapon_Blunt_Quality">
|
<ThingDef Name="WULA_ExperienceCore_Weapon_Melee" ParentName="BaseMeleeWeapon_Blunt_Quality" Abstract="True">
|
||||||
<comps>
|
<comps>
|
||||||
<!-- 经验核心组件 -->
|
<!-- 经验核心组件 -->
|
||||||
<li Class="WulaFallenEmpire.CompProperties_ExperienceCore">
|
<li Class="WulaFallenEmpire.CompProperties_ExperienceCore">
|
||||||
@@ -428,7 +430,7 @@
|
|||||||
</ThingDef>
|
</ThingDef>
|
||||||
|
|
||||||
<!-- 射弹武器 -->
|
<!-- 射弹武器 -->
|
||||||
<ThingDef Name="WULA_ExperienceCore_Weapon_Ranged" ParentName="BaseHumanMakeableGun">
|
<ThingDef Name="WULA_ExperienceCore_Weapon_Ranged" ParentName="BaseHumanMakeableGun" Abstract="True">
|
||||||
<comps>
|
<comps>
|
||||||
<!-- 经验核心组件 -->
|
<!-- 经验核心组件 -->
|
||||||
<li Class="WulaFallenEmpire.CompProperties_ExperienceCore">
|
<li Class="WulaFallenEmpire.CompProperties_ExperienceCore">
|
||||||
|
|||||||
@@ -6,22 +6,22 @@
|
|||||||
|
|
||||||
<!-- General Style -->
|
<!-- General Style -->
|
||||||
<labelFont>Small</labelFont>
|
<labelFont>Small</labelFont>
|
||||||
<drawBorders>false</drawBorders>
|
<drawBorders>true</drawBorders>
|
||||||
<showDefName>false</showDefName>
|
<showDefName>false</showDefName>
|
||||||
<showLabel>true</showLabel>
|
<showLabel>true</showLabel>
|
||||||
<defaultBackgroundImagePath></defaultBackgroundImagePath>
|
<defaultBackgroundImagePath></defaultBackgroundImagePath>
|
||||||
|
|
||||||
<!-- Virtual Layout Dimensions -->
|
<!-- Virtual Layout Dimensions -->
|
||||||
<lihuiSize>(500, 800)</lihuiSize>
|
<lihuiSize>(1093, 687)</lihuiSize>
|
||||||
<nameSize>(650, 130)</nameSize>
|
<nameSize>(593, 530)</nameSize>
|
||||||
<textSize>(650, 350)</textSize>
|
<textSize>(593, 330)</textSize>
|
||||||
<optionsWidth>750</optionsWidth>
|
<optionsWidth>750</optionsWidth>
|
||||||
|
|
||||||
<!-- Virtual Layout Offsets -->
|
<!-- Virtual Layout Offsets -->
|
||||||
<textNameOffset>0</textNameOffset>
|
<textNameOffset>0</textNameOffset>
|
||||||
<optionsTextOffset>0</optionsTextOffset>
|
<optionsTextOffset>0</optionsTextOffset>
|
||||||
|
|
||||||
<defaultWindowSize>(750, 600)</defaultWindowSize>
|
<defaultWindowSize>(693, 887)</defaultWindowSize>
|
||||||
|
|
||||||
<!-- New Layout Dimensions -->
|
<!-- New Layout Dimensions -->
|
||||||
<newLayoutNameSize>(200, 50)</newLayoutNameSize>
|
<newLayoutNameSize>(200, 50)</newLayoutNameSize>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 57 KiB |
BIN
Content/Textures/Wula/Building/WULA_Cube_Productor_east.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
Content/Textures/Wula/Building/WULA_Cube_Productor_north.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
Content/Textures/Wula/Building/WULA_Cube_Productor_south.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
Content/Textures/Wula/Events/Portraits/WULA_Legion_1.png
Normal file
|
After Width: | Height: | Size: 3.3 MiB |
BIN
Content/Textures/Wula/Item/WULA_ExperienceDataPack.png
Normal file
|
After Width: | Height: | Size: 99 KiB |
BIN
Content/Textures/Wula/Storyteller/WULA_Legion.png
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
Content/Textures/Wula/Storyteller/WULA_Legion_TINY.png
Normal file
|
After Width: | Height: | Size: 340 KiB |
@@ -103,11 +103,13 @@ namespace WulaFallenEmpire
|
|||||||
|
|
||||||
public override void DoWindowContents(Rect inRect)
|
public override void DoWindowContents(Rect inRect)
|
||||||
{
|
{
|
||||||
|
// 绘制背景
|
||||||
if (background != null)
|
if (background != null)
|
||||||
{
|
{
|
||||||
GUI.DrawTexture(inRect, background, ScaleMode.ScaleToFit);
|
GUI.DrawTexture(inRect, background, ScaleMode.ScaleToFit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 调试信息(def名称)
|
||||||
if (Config.showDefName)
|
if (Config.showDefName)
|
||||||
{
|
{
|
||||||
Text.Font = GameFont.Tiny;
|
Text.Font = GameFont.Tiny;
|
||||||
@@ -116,34 +118,31 @@ namespace WulaFallenEmpire
|
|||||||
GUI.color = Color.white;
|
GUI.color = Color.white;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.showLabel)
|
// 使用新的布局参数
|
||||||
{
|
float scale = CalculateScale(inRect);
|
||||||
Text.Font = Config.labelFont;
|
|
||||||
Widgets.Label(new Rect(5, 20f, inRect.width - 10, 30f), def.label);
|
|
||||||
Text.Font = GameFont.Small;
|
|
||||||
}
|
|
||||||
|
|
||||||
float virtualWidth = Config.lihuiSize.x + Config.textSize.x;
|
// 使用新的布局尺寸
|
||||||
float virtualHeight = Config.lihuiSize.y;
|
float scaledLihuiWidth = Config.newLayoutLihuiSize.x * scale;
|
||||||
|
float scaledLihuiHeight = Config.newLayoutLihuiSize.y * scale;
|
||||||
|
float scaledTextWidth = Config.newLayoutTextSize.x * scale;
|
||||||
|
float scaledTextHeight = Config.newLayoutTextSize.y * scale;
|
||||||
|
float scaledOptionsWidth = Config.newLayoutOptionsWidth * scale;
|
||||||
|
|
||||||
float scaleX = inRect.width / virtualWidth;
|
// 计算各元素高度
|
||||||
float scaleY = inRect.height / virtualHeight;
|
float labelHeight = 30f * scale;
|
||||||
float scale = Mathf.Min(scaleX, scaleY) * 0.95f;
|
float characterNameHeight = 25f * scale;
|
||||||
|
float descriptionHeight = scaledTextHeight;
|
||||||
|
float optionsHeight = CalculateOptionsHeight(def.options, scaledOptionsWidth, scale);
|
||||||
|
|
||||||
float scaledLihuiWidth = Config.lihuiSize.x * scale;
|
// 使用新的间距参数
|
||||||
float scaledLihuiHeight = Config.lihuiSize.y * scale;
|
float topMargin = Config.newLayoutPadding * scale;
|
||||||
float scaledNameWidth = Config.nameSize.x * scale;
|
float elementSpacing = Config.newLayoutTextNameOffset * scale;
|
||||||
float scaledNameHeight = Config.nameSize.y * scale;
|
float textOptionsSpacing = Config.newLayoutOptionsTextOffset * scale;
|
||||||
float scaledTextWidth = Config.textSize.x * scale;
|
|
||||||
float scaledTextHeight = Config.textSize.y * scale;
|
|
||||||
float scaledOptionsWidth = Config.optionsWidth * scale;
|
|
||||||
|
|
||||||
float totalContentWidth = scaledLihuiWidth + scaledTextWidth;
|
float currentY = topMargin;
|
||||||
float totalContentHeight = scaledLihuiHeight;
|
|
||||||
float startX = (inRect.width - totalContentWidth) / 2;
|
|
||||||
float startY = (inRect.height - totalContentHeight) / 2;
|
|
||||||
|
|
||||||
Rect lihuiRect = new Rect(startX, startY, scaledLihuiWidth, scaledLihuiHeight);
|
// 1. 立绘(水平居中,顶着顶部)
|
||||||
|
Rect lihuiRect = new Rect((inRect.width - scaledLihuiWidth) / 2, currentY, scaledLihuiWidth, scaledLihuiHeight);
|
||||||
if (portrait != null)
|
if (portrait != null)
|
||||||
{
|
{
|
||||||
GUI.DrawTexture(lihuiRect, portrait, ScaleMode.ScaleToFit);
|
GUI.DrawTexture(lihuiRect, portrait, ScaleMode.ScaleToFit);
|
||||||
@@ -152,33 +151,117 @@ namespace WulaFallenEmpire
|
|||||||
{
|
{
|
||||||
Widgets.DrawBox(lihuiRect);
|
Widgets.DrawBox(lihuiRect);
|
||||||
}
|
}
|
||||||
|
currentY += scaledLihuiHeight + elementSpacing;
|
||||||
|
|
||||||
|
// 2. Label(水平居中)
|
||||||
|
if (Config.showLabel)
|
||||||
|
{
|
||||||
|
Rect labelRect = new Rect(0, currentY, inRect.width, labelHeight);
|
||||||
|
Text.Anchor = TextAnchor.MiddleCenter;
|
||||||
|
Text.Font = Config.labelFont;
|
||||||
|
Widgets.Label(labelRect, def.label);
|
||||||
|
Text.Font = GameFont.Small;
|
||||||
|
Text.Anchor = TextAnchor.UpperLeft;
|
||||||
|
|
||||||
Rect nameRect = new Rect(lihuiRect.xMax, lihuiRect.y, scaledNameWidth, scaledNameHeight);
|
|
||||||
if (Config.drawBorders)
|
if (Config.drawBorders)
|
||||||
{
|
{
|
||||||
Widgets.DrawBox(nameRect);
|
Widgets.DrawBox(labelRect);
|
||||||
}
|
}
|
||||||
|
currentY += labelHeight + elementSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. CharacterName(水平居中)
|
||||||
|
Rect nameRect = new Rect(0, currentY, inRect.width, characterNameHeight);
|
||||||
Text.Anchor = TextAnchor.MiddleCenter;
|
Text.Anchor = TextAnchor.MiddleCenter;
|
||||||
Text.Font = GameFont.Medium;
|
Text.Font = GameFont.Medium;
|
||||||
Widgets.Label(nameRect, def.characterName);
|
Widgets.Label(nameRect, def.characterName);
|
||||||
Text.Font = GameFont.Small;
|
Text.Font = GameFont.Small;
|
||||||
Text.Anchor = TextAnchor.UpperLeft;
|
Text.Anchor = TextAnchor.UpperLeft;
|
||||||
|
|
||||||
Rect textRect = new Rect(nameRect.x, nameRect.yMax + Config.textNameOffset * scale, scaledTextWidth, scaledTextHeight);
|
if (Config.drawBorders)
|
||||||
|
{
|
||||||
|
Widgets.DrawBox(nameRect);
|
||||||
|
}
|
||||||
|
currentY += characterNameHeight + elementSpacing;
|
||||||
|
|
||||||
|
// 4. Descriptions(水平居中)
|
||||||
|
Rect textRect = new Rect((inRect.width - scaledTextWidth) / 2, currentY, scaledTextWidth, descriptionHeight);
|
||||||
if (Config.drawBorders)
|
if (Config.drawBorders)
|
||||||
{
|
{
|
||||||
Widgets.DrawBox(textRect);
|
Widgets.DrawBox(textRect);
|
||||||
}
|
}
|
||||||
Rect textInnerRect = textRect.ContractedBy(10f * scale);
|
|
||||||
Widgets.Label(textInnerRect, selectedDescription);
|
|
||||||
|
|
||||||
Rect optionRect = new Rect(nameRect.x, textRect.yMax + Config.optionsTextOffset * scale, scaledOptionsWidth, lihuiRect.height - nameRect.height - textRect.height - (Config.textNameOffset + Config.optionsTextOffset) * scale);
|
// 增加内边距
|
||||||
|
float textInnerPadding = 15f * scale;
|
||||||
|
Rect textInnerRect = textRect.ContractedBy(textInnerPadding);
|
||||||
|
Widgets.LabelScrollable(textInnerRect, selectedDescription, ref scrollPosition);
|
||||||
|
|
||||||
|
currentY += descriptionHeight + textOptionsSpacing;
|
||||||
|
|
||||||
|
// 5. Options(水平居中)
|
||||||
|
Rect optionRect = new Rect((inRect.width - scaledOptionsWidth) / 2, currentY, scaledOptionsWidth, optionsHeight);
|
||||||
|
if (Config.drawBorders)
|
||||||
|
{
|
||||||
|
Widgets.DrawBox(optionRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加内边距
|
||||||
|
float optionsInnerPadding = 10f * scale;
|
||||||
|
DrawOptions(optionRect.ContractedBy(optionsInnerPadding), def.options, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算缩放比例 - 使用新的布局参数
|
||||||
|
private float CalculateScale(Rect inRect)
|
||||||
|
{
|
||||||
|
float virtualWidth = Mathf.Max(
|
||||||
|
Config.newLayoutLihuiSize.x,
|
||||||
|
Config.newLayoutTextSize.x,
|
||||||
|
Config.newLayoutOptionsWidth
|
||||||
|
);
|
||||||
|
float scaleX = inRect.width / virtualWidth;
|
||||||
|
return Mathf.Min(scaleX, 1.0f) * 0.85f; // 稍微减少缩放以留出更多边距
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算选项区域高度
|
||||||
|
private float CalculateOptionsHeight(List<EventOption> options, float optionsWidth, float scale)
|
||||||
|
{
|
||||||
|
if (options == null || options.Count == 0)
|
||||||
|
return 0f;
|
||||||
|
|
||||||
|
float totalHeight = 0f;
|
||||||
|
var eventVarManager = Find.World.GetComponent<EventVariableManager>();
|
||||||
|
|
||||||
|
foreach (var option in options)
|
||||||
|
{
|
||||||
|
string reason;
|
||||||
|
bool conditionsMet = AreConditionsMet(option.conditions, out reason);
|
||||||
|
|
||||||
|
if (!conditionsMet && option.hideWhenDisabled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加选项高度和间距
|
||||||
|
totalHeight += 35f * scale; // 每个选项高度
|
||||||
|
totalHeight += 8f * scale; // 选项间距
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制选项
|
||||||
|
private void DrawOptions(Rect rect, List<EventOption> options, float scale)
|
||||||
|
{
|
||||||
|
if (options == null || options.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Listing_Standard listing = new Listing_Standard();
|
Listing_Standard listing = new Listing_Standard();
|
||||||
listing.Begin(optionRect.ContractedBy(10f * scale));
|
listing.Begin(rect);
|
||||||
if (def.options != null)
|
|
||||||
{
|
// 增加选项之间的间距
|
||||||
foreach (var option in def.options)
|
listing.verticalSpacing = 8f * scale;
|
||||||
|
|
||||||
|
foreach (var option in options)
|
||||||
{
|
{
|
||||||
string reason;
|
string reason;
|
||||||
bool conditionsMet = AreConditionsMet(option.conditions, out reason);
|
bool conditionsMet = AreConditionsMet(option.conditions, out reason);
|
||||||
@@ -196,15 +279,18 @@ namespace WulaFallenEmpire
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Rect rect = listing.GetRect(30f);
|
Rect buttonRect = listing.GetRect(35f * scale); // 增加按钮高度
|
||||||
Widgets.ButtonText(rect, option.label, false, true, false);
|
Widgets.ButtonText(buttonRect, option.label, false, true, false);
|
||||||
TooltipHandler.TipRegion(rect, GetDisabledReason(option, reason));
|
TooltipHandler.TipRegion(buttonRect, GetDisabledReason(option, reason));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listing.End();
|
listing.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 滚动位置用于描述文本
|
||||||
|
private Vector2 scrollPosition = Vector2.zero;
|
||||||
|
|
||||||
private void HandleAction(List<ConditionalEffects> conditionalEffects)
|
private void HandleAction(List<ConditionalEffects> conditionalEffects)
|
||||||
{
|
{
|
||||||
if (conditionalEffects.NullOrEmpty())
|
if (conditionalEffects.NullOrEmpty())
|
||||||
@@ -258,16 +344,14 @@ namespace WulaFallenEmpire
|
|||||||
private string FormatDescription(string description)
|
private string FormatDescription(string description)
|
||||||
{
|
{
|
||||||
var eventVarManager = Find.World.GetComponent<EventVariableManager>();
|
var eventVarManager = Find.World.GetComponent<EventVariableManager>();
|
||||||
// Use regex to find all placeholders like {variableName}
|
|
||||||
return Regex.Replace(description, @"\{(.+?)\}", match =>
|
return Regex.Replace(description, @"\{(.+?)\}", match =>
|
||||||
{
|
{
|
||||||
string varName = match.Groups[1].Value;
|
string varName = match.Groups[1].Value;
|
||||||
if (eventVarManager.HasVariable(varName))
|
if (eventVarManager.HasVariable(varName))
|
||||||
{
|
{
|
||||||
// Important: GetVariable<object> to get any type
|
|
||||||
return eventVarManager.GetVariable<object>(varName)?.ToString() ?? "";
|
return eventVarManager.GetVariable<object>(varName)?.ToString() ?? "";
|
||||||
}
|
}
|
||||||
return match.Value; // Keep placeholder if variable not found
|
return match.Value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
美术与文本源文件/Wula/Building/WULA_Cube_Productor.sai2
Normal file
BIN
美术与文本源文件/Wula/Item/WULA_ExperienceDataPack.sai2
Normal file
BIN
美术与文本源文件/Wula/UI/EventUI/新建画布2.png
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
美术与文本源文件/Wula/UI/EventUI/新建画布22.png
Normal file
|
After Width: | Height: | Size: 2.0 MiB |