fix a small bug with design

This commit is contained in:
2026-07-06 16:35:20 +02:00
parent a794d5692f
commit d4a7da7911
2 changed files with 70 additions and 12 deletions
+38 -7
View File
@@ -659,6 +659,7 @@ namespace KernelPanic.UI
DistroDefinition unit = playerCollection.OwnedUnits[selectedPackageIndex];
runSetupDetail.Add(BuildRunSetupReadout(unit));
AddRunSetupPassive(unit, runSetupDetail);
ScrollView packageScroll = new(ScrollViewMode.Vertical);
packageScroll.AddToClassList("package-scroll");
@@ -735,19 +736,37 @@ namespace KernelPanic.UI
Label stats = new($"uptime {unit.BaseUptime} · ram {unit.BaseRam} · cycles {unit.BaseCyclesPerTurn}");
stats.AddToClassList("collection-detail-muted");
stats.AddToClassList("run-stat-line");
copy.Add(stats);
if (unit.Passive != null)
{
Label passive = new($"{unit.Passive.Name}: {unit.Passive.RulesText}");
passive.AddToClassList("run-passive-summary");
copy.Add(passive);
}
readout.Add(copy);
return readout;
}
private static void AddRunSetupPassive(DistroDefinition unit, VisualElement container)
{
if (unit.Passive == null)
{
return;
}
VisualElement passiveBlock = new();
passiveBlock.AddToClassList("run-passive-block");
Label rules = new($"{unit.Passive.Name}: {unit.Passive.RulesText}");
rules.AddToClassList("run-passive-rules");
passiveBlock.Add(rules);
if (!string.IsNullOrWhiteSpace(unit.Passive.FlavorText))
{
Label flavor = new(unit.Passive.FlavorText);
flavor.AddToClassList("run-passive-flavor");
passiveBlock.Add(flavor);
}
container.Add(passiveBlock);
}
private static VisualElement BuildDetailLine(string key, string value)
{
VisualElement row = new();
@@ -991,6 +1010,18 @@ namespace KernelPanic.UI
runSetupPanel.EnableInClassList(HiddenClassName, runSetupPanel != activePanel);
gachaPanel.EnableInClassList(HiddenClassName, gachaPanel != activePanel);
settingsPanel.EnableInClassList(HiddenClassName, settingsPanel != activePanel);
bool showingMainMenu = mainMenuPanel == activePanel;
motdBlock.EnableInClassList(HiddenClassName, !showingMainMenu || string.IsNullOrWhiteSpace(motdBody));
if (showingMainMenu)
{
RefreshEventBanner();
}
else
{
eventBanner.AddToClassList(HiddenClassName);
}
}
private sealed class CommandMenuEntry
+32 -5
View File
@@ -746,8 +746,8 @@ Button {
}
.run-readout {
min-height: 110px;
max-height: 128px;
min-height: 112px;
max-height: 122px;
flex-direction: row;
overflow: hidden;
}
@@ -765,12 +765,39 @@ Button {
padding-left: 14px;
}
.run-passive-summary {
color: var(--kp-primary);
.run-readout .collection-detail-name {
margin-bottom: 4px;
}
.run-readout .collection-detail-description {
margin-top: 0;
margin-bottom: 6px;
}
.run-stat-line {
margin-top: 0;
margin-bottom: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 8px;
}
.run-passive-block {
flex-shrink: 0;
margin-top: 10px;
margin-bottom: 8px;
}
.run-passive-rules {
color: var(--kp-primary);
white-space: normal;
}
.run-passive-flavor {
color: var(--kp-muted);
-unity-font-style: italic;
white-space: normal;
margin-top: 4px;
}
.boot-command-row {