Revamp UI a whole lot

This commit is contained in:
2026-11-18 19:42:44 +01:00
parent 260abc2c98
commit fdde7f9d80
57 changed files with 2667 additions and 935 deletions
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 0
secondaryLanguage: 2
passive: {fileID: 11400000, guid: aa100000000000000000000000000001, type: 2}
description: 'She uses Arch, btw. Her love language is linking the wiki, her desktop is a r/unixporn post, and her idea of a red flag is a preinstalled window manager. You can fix her. The instructions are on page 37.'
playstyleSummary: volatile C/Rust tempo. every played card adds btw, which makes C and Rust hits bigger until the turn ends.
description: 'Arch is a lean rolling system assembled one deliberate package at a time. On the fractured network, its operators turn that ownership into momentum: every played card adds btw damage to C and Rust, while one rolling-release recovery per wave can leave a fatal crash at 1 Uptime.'
playstyleSummary: Build btw with every card, then cash that momentum into stronger C and Rust hits before the turn ends.
languageBlurbs:
- lang: 0
blurb: sharp native damage with a higher crit rate and occasional segfault recoil.
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 2
secondaryLanguage: 8
passive: {fileID: 11400000, guid: ded62c69f70d38a49b21972d857df4e2, type: 2}
description: 'She wears a red hat and calls production her test environment. Every date is early access; every breakup gets a bug report. You liked that new feature? She was daily-driving it two kernel panics ago.'
playstyleSummary: high-tempo gambler. her first play each turn is pushed hard, but bleeding edge bites back. rust cards are her safety net.
description: 'Fedora is where new kernels and toolchains meet real hardware before the rest of the fleet adopts them. Its surviving test nodes still run ahead of the stable mirrors; Bleeding Edge makes the first card each turn cheaper and stronger, with a crash risk that rises until the experiment finally fails.'
playstyleSummary: Push the first play of each turn for speed and damage, then use reliable Rust cards to contain the growing crash risk.
languageBlurbs:
- lang: 2
blurb: guaranteed damage that never misses; overkill turns to shield.
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 6
secondaryLanguage: 0
passive: {fileID: 11400000, guid: b821fa56a5034b9bbd3a000000000102, type: 2}
description: 'She wants a slow-burn romance. The burn is her CPU and the slow is emerge --world. Bring the extended editions, a cooling pad, and your own USE flags. By the third date, Firefox might be ready.'
playstyleSummary: "Compile across rounds; stage Haskell operations or dispatch C hits as optimization grows."
description: 'Gentoo treats the host as source code rather than a finished appliance. The old build farms now compile defenses for whatever hardware is still alive; emerge --world starts each wave below full strength, then raises direct card damage as completed rounds advance Compilation.'
playstyleSummary: "Accept a slow opening, then stage Haskell operations or dispatch C hits as Compilation improves across rounds."
languageBlurbs:
- lang: 6
blurb: "Lazy Stack snapshots up to x2.5 damage and Shield; resolves last-in-first-out."
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 3
secondaryLanguage: 4
passive: {fileID: 11400000, guid: d97481a7d54be2045a96165d3977c980, type: 2}
description: 'The cozy-game girlfriend of Linux. She resurrected your old laptop, put the Start menu back, and made tea while everyone else argued about Wayland. Her power fantasy is a printer that works on the first try.'
playstyleSummary: zero-variance comfort. every number lands at its ceiling, so you always know exactly what a turn does -- at the cost of a high-roll upside.
description: 'Mint keeps old workstations useful and their operators out of the command line unless trouble demands it. Its known-good desktop images became shelters after the Panic; It Just Works forces every random value to its maximum, giving up critical hits and damage multipliers for results you can trust.'
playstyleSummary: Every random value lands at its ceiling. Plan exact turns without critical hits or damage multipliers.
languageBlurbs:
- lang: 3
blurb: cheap, flexible cards that resolve at end of turn.
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 6
secondaryLanguage: 9
passive: {fileID: 11400000, guid: b7fb0d7714cd44af9554d3fe8df88081, type: 2}
description: 'She can fix you, declaratively. Your entire relationship is in a flake, the anniversary is pinned, and that argument never happened in the previous generation. Her dotfiles have lore. You will be quizzed.'
playstyleSummary: "Switch CPU governors tactically. Stage Haskell effects or maintain Go goroutines; apply the right policy at resolution."
description: 'NixOS can rebuild a host from a declaration and return to the previous generation when reality disagrees. That made its archives invaluable when configuration drift consumed whole racks; nixos-rebuild switch spends a Cycle to favor damage, Shield, or a balanced governor before queued effects resolve.'
playstyleSummary: "Switch CPU governors before effects resolve: performance for damage, powersave for Shield, or schedutil for balance."
languageBlurbs:
- lang: 6
blurb: "Snapshot stack depth, then switch governor before the effects resolve."
+2 -2
View File
@@ -17,8 +17,8 @@ MonoBehaviour:
primaryLanguage: 3
secondaryLanguage: 4
passive: {fileID: 11400000, guid: 19deb73cec3d5dc42a5cc336222ce9df, type: 2}
description: 'She brought a bootable USB to the meet-cute and had your Wi-Fi working before the opening credits. Everyone''s first Linux crush. Things are getting serious: she wants you to meet her Snaps and discuss extended kernel support.'
playstyleSummary: an accessible engine that never runs dry -- cheap python cards and a passive that always finds you the right package.
description: 'Ubuntu is the recovery image most operators learned first: broad hardware support, familiar tools, and a package index built to find the practical answer. Its mirrors brought thousands of silent hosts back after the Panic; in combat, sudo apt update replaces a blind draw with a choice from the top of the deck.'
playstyleSummary: Use cheap Python cards to keep the engine moving, then choose the better of the next two draws each turn.
languageBlurbs:
- lang: 3
blurb: cheap, flexible cards that resolve at end of turn.
+1 -1
View File
@@ -15,5 +15,5 @@ MonoBehaviour:
id: ubuntu_apt_update
displayName: sudo apt update
rulesText: instead of your normal turn draw, choose one of the top 2 cards of your draw pile to add to your hand. the others stay in order.
flavorText: 'Refresh the index before choosing your next dependency.'
flavorText: 'The mirrors survived in pieces, but the index still knows what is available. Check the next packages and install the one this incident needs.'
designNotes: replaces normal turn draw with a mandatory card choice; top 2 at V1, top 3 at V2, top 4 at V4; V4 discounts the chosen card by 1 this turn. Opening hand unchanged. Respect RAM and preserve unchosen draw order.
+1 -1
View File
@@ -15,5 +15,5 @@ MonoBehaviour:
id: fedora_bleeding_edge
displayName: Bleeding Edge
rulesText: the first card you play each turn costs 1 less and deals +50%, but may crash (do nothing). crash chance rises each turn it doesn't happen and resets when it does.
flavorText: 'The speedup is real. So is the open issue describing the crash.'
flavorText: 'Fedora ships the next kernel straight to the battlefield. The first job runs faster and hits harder; every clean turn makes the eventual crash more likely.'
designNotes: applies discount+damage mult to first-card-of-turn; escalating crash probability with reset-on-trigger; interacts with Fedora cards flagged crash-immune and with rawhide.
+1 -1
View File
@@ -15,5 +15,5 @@ MonoBehaviour:
id: gentoo_emerge_world
displayName: emerge --world
rulesText: "Compilation starts at 0 each wave and increases after each completed round, up to 4. Direct card damage at levels 0/1/2/3/4 is 85%/100%/110%/120%/130%. Deferred damage uses the level at resolution."
flavorText: 'Slow start. Better code each round. The build is the strategy.'
flavorText: 'A generic binary gets the host running. Each completed round gives Gentoo time to compile something faster for the machine that survived.'
designNotes: "Independent wave state. Version upgrades are cumulative: ccache, precompiled headers, LTO, -O3 -march=native. Excludes recoil, DOT, package damage and repeated spill scaling."
+1 -1
View File
@@ -15,5 +15,5 @@ MonoBehaviour:
id: arch_i_use_arch_btw
displayName: I use Arch, btw
rulesText: Each card played adds 1 btw until end of turn. C and Rust damage gains +1 per btw. Once per wave, lethal uptime sets Arch to 1 instead and clears btw.
flavorText: 'Each command adds confidence. Eventually the confidence becomes damage, btw.'
flavorText: 'Every played command is another claim of ownership. btw stacks sharpen C and Rust for the turn, and the latest recovery image can rescue one fatal mistake per wave.'
designNotes: V1 base passive. Increment btw before resolving each played card. End of TURN resets btw unless Arch has systemd equipped on-distro. First lethal damage each WAVE consumes rolling-release save, sets uptime to 1, clears btw, and logs a recovery beat.
+2 -2
View File
@@ -14,6 +14,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
id: mint_it_just_works
displayName: It Just Works
rulesText: mint's random values always resolve at maximum. in exchange, mint cannot crit and ignores damage multipliers -- her numbers are always the ceiling, never above it.
flavorText: 'Predictable results. A feature people keep mistaking for luck.'
rulesText: Mint's random values always resolve at maximum. In exchange, Mint cannot crit and ignores damage multipliers -- its numbers are always the ceiling, never above it.
flavorText: 'Mint follows the known-good path. Every random value reaches its ceiling, and nothing exceeds the specification through criticals or multipliers.'
designNotes: force-max on every RNG roll routed through the combat RNG chokepoint; disable crit and damage-mult application for Mint; requires combat engine to centralize randomness + multipliers.
+1 -1
View File
@@ -15,5 +15,5 @@ MonoBehaviour:
id: nixos_rebuild_switch
displayName: nixos-rebuild switch
rulesText: "Once per turn, pay 1 Cycle to switch governor. performance: +20% card damage, -25% card Shield. powersave: -20% card damage, +30% card Shield. schedutil: +5% both. Start each wave in schedutil. Live modifiers apply when effects resolve."
flavorText: 'Same workload, different policy. Pick what matters before the effects resolve.'
flavorText: 'The build stays reproducible; only the policy changes. Choose performance, powersave, or schedutil before pending work resolves.'
designNotes: "CPU governor names are used as gameplay metaphors. V2-V5 upgrades are cumulative."
-1
View File
@@ -2208,7 +2208,6 @@
.kernel-ui #TutorialStepTitle { white-space: normal; font-size: var(--type-body); margin-bottom: 8px; flex-shrink: 0; }
.kernel-ui #TutorialStepCount { color: rgb(153, 239, 206); }
.kernel-ui .tutorial-callout Button { white-space: normal; min-height: 32px; flex-shrink: 0; margin-top: 8px; }
.tutorial-guided .runtime-hint { display: none; }
.kernel-ui.narrow.tutorial-card-focus .turn-panel { display: none; }
.kernel-ui.narrow.tutorial-card-focus .hand-panel { width: 100%; }
.tutorial-shop-highlight { padding: 8px; margin-bottom: 12px; border-width: 2px; border-color: rgb(153, 239, 206); }
+233 -17
View File
@@ -189,7 +189,7 @@
.kernel-ui .unit-info-section .detail-section-title { flex-shrink: 0; margin: 0 0 12px; padding-bottom: 8px; }
.kernel-ui .unit-info-section .kv-row { flex-shrink: 0; margin: 0 0 12px; overflow: visible; }
.kernel-ui .unit-info-section .collection-detail-description { flex-shrink: 0; margin: 0; white-space: normal; }
.kernel-ui .unit-passive-section { margin-top: 24px; margin-bottom: 12px; }
.kernel-ui .unit-passive-section { margin-top: var(--space-4); margin-bottom: var(--space-3); }
.kernel-ui .unit-info-section .flavor-text { flex-shrink: 0; margin: 12px 0 0; white-space: normal; }
.kernel-ui .collection-row,
.kernel-ui .unit-overview-row,
@@ -224,6 +224,12 @@
.kernel-ui .settings-description,
.kernel-ui .settings-help { color: var(--kp-muted); font-size: var(--type-body); white-space: normal; margin-top: 8px; }
.kernel-ui .settings-help { margin: var(--space-2) 0 var(--space-4); }
.kernel-ui .settings-slider-control { width: 300px; min-width: 220px; flex-direction: row; align-items: center; margin-left: var(--space-3); }
.kernel-ui .settings-volume-slider { flex-grow: 1; min-width: 150px; height: 34px; }
.kernel-ui .settings-volume-slider .unity-base-slider__tracker { height: 4px; background-color: var(--kp-border); }
.kernel-ui .settings-volume-slider .unity-base-slider__dragger { width: 14px; height: 20px; background-color: var(--kp-amber); border-width: 1px; border-color: var(--kp-bg); }
.kernel-ui .settings-volume-slider .unity-base-slider__dragger-border { display: none; }
.kernel-ui .settings-slider-value { width: 64px; margin-left: var(--space-2); color: var(--kp-amber); -unity-text-align: middle-right; white-space: nowrap; }
/* Shared content primitives: bounded rows, contextual navigation, and readable data. */
.kernel-ui .collection-actions,
@@ -232,6 +238,7 @@
.kernel-ui .collection-context { padding: var(--space-2) 0 0; }
.kernel-ui .collection-detail > .unity-scroll-view__content-viewport > .unity-scroll-view__content-container { padding: 0 var(--space-2) var(--space-4) 0; flex-grow: 0; }
.kernel-ui .collection-detail-full > .unity-scroll-view__content-viewport > .unity-scroll-view__content-container { flex-grow: 0; }
.kernel-ui .collection-detail-full > .unity-scroll-view__content-viewport > .unity-scroll-view__content-container { justify-content: flex-start; }
.kernel-ui .collection-list .unity-scroll-view__content-container { min-width: 0; }
.kernel-ui .unit-detail-header { flex-direction: row; align-items: flex-start; margin-bottom: var(--space-2); }
.kernel-ui .unit-detail-header .unit-overview-meta { margin-top: var(--space-2); }
@@ -347,7 +354,8 @@
.kernel-ui .starter-dialog,
.kernel-ui .root-credit-dialog,
.kernel-ui .package-equip-dialog,
.kernel-ui .five-star-selector-dialog { width: 88%; max-width: 1000px; min-width: 0; max-height: 96%; border-width: 2px 1px 1px; border-color: var(--kp-border); border-top-color: var(--kp-amber); background-color: var(--kp-panel); padding: 20px; scale: 1 1; }
.kernel-ui .five-star-selector-dialog,
.kernel-ui .gacha-pull-history-dialog { width: 88%; max-width: 1000px; min-width: 0; max-height: 96%; border-width: 2px 1px 1px; border-color: var(--kp-border); border-top-color: var(--kp-amber); background-color: var(--kp-panel); padding: 20px; scale: 1 1; }
.kernel-ui .starter-title { font-size: 22px; color: var(--kp-text); }
.kernel-ui .starter-instruction { white-space: normal; color: var(--kp-muted); }
.kernel-ui .starter-options { flex-wrap: wrap; }
@@ -484,17 +492,8 @@
.kernel-ui .terminal-stat-value.compilation-value { flex-grow: 0; flex-shrink: 0; }
.kernel-ui .terminal-stat-row.turn-stat-row { margin-bottom: 4px; }
.kernel-ui .terminal-stat-key.turn-stat-label { width: 72px; margin-right: 8px; }
.kernel-ui .combat-packages { flex-shrink: 0; min-width: 0; width: 100%; padding: 10px 0 0; margin-top: 10px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); }
.kernel-ui .package-loadout-title { font-size: var(--type-meta); color: var(--kp-text-dim); margin-bottom: 6px; }
.kernel-ui .package-readiness-strip { flex-direction: column; min-width: 0; }
.kernel-ui .package-readiness-chip { flex-direction: row; align-items: center; flex-shrink: 0; min-width: 0; max-width: 100%; overflow: hidden; padding: 4px 0; margin: 0 0 3px; border-width: 0; border-bottom-width: 1px; border-color: var(--kp-border-subtle); }
.kernel-ui .package-readiness-copy { flex-grow: 1; flex-shrink: 1; min-width: 0; }
.kernel-ui .package-readiness-chip:focus { border-color: var(--kp-text); background-color: var(--kp-hover); }
.kernel-ui .card-chip:focus { border-color: var(--kp-text); background-color: var(--kp-hover); }
.kernel-ui .package-readiness-chip .package-rarity { margin-right: 6px; flex-shrink: 0; }
.kernel-ui .package-readiness-name { font-size: var(--type-meta); color: var(--kp-text); margin-right: 6px; min-width: 0; flex-shrink: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kernel-ui .package-readiness-state { font-size: var(--type-meta); color: var(--kp-cyan); min-width: 0; max-width: 100%; flex-shrink: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kernel-ui .package-activation { font-size: var(--type-meta); color: var(--kp-success); min-width: 0; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kernel-ui .package-activation { width: 100%; margin-top: 6px; padding-top: 5px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); font-size: var(--type-meta); color: var(--kp-success); min-width: 0; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kernel-ui .software-live-preview { margin-top: 8px; padding-top: 6px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); color: var(--kp-cyan); font-size: var(--type-meta); white-space: normal; flex-shrink: 0; }
.kernel-ui .software-live-crit { margin-top: 2px; color: var(--kp-muted); font-size: var(--type-meta); white-space: normal; flex-shrink: 0; }
.distro-nixos { --kp-distro: #7dc7f5; }
@@ -790,6 +789,7 @@
.kernel-ui.narrow .settings-row { flex-direction: column; align-items: stretch; }
.kernel-ui.narrow .settings-copy { flex-basis: auto; width: 100%; }
.kernel-ui.narrow .settings-toggle { align-self: flex-start; margin: var(--space-3) 0 0; }
.kernel-ui.narrow .settings-slider-control { width: 100%; min-width: 0; margin: var(--space-3) 0 0; }
.kernel-ui.narrow .screen-frame-hint { font-size: var(--type-meta); }
.kernel-ui.narrow .gacha-banner-row { flex-basis: 80px; flex-grow: 1; min-height: 80px; padding: var(--space-2); }
.kernel-ui.narrow .gacha-detail-title { white-space: normal; font-size: var(--type-title); }
@@ -869,15 +869,15 @@
.kernel-ui .peek-card .software-footer { display: none; }
.kernel-ui .peek-card .software-header { padding: 4px; }
.kernel-ui .peek-card .software-name { font-size: var(--type-meta); padding: 4px; }
.kernel-ui .runtime-hint { position: absolute; padding: 10px 12px; margin: 0; border-width: 1px; border-color: var(--kp-cyan); background-color: #16201b; color: var(--kp-text); font-size: var(--type-body); white-space: normal; }
.kernel-ui .bottom-layout.confirming { height: 340px; }
.kernel-ui.narrow .bottom-layout.confirming { height: auto; }
/* Combat refinement: content-sized tactical region, persistent readable buffer. */
.kernel-ui .combat-workspace { flex-grow: 0; flex-shrink: 1; }
.kernel-ui .combat-workspace > .unity-scroll-view__content-viewport > .unity-scroll-view__content-container { flex-grow: 0; }
.kernel-ui .bottom-layout { height: auto; flex-basis: 260px; flex-grow: 1; flex-shrink: 0; min-height: 260px; max-height: 380px; }
.kernel-ui.short-screen .bottom-layout { height: auto; flex-basis: 235px; min-height: 235px; max-height: 285px; }
.kernel-ui .bottom-layout { height: auto; flex-basis: 330px; flex-grow: 0; flex-shrink: 0; min-height: 330px; max-height: 420px; margin-top: auto; }
.kernel-ui.short-screen .bottom-layout { height: auto; flex-basis: 310px; min-height: 310px; max-height: 350px; }
.kernel-ui.very-short-screen .bottom-layout { flex-basis: 235px; min-height: 235px; max-height: 285px; }
.kernel-ui .bottom-layout.confirming { height: auto; min-height: 340px; }
.kernel-ui .enemy-row { align-items: flex-start; }
.kernel-ui .enemy-card { flex-grow: 0; flex-shrink: 0; }
@@ -887,7 +887,6 @@
.kernel-ui .enemy-card .intent-panel { min-height: 48px; }
.kernel-ui .enemy-card .process-state { margin-bottom: 2px; }
.kernel-ui .process-intent-slot { min-height: 48px; }
.kernel-ui .process-behavior { color: var(--kp-muted); white-space: normal; font-size: var(--type-meta); min-height: 0; margin-top: var(--space-1); }
.kernel-ui .scheduler { padding-top: 4px; padding-bottom: 4px; flex-direction: row; flex-wrap: wrap; }
.kernel-ui .scheduler .panel-header { width: 100%; flex-wrap: wrap; }
.kernel-ui .scheduler .track-zone { width: 100%; min-width: 0; }
@@ -932,13 +931,21 @@
.kernel-ui .hand-card:focus { border-bottom-width: 3px; border-bottom-color: var(--kp-text); }
.kernel-ui .journal-scroll { max-height: 110px; }
.kernel-ui .combat-journal .unity-foldout__text { font-size: var(--type-meta); }
.kernel-ui .combat-journal { margin-top: auto; }
.kernel-ui .combat-journal { margin-top: 0; }
.kernel-ui .journal-entry { font-size: var(--type-meta); white-space: normal; color: var(--kp-muted); margin: 2px 0; }
.kernel-ui .journal-damage { color: var(--kp-danger); }
.kernel-ui .journal-shield { color: var(--kp-cyan); }
.kernel-ui .journal-heal { color: var(--kp-success); }
.kernel-ui .journal-status { color: var(--kp-lang-haskell); }
.kernel-ui .journal-operation { color: var(--kp-amber); }
.kernel-ui .journal-action-results { margin-top: 5px; padding-top: 4px; border-top-width: 1px; border-top-color: var(--kp-border-subtle); }
.kernel-ui .journal-action-result { flex-shrink: 0; margin: 1px 0; }
.kernel-ui .journal-action-result > Toggle { min-height: 20px; margin: 0; padding: 1px 0; }
.kernel-ui .journal-action-result .unity-foldout__text { color: var(--kp-muted); font-size: var(--type-meta); white-space: normal; }
.kernel-ui .journal-action-active .unity-foldout__text { color: var(--kp-amber); }
.kernel-ui .journal-action-detail,
.kernel-ui .journal-action-damage { margin: 2px 0 2px 18px; font-size: var(--type-meta); white-space: normal; color: var(--kp-muted); }
.kernel-ui .journal-action-damage { color: var(--kp-cyan); }
.kernel-ui .process-restarting:disabled { opacity: 1; }
.kernel-ui .process-restarting .process-terminated { color: var(--kp-lang-haskell); }
.kernel-ui .process-terminated { white-space: normal; }
@@ -974,3 +981,212 @@
.kernel-ui.short-screen .gacha-art-shell,
.kernel-ui.short-screen .gacha-art-card .ascii-art { height: 65px; }
.kernel-ui.short-screen .gacha-hero-title { display: none; }
/* Terminal interaction pass: command rows and editor-like buffers. */
.kernel-ui .terminal-button,
.kernel-ui .primary-action,
.kernel-ui .secondary-action,
.kernel-ui .repository-action {
border-width: 0 0 1px 2px;
border-left-color: var(--kp-border-strong);
border-bottom-color: var(--kp-border-subtle);
background-color: transparent;
color: var(--kp-text);
-unity-text-align: middle-left;
}
.kernel-ui .terminal-button:hover,
.kernel-ui .primary-action:hover,
.kernel-ui .secondary-action:hover,
.kernel-ui .repository-action:hover,
.kernel-ui .terminal-button:focus,
.kernel-ui .primary-action:focus,
.kernel-ui .secondary-action:focus,
.kernel-ui .repository-action:focus {
border-left-color: var(--kp-amber);
background-color: var(--kp-hover);
color: var(--kp-amber);
}
.kernel-ui .terminal-button:disabled,
.kernel-ui .primary-action:disabled,
.kernel-ui .secondary-action:disabled,
.kernel-ui .repository-action:disabled {
border-left-color: var(--kp-border-subtle);
background-color: transparent;
color: var(--kp-muted);
opacity: 0.55;
}
.kernel-ui .screen-frame-header { border-top-width: 1px; border-top-color: var(--kp-cyan); }
.kernel-ui .screen-frame-title { color: var(--kp-cyan); }
.kernel-ui .screen-frame-footer { background-color: var(--kp-bg-deep); }
.kernel-ui .software-card {
border-width: 1px 0 1px 3px;
border-left-color: var(--software-ink);
border-top-color: var(--kp-border-subtle);
border-bottom-color: var(--kp-border-subtle);
}
.kernel-ui .software-code-line { flex-direction: row; align-items: flex-start; min-width: 0; }
.kernel-ui .software-line-number {
width: 24px;
min-width: 24px;
color: var(--kp-primary-dim);
-unity-text-align: upper-right;
margin-right: 8px;
flex-shrink: 0;
}
.kernel-ui .software-code-line .software-effect,
.kernel-ui .software-code-line .software-conditions { flex-grow: 1; min-width: 0; }
.kernel-ui .combat-command-prompt {
flex-shrink: 0;
min-height: 34px;
padding: 7px 18px;
border-width: 0 0 1px 2px;
border-left-color: var(--kp-cyan);
border-bottom-color: var(--kp-border);
background-color: var(--kp-bg-deep);
color: var(--kp-cyan);
-unity-font-style: bold;
white-space: normal;
}
.kernel-ui.combat-awaiting-target .combat-command-prompt { border-left-color: var(--kp-amber); color: var(--kp-amber); }
.kernel-ui.combat-resolving .hand-panel,
.kernel-ui.combat-resolving .turn-panel,
.kernel-ui.combat-awaiting-target .hand-panel { opacity: 0.52; }
.kernel-ui.combat-awaiting-target .process-panel { border-top-color: var(--kp-amber); }
.kernel-ui .settings-config-comment { color: var(--kp-primary-dim); margin-bottom: 8px; white-space: normal; }
.kernel-ui .settings-label { color: var(--kp-cyan); }
.kernel-ui .settings-description { color: var(--kp-primary-dim); }
.kernel-ui .settings-slider-value { color: var(--kp-amber); min-width: 150px; }
.kernel-ui .collection-tab { border-width: 0 0 1px 2px; border-left-color: transparent; }
.kernel-ui .collection-tab.selected { border-left-color: var(--kp-cyan); border-bottom-color: var(--kp-border-subtle); background-color: var(--kp-hover); }
.kernel-ui .run-archive-table { width: 100%; color: var(--kp-text); white-space: normal; padding: 8px 10px; border-left-width: 2px; border-left-color: var(--kp-cyan); background-color: var(--kp-bg-deep); }
.kernel-ui .run-archive-columns { color: var(--kp-primary-dim); }
.kernel-ui .repository-command-heading { color: var(--kp-cyan); border-bottom-color: var(--kp-border); }
.kernel-ui .repository-primary-command { border-left-color: var(--kp-amber); color: var(--kp-amber); -unity-font-style: bold; }
.kernel-ui .gacha-pull-history-dialog.is-empty {
height: 145px;
min-height: 145px;
max-height: 145px;
}
/* The unit roster is intentionally a dense `ls -lah` table, overriding the
older responsive card layout retained for the other collection lists. */
.kernel-ui .unit-overview-row {
width: 100%;
min-width: 0;
min-height: 52px;
height: auto;
flex-direction: column;
align-items: stretch;
}
.kernel-ui .unit-overview-row .unit-ls-line {
width: 100%;
min-width: 0;
flex-grow: 1;
white-space: nowrap;
font-size: var(--type-meta);
-unity-text-align: middle-left;
}
.kernel-ui .unit-overview-roster { flex-grow: 0; flex-shrink: 0; justify-content: flex-start; }
.kernel-ui .unit-loadout-line { color: var(--kp-muted); font-size: var(--type-meta); }
/* Configuration screens read as files, not preference cards. */
.kernel-ui .settings-config-file { max-width: 860px; }
.kernel-ui .settings-config-path { color: var(--kp-text); -unity-font-style: bold; margin-bottom: 2px; }
.kernel-ui .settings-config-file .settings-config-comment { margin: 0 0 10px; }
.kernel-ui .settings-config-file .settings-config-line {
min-height: 34px; padding: 2px 0; justify-content: flex-start;
border-width: 0; background-color: transparent;
}
.kernel-ui .settings-config-key { width: 170px; min-width: 170px; flex-grow: 0; flex-shrink: 0; color: var(--kp-text); }
.kernel-ui .settings-assignment { width: 24px; min-width: 24px; color: var(--kp-muted); }
.kernel-ui .settings-config-value { flex-grow: 0; flex-shrink: 1; min-width: 0; }
.kernel-ui .settings-config-file .settings-description { margin: 0 0 7px 194px; color: var(--kp-primary-dim); }
.kernel-ui .settings-config-file .settings-choice {
min-height: 28px; height: 28px; padding: 2px 8px; margin: 0;
border-width: 0; background-color: transparent; color: var(--kp-amber);
-unity-text-align: middle-left;
}
.kernel-ui .settings-config-file .settings-choice:hover,
.kernel-ui .settings-config-file .settings-choice:focus { background-color: var(--kp-hover); color: var(--kp-amber); }
.kernel-ui .settings-config-file .settings-slider-control { flex-direction: row; align-items: center; flex-grow: 1; }
.kernel-ui .settings-config-file .settings-volume-slider { width: 220px; min-width: 120px; margin-right: 12px; }
.kernel-ui .settings-config-file .settings-slider-value { min-width: 150px; white-space: nowrap; }
.kernel-ui .settings-config-help { color: var(--kp-primary-dim); white-space: normal; }
.kernel-ui.narrow .settings-config-key { width: 126px; min-width: 126px; }
.kernel-ui.narrow .settings-config-file .settings-description { margin-left: 150px; }
.kernel-ui.narrow .settings-volume-line { flex-wrap: wrap; }
/* Shell-history archive: fixed columns and command links, not button cards. */
.kernel-ui .run-archive-actions { width: 100%; max-width: 980px; }
.kernel-ui .run-archive-columns,
.kernel-ui .run-archive-table-row { white-space: nowrap; font-size: var(--type-body); }
.kernel-ui .run-archive-columns { padding: 5px 8px; border-bottom-width: 1px; border-bottom-color: var(--kp-border); }
.kernel-ui .run-archive-table-row { width: 100%; padding: 4px 8px; color: var(--kp-text); background-color: transparent; }
.kernel-ui .run-archive-table-row:hover { background-color: var(--kp-hover); }
.kernel-ui .run-archive-empty { padding: 10px 8px; color: var(--kp-amber); }
.kernel-ui .run-archive-section-label { margin-top: 18px; color: var(--kp-primary-dim); }
.kernel-ui .run-archive-commands { flex-direction: row; flex-wrap: wrap; margin-top: 8px; }
.kernel-ui .run-archive-actions .run-archive-command {
width: auto; min-width: 0; min-height: 28px; height: auto; margin: 0 18px 4px 0; padding: 3px 0;
border-width: 0; background-color: transparent; color: var(--kp-cyan); -unity-text-align: middle-left;
}
.kernel-ui .run-archive-actions .run-archive-command:hover,
.kernel-ui .run-archive-actions .run-archive-command:focus { background-color: var(--kp-hover); color: var(--kp-amber); }
/* Repository command groups and one unmistakable recommended next action. */
.kernel-ui .repository-package-operations { margin-top: 14px; padding-top: 8px; border-top-width: 1px; border-top-color: var(--kp-border); }
.kernel-ui .repository-section-label { color: var(--kp-text); border-width: 0; padding: 0; margin-bottom: 4px; }
.kernel-ui .repository-command-heading { border-width: 0; padding: 0; margin: 0 0 10px; color: var(--kp-cyan); }
.kernel-ui .repository-footer { align-items: stretch; }
.kernel-ui .repository-footer-group { min-width: 0; padding: 5px 8px; }
.kernel-ui .repository-package-controls { width: 210px; flex-shrink: 0; margin-right: 14px; border-right-width: 1px; border-right-color: var(--kp-border); }
.kernel-ui .repository-footer-label { margin: 0 0 4px; color: var(--kp-muted); font-size: var(--type-meta); }
.kernel-ui .repository-footer .repository-reroll-action { width: auto; height: 30px; margin: 0; padding: 3px 8px; border-color: var(--kp-border); color: var(--kp-muted); }
.kernel-ui .repository-leave-block { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; }
.kernel-ui .repository-leave-block .repository-recommended-label { width: 100%; color: var(--kp-amber); }
.kernel-ui .repository-footer .repository-recommended-action {
flex-grow: 1; min-width: 240px; height: 42px; margin-right: 12px;
border-width: 1px 1px 1px 3px; border-color: var(--kp-amber);
background-color: var(--kp-action); color: var(--kp-amber); -unity-font-style: bold;
}
.kernel-ui .repository-footer .repository-recommended-action:hover,
.kernel-ui .repository-footer .repository-recommended-action:focus { background-color: var(--kp-amber); color: var(--kp-bg); }
.kernel-ui .repository-footer .repository-save-action { flex-grow: 0; width: 170px; height: 30px; border-color: var(--kp-border); color: var(--kp-muted); }
.kernel-ui .repository-footer .repository-banked-hint { width: 100%; -unity-text-align: middle-left; }
.kernel-ui.narrow .repository-package-controls { width: 100%; margin: 0 0 6px; border-right-width: 0; border-bottom-width: 1px; border-bottom-color: var(--kp-border); }
/* Modals are terminal panes anchored inside the shell. */
.kernel-ui .modal-overlay { align-items: flex-start; justify-content: flex-start; padding: 6% 8%; }
.kernel-ui .terminal-pane {
min-width: 0; height: auto; max-height: 86%; flex-grow: 0;
padding: 0 14px 12px; border-width: 1px; border-top-width: 2px;
border-color: var(--kp-border); border-top-color: var(--kp-amber); background-color: var(--kp-bg-solid);
}
.kernel-ui .terminal-pane-titlebar {
min-height: 34px; margin: 0 -14px 10px; padding: 7px 12px;
border-bottom-width: 1px; border-bottom-color: var(--kp-border);
background-color: var(--kp-panel); color: var(--kp-text);
}
.kernel-ui .terminal-pane.dialog-scroll { height: auto; flex-grow: 0; }
.kernel-ui .gacha-pull-history-dialog.terminal-pane { height: 78%; }
.kernel-ui .gacha-pull-history-dialog.terminal-pane.is-empty { height: 145px; }
.kernel-ui .package-equip-dialog.terminal-pane { height: 74%; }
.kernel-ui .run-history-dialog.terminal-pane { height: 82%; }
.kernel-ui .run-history-dialog.terminal-pane.is-empty { width: 560px; height: auto; max-height: 220px; }
.kernel-ui .run-history-entry { padding: 8px; border-bottom-width: 1px; border-bottom-color: var(--kp-border); }
.kernel-ui .daily-quest-dialog.terminal-pane { width: 760px; height: 82%; max-height: 620px; }
.kernel-ui .daily-quest-dialog .daily-detail-header.terminal-pane-titlebar { padding-bottom: 7px; }
.kernel-ui .daily-cron-entry { color: var(--kp-primary-dim); font-size: var(--type-meta); }
.kernel-ui .daily-exit-status { color: var(--kp-muted); font-size: var(--type-meta); }
.kernel-ui .daily-quest-complete .daily-exit-status { color: var(--kp-success); }
.kernel-ui .daily-quest-completion-bonus .terminal-body { white-space: normal; }
.kernel-ui.narrow .modal-overlay { padding: 4%; }
.kernel-ui.narrow .terminal-pane,
.kernel-ui.narrow .daily-quest-dialog.terminal-pane { width: 92%; max-width: 92%; }
.kernel-ui .modal-overlay.daily-quest-overlay { align-items: center; justify-content: center; }
+305
View File
@@ -0,0 +1,305 @@
/*
* Terminal Program UI
*
* The scene sheets own geometry and the theme owns colors. This final component
* layer gives every screen the same program vocabulary: prompt tokens, tmux-like
* pane chrome, process rows, command links, and a deliberately different narrow
* combat composition.
*/
/* Syntax roles ------------------------------------------------------------ */
.kernel-ui .syntax-prompt { color: var(--kp-success); }
.kernel-ui .syntax-command { color: var(--kp-cyan); -unity-font-style: bold; }
.kernel-ui .syntax-argument { color: var(--kp-text); }
.kernel-ui .syntax-option { color: var(--kp-amber); }
.kernel-ui .syntax-path { color: var(--kp-beneficial); }
.kernel-ui .syntax-number { color: var(--kp-lang-javascript); }
.kernel-ui .syntax-comment { color: var(--kp-primary-dim); }
.kernel-ui .syntax-output { color: var(--kp-muted); }
.kernel-ui .syntax-warning { color: var(--kp-warning); }
.kernel-ui .syntax-error { color: var(--kp-danger); }
/* The command line is the stable interaction anchor in combat. */
.kernel-ui .combat-command-prompt {
flex-direction: row;
align-items: center;
flex-wrap: wrap;
flex-grow: 1;
min-width: 320px;
min-height: 28px;
margin-left: 8px;
padding: 2px 8px;
border-width: 0 0 0 2px;
border-left-color: var(--kp-cyan);
background-color: var(--kp-bg-deep);
white-space: normal;
}
.kernel-ui .combat-command-prompt > Label { margin-right: 9px; }
.kernel-ui .combat-command-prompt .syntax-output {
flex-grow: 1;
min-width: 140px;
-unity-text-align: middle-right;
}
.kernel-ui.combat-awaiting-target .combat-command-prompt { border-left-color: var(--kp-amber); }
.kernel-ui.combat-awaiting-target .combat-command-prompt .syntax-command,
.kernel-ui.combat-awaiting-target .combat-command-prompt .syntax-argument { color: var(--kp-amber); }
.kernel-ui.combat-resolving .combat-command-prompt { border-left-color: var(--kp-lang-haskell); }
/* Process monitor --------------------------------------------------------- */
.kernel-ui .process-table-header,
.kernel-ui .process-row-primary {
width: 100%;
min-width: 0;
flex-direction: row;
align-items: center;
}
.kernel-ui .process-table-header {
min-height: 28px;
padding: 4px 8px;
border-width: 0 0 1px;
border-bottom-color: var(--kp-border-strong);
background-color: var(--kp-panel-track);
}
.kernel-ui .process-column {
flex-shrink: 0;
color: var(--kp-primary-dim);
font-size: var(--type-meta);
-unity-font-style: bold;
white-space: nowrap;
}
.kernel-ui .process-col-pid { width: 6%; min-width: 50px; }
.kernel-ui .process-col-state { width: 15%; min-width: 100px; }
.kernel-ui .process-col-name { width: 25%; min-width: 150px; flex-grow: 0; flex-shrink: 1; }
.kernel-ui .process-col-uptime { width: 16%; min-width: 100px; }
.kernel-ui .process-col-shield { width: 8%; min-width: 45px; }
.kernel-ui .process-col-intent { width: 17%; min-width: 110px; }
.kernel-ui .process-col-result { width: 13%; min-width: 60px; }
.kernel-ui .enemy-row {
width: 100%;
flex-direction: column;
flex-wrap: nowrap;
align-items: stretch;
}
.kernel-ui .enemy-card {
width: 100%;
min-height: 52px;
margin: 0;
padding: 0;
flex-shrink: 0;
border-width: 0 0 1px 3px;
border-left-color: transparent;
border-bottom-color: var(--kp-border-subtle);
background-color: transparent;
-unity-text-align: middle-left;
}
.kernel-ui .enemy-card:hover,
.kernel-ui .enemy-card:focus {
border-left-color: var(--kp-text);
border-bottom-color: var(--kp-border-strong);
background-color: var(--kp-hover);
}
.kernel-ui .enemy-card-targeted,
.kernel-ui .enemy-targetable:focus {
border-left-color: var(--kp-amber);
background-color: var(--kp-panel-targeted);
}
.kernel-ui .enemy-targetable { border-top-width: 0; border-left-color: var(--kp-amber); }
.kernel-ui .process-row-primary { min-height: 50px; padding: 5px 8px; }
.kernel-ui .process-pid { color: var(--kp-primary-dim); font-size: var(--type-meta); }
.kernel-ui .process-state { color: var(--kp-success); font-size: var(--type-meta); margin: 0; min-height: 0; }
.kernel-ui .enemy-name { color: var(--kp-text); font-size: var(--type-body); min-height: 0; margin: 0; white-space: normal; }
.kernel-ui .process-col-uptime.meter-block { margin: 0; padding-right: 16px; }
.kernel-ui .process-col-uptime .meter-head { margin-bottom: 2px; }
.kernel-ui .process-col-uptime .metric-label { display: none; }
.kernel-ui .process-col-uptime .metric-value { font-size: var(--type-meta); }
.kernel-ui .process-col-uptime .meter-track { height: 5px; border-width: 0; }
.kernel-ui .process-col-shield { color: var(--kp-cyan); font-size: var(--type-meta); min-height: 0; }
.kernel-ui .process-col-intent.process-intent-slot { min-height: 0; }
.kernel-ui .process-col-intent .intent-panel {
min-height: 0;
margin: 0;
padding: 0;
border-width: 0;
background-color: transparent;
}
.kernel-ui .process-col-intent .intent-heading { justify-content: flex-start; }
.kernel-ui .process-col-intent .intent-label { display: none; }
.kernel-ui .process-col-intent .intent-value { font-size: var(--type-section); }
.kernel-ui .process-col-intent .intent-description { font-size: var(--type-meta); }
.kernel-ui .process-result {
min-height: 20px;
color: var(--kp-muted);
font-size: var(--type-meta);
-unity-font-style: bold;
white-space: normal;
}
.kernel-ui .process-result-damage,
.kernel-ui .process-result-kill { color: var(--kp-danger); }
.kernel-ui .process-result-shield { color: var(--kp-cyan); }
.kernel-ui .process-result-heal { color: var(--kp-success); }
.kernel-ui .process-result-status { color: var(--kp-warning); }
.kernel-ui .process-row-detail {
display: none;
width: 100%;
min-width: 0;
flex-direction: row;
flex-wrap: wrap;
padding: 0 8px 7px 270px;
color: var(--kp-muted);
font-size: var(--type-meta);
}
.kernel-ui .enemy-card:hover .process-row-detail,
.kernel-ui .enemy-card:focus .process-row-detail,
.kernel-ui .enemy-card-targeted .process-row-detail { display: flex; }
.kernel-ui .enemy-card:hover .process-row-detail-empty,
.kernel-ui .enemy-card:focus .process-row-detail-empty,
.kernel-ui .enemy-card-targeted .process-row-detail-empty { display: none; }
.kernel-ui .process-row-detail > * { margin-right: 12px; }
/* Progressive disclosure keeps the default playfield focused on decisions. */
.kernel-ui .scheduler-idle .track-zone { display: none; }
.kernel-ui .scheduler-idle .panel-header { margin-bottom: 0; }
.kernel-ui .hand-card .software-line-number { display: none; }
.kernel-ui .hand-card .software-live-preview,
.kernel-ui .hand-card .software-live-crit { display: none; }
.kernel-ui .hand-card:focus .software-live-preview,
.kernel-ui .hand-card:focus .software-live-crit,
.kernel-ui .hand-card-selected .software-live-preview,
.kernel-ui .hand-card-selected .software-live-crit { display: flex; }
/* Repository manifests show the decisive first sentence until details are requested. */
.kernel-ui .repository-card-collapsible .software-conditions { display: none; }
.kernel-ui .repository-card-collapsible.repository-card-expanded .software-conditions { display: flex; }
.kernel-ui .repository-rules-toggle {
width: 100%;
min-height: 28px;
margin: 5px 0 0;
padding: 3px 7px;
border-width: 0 0 0 2px;
border-left-color: var(--kp-border-strong);
background-color: transparent;
color: var(--kp-muted);
font-size: var(--type-meta);
-unity-text-align: middle-left;
}
.kernel-ui .repository-rules-toggle:hover,
.kernel-ui .repository-rules-toggle:focus,
.kernel-ui .repository-rules-toggle.expanded { color: var(--kp-cyan); border-left-color: var(--kp-cyan); }
/* Narrow combat is a pane switcher, not a compressed desktop. */
.kernel-ui .combat-pane-tabs { display: none; }
.kernel-ui.narrow .combat-pane-tabs {
display: flex;
flex-direction: row;
flex-shrink: 0;
min-height: 34px;
border-bottom-width: 1px;
border-bottom-color: var(--kp-border);
background-color: var(--kp-panel-track);
}
.kernel-ui .combat-pane-tab {
flex-grow: 1;
flex-basis: 0;
min-width: 0;
min-height: 34px;
margin: 0;
padding: 5px 3px;
border-width: 0 0 2px;
border-bottom-color: transparent;
background-color: transparent;
color: var(--kp-muted);
font-size: var(--type-meta);
-unity-text-align: middle-center;
}
.kernel-ui .combat-pane-tab.selected {
color: var(--kp-amber);
border-bottom-color: var(--kp-amber);
background-color: var(--kp-hover);
}
.kernel-ui.narrow.combat-pane-filtered.combat-pane-processes .scheduler,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-processes .bottom-layout,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-processes .combat-journal,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-scheduler .combat-workspace,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-scheduler .bottom-layout,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-scheduler .combat-journal,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-hand .combat-workspace,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-hand .scheduler,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-hand .combat-journal,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-log .combat-workspace,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-log .scheduler,
.kernel-ui.narrow.combat-pane-filtered.combat-pane-log .bottom-layout { display: none; }
.kernel-ui.narrow.combat-pane-scheduler .scheduler,
.kernel-ui.narrow.combat-pane-log .combat-journal,
.kernel-ui.narrow.combat-pane-hand .bottom-layout { flex-grow: 1; min-height: 0; }
.kernel-ui.narrow.combat-pane-log .combat-journal { flex-direction: column; }
.kernel-ui.narrow.combat-pane-log .journal-scroll { flex-grow: 1; max-height: none; }
.kernel-ui.narrow.combat-pane-hand .bottom-layout { height: auto; }
.kernel-ui.narrow.combat-pane-hand .hand-panel { height: auto; flex-grow: 1; }
.kernel-ui.narrow .combat-command-prompt {
width: 100%;
min-width: 0;
margin: 4px 0 0;
padding: 2px 6px;
}
.kernel-ui.narrow .combat-command-prompt .syntax-output {
display: none;
min-width: 0;
-unity-text-align: middle-left;
}
.kernel-ui.short-screen .combat-command-prompt { display: none; }
.kernel-ui.narrow .process-table-header .process-col-uptime,
.kernel-ui.narrow .process-table-header .process-col-shield,
.kernel-ui.narrow .process-table-header .process-col-intent,
.kernel-ui.narrow .process-table-header .process-col-result { display: none; }
.kernel-ui.narrow .process-col-pid { width: 50px; min-width: 50px; }
.kernel-ui.narrow .process-col-state { width: 84px; min-width: 84px; }
.kernel-ui.narrow .process-col-name { min-width: 0; }
.kernel-ui.narrow .process-row-primary { flex-wrap: wrap; }
.kernel-ui.narrow .process-row-primary .process-col-uptime {
width: 48%;
min-width: 120px;
margin: 5px 2% 0 134px;
}
.kernel-ui.narrow .process-row-primary .process-col-shield { width: 22%; min-width: 70px; margin-top: 5px; }
.kernel-ui.narrow .process-row-primary .process-col-intent { width: 28%; min-width: 82px; margin-top: 5px; }
.kernel-ui.narrow .process-row-primary .process-col-result { width: 100%; min-width: 0; padding-left: 134px; }
.kernel-ui.narrow .process-row-detail { padding-left: 8px; }
/* Terminal result screens ------------------------------------------------- */
.kernel-ui .death-content {
border-width: 1px 0 0 3px;
border-left-color: var(--kp-danger);
border-top-color: var(--kp-border);
background-color: var(--kp-bg-solid);
}
.kernel-ui .run-victory .death-content { border-left-color: var(--kp-success); }
.kernel-ui .death-eyebrow { color: var(--kp-cyan); }
.kernel-ui .death-exit-code { color: var(--kp-warning); margin-bottom: 8px; white-space: normal; }
.kernel-ui .run-victory .death-exit-code { color: var(--kp-success); }
.kernel-ui .death-return-action { -unity-text-align: middle-left; }
.kernel-ui.short-screen .death-content { padding: 12px; }
.kernel-ui.short-screen .death-report-header { margin-bottom: 7px; }
.kernel-ui.short-screen .death-content .overlay-title { font-size: 30px; margin-bottom: 4px; }
.kernel-ui.short-screen .death-session { margin-bottom: 8px; }
.kernel-ui.short-screen .death-wave-stats { margin-bottom: 8px; padding-top: 7px; padding-bottom: 7px; }
.kernel-ui.short-screen .death-rewards { padding-bottom: 6px; }
.kernel-ui.short-screen .death-next-run { margin-top: 5px; }
.kernel-ui.short-screen .death-return-action { margin-top: 8px; min-height: 36px; }
+78 -14
View File
@@ -26,13 +26,24 @@ namespace KernelPanic.Meta
/// <summary>One persistent, rolling 24-hour window. All time comes from the caller for deterministic tests.</summary>
public static class DailyQuests
{
public const int Count = 3;
public const int Count = 5;
public const int CompletionBonusBandwidth = 250;
public const int CompletionBonusEntropy = 125;
public const int CompletionBonusCommits = 2;
public const long PeriodTicks = TimeSpan.TicksPerDay;
public static readonly IReadOnlyList<DailyQuestKind> Pool = Array.AsReadOnly((DailyQuestKind[])Enum.GetValues(typeof(DailyQuestKind)));
private static readonly DailyQuestKind[] LegacySelection = { DailyQuestKind.Waves, DailyQuestKind.Cards, DailyQuestKind.Damage };
private const int CompletionBonusBit = 1 << 8;
private static readonly DailyQuestKind[] FallbackSelection =
{
DailyQuestKind.Waves,
DailyQuestKind.Cards,
DailyQuestKind.Damage,
DailyQuestKind.BlockDamage,
DailyQuestKind.NativeCards
};
public static IReadOnlyList<DailyQuestKind> Active(DailyQuestState state) =>
ValidSelection(state.selectedQuests) ? state.selectedQuests : LegacySelection;
ValidSelection(state.selectedQuests) ? state.selectedQuests : FallbackSelection;
public static bool IsActive(DailyQuestState state, DailyQuestKind kind)
{
@@ -51,6 +62,28 @@ namespace KernelPanic.Meta
return true;
}
private static bool EnsureFiveQuestSelection(DailyQuestState state)
{
if (ValidSelection(state.selectedQuests)) return false;
var expanded = new List<DailyQuestKind>(Count);
if (state.selectedQuests != null)
{
foreach (var kind in state.selectedQuests)
{
if (!Enum.IsDefined(typeof(DailyQuestKind), kind) || expanded.Contains(kind)) continue;
expanded.Add(kind);
if (expanded.Count == Count) break;
}
}
foreach (var kind in Pool)
{
if (!expanded.Contains(kind)) expanded.Add(kind);
if (expanded.Count == Count) break;
}
state.selectedQuests = expanded.ToArray();
return true;
}
private static void PickQuests(DailyQuestState state)
{
if (state.selectionSeed == 0)
@@ -101,6 +134,20 @@ namespace KernelPanic.Meta
_ => throw new ArgumentOutOfRangeException(nameof(kind))
};
// Commits are earned by objectives that represent sustained play or a run milestone.
public static int CommitReward(DailyQuestKind kind) => kind switch
{
DailyQuestKind.Waves => 1,
DailyQuestKind.ShieldDamage => 1,
DailyQuestKind.SurviveRounds => 1,
DailyQuestKind.WaveFive => 2,
DailyQuestKind.Cards => 0,
DailyQuestKind.NativeCards => 0,
DailyQuestKind.Damage => 0,
DailyQuestKind.BlockDamage => 0,
_ => throw new ArgumentOutOfRangeException(nameof(kind))
};
public static string Description(DailyQuestKind kind) => kind switch
{
DailyQuestKind.Waves => "Clear 3 waves",
@@ -130,19 +177,25 @@ namespace KernelPanic.Meta
public static bool Claimed(DailyQuestState state, DailyQuestKind kind) =>
(state.claimedMask & (1 << (int)kind)) != 0;
public static bool CompletionBonusClaimed(DailyQuestState state) =>
(state.claimedMask & CompletionBonusBit) != 0;
public static bool AllClaimed(DailyQuestState state)
{
foreach (var kind in Active(state)) if (!Claimed(state, kind)) return false;
return true;
}
public static bool Refresh(DailyQuestState state, DateTime utcNow)
{
long now = utcNow.ToUniversalTime().Ticks;
if (state.refreshAtUtcTicks > now && state.refreshAtUtcTicks <= DateTime.MaxValue.Ticks)
{
if (ValidSelection(state.selectedQuests)) return false;
// Schema 7 had three fixed quests. Preserve that day's progress and rewards.
state.selectedQuests = (DailyQuestKind[])LegacySelection.Clone();
return true;
// Expand older three-task periods in place so their progress and claims survive migration.
return EnsureFiveQuestSelection(state);
}
// Advance by whole periods, retaining the original reset time even after days away.
if (state.refreshAtUtcTicks > 0 && !ValidSelection(state.selectedQuests))
state.selectedQuests = (DailyQuestKind[])LegacySelection.Clone();
if (state.refreshAtUtcTicks > 0) EnsureFiveQuestSelection(state);
state.refreshAtUtcTicks = state.refreshAtUtcTicks > 0 && state.refreshAtUtcTicks <= now
? state.refreshAtUtcTicks + ((now - state.refreshAtUtcTicks) / PeriodTicks + 1) * PeriodTicks
: now + PeriodTicks;
@@ -181,11 +234,22 @@ namespace KernelPanic.Meta
if (!Enum.IsDefined(typeof(DailyQuestKind), kind) || !IsActive(data.dailyQuests, kind) || data.dailyQuests.refreshAtUtcTicks != expectedRefresh
|| Claimed(data.dailyQuests, kind) || Progress(data.dailyQuests, kind) < Target(kind)) return false;
var reward = Reward(kind);
if (data.bandwidthBalance > int.MaxValue - reward.Bandwidth
|| data.entropyBalance > int.MaxValue - reward.Entropy) return false;
data.dailyQuests.claimedMask |= 1 << (int)kind;
data.bandwidthBalance += reward.Bandwidth;
data.entropyBalance += reward.Entropy;
int commits = CommitReward(kind);
int questBit = 1 << (int)kind;
int nextMask = data.dailyQuests.claimedMask | questBit;
bool awardsCompletionBonus = !CompletionBonusClaimed(data.dailyQuests);
foreach (var activeKind in Active(data.dailyQuests))
awardsCompletionBonus &= (nextMask & (1 << (int)activeKind)) != 0;
int bandwidth = reward.Bandwidth + (awardsCompletionBonus ? CompletionBonusBandwidth : 0);
int entropy = reward.Entropy + (awardsCompletionBonus ? CompletionBonusEntropy : 0);
int totalCommits = commits + (awardsCompletionBonus ? CompletionBonusCommits : 0);
if (data.bandwidthBalance > int.MaxValue - bandwidth
|| data.entropyBalance > int.MaxValue - entropy
|| data.commitsBalance > int.MaxValue - totalCommits) return false;
data.dailyQuests.claimedMask = nextMask | (awardsCompletionBonus ? CompletionBonusBit : 0);
data.bandwidthBalance += bandwidth;
data.entropyBalance += entropy;
data.commitsBalance += totalCommits;
return true;
}
+28
View File
@@ -32,4 +32,32 @@ namespace KernelPanic.Meta
guaranteedDistroIds ??= new List<string>();
}
}
/// <summary>Persistent, bounded receipt rendered by <c>git log --pulls</c>.</summary>
[Serializable]
public sealed class GachaPullHistoryEntry
{
public string pulledUtc;
public string bannerId;
public int currencySpent;
public int entropySpent;
public List<GachaPullHistoryRewardEntry> rewards = new();
public void EnsureLists()
{
rewards ??= new List<GachaPullHistoryRewardEntry>();
}
}
[Serializable]
public sealed class GachaPullHistoryRewardEntry
{
public int stars;
public string displayName;
public GachaRewardType rewardType;
public PullOutcomeKind outcomeKind;
public int duplicateValue;
public bool guaranteed;
public bool pityTriggered;
}
}
+191 -1
View File
@@ -17,7 +17,11 @@ namespace KernelPanic.Meta
public const int BeginnerTenPullCost = 8;
public const int StandardSinglePullCost = 1;
public const int StandardTenPullCost = 10;
public const int LimitedSinglePullCost = 1;
public const int LimitedTenPullCost = 10;
public const int StandardFiveStarSelectorInterval = 200;
public const int MaxPullHistoryEntries = 100;
public const string LimitedFeaturedFiveStarDistroId = "nixos";
public const int FourStarHardPity = 10;
public const int FiveStarSoftPityStart = 66;
public const int FiveStarHardPity = 80;
@@ -32,10 +36,12 @@ namespace KernelPanic.Meta
private const double LimitedStandardFiveStarChance = 1d / 3d;
private readonly List<DistroDefinition> _bannerPool = new();
private readonly List<GachaPullHistoryEntry> _pullHistory = new();
private readonly Dictionary<GachaCurrencyType, int> _currencyBalances = new();
private readonly Random _random;
private GachaBannerState _beginnerState = new(BeginnerBannerId);
private GachaBannerState _standardState = new(StandardBannerId);
private GachaBannerState _limitedState = new(LimitedBannerId);
public GachaService()
: this(new Random())
@@ -54,6 +60,8 @@ namespace KernelPanic.Meta
public IReadOnlyList<DistroDefinition> BannerPool => _bannerPool;
public GachaBannerState BeginnerState => _beginnerState;
public GachaBannerState StandardState => _standardState;
public GachaBannerState LimitedState => _limitedState;
public IReadOnlyList<GachaPullHistoryEntry> PullHistory => _pullHistory;
public bool IsBeginnerBannerAvailable => !_beginnerState.exhausted && _beginnerState.totalPulls < BeginnerMaxPulls && _bannerPool.Count > 0;
public int PendingStandardFiveStarSelectors => Math.Max(0, _standardState.totalPulls / StandardFiveStarSelectorInterval - _standardState.fiveStarSelectorsClaimed);
@@ -86,6 +94,19 @@ namespace KernelPanic.Meta
_standardState.fiveStarPityCounter = Math.Max(0, _standardState.fiveStarPityCounter);
_standardState.fiveStarSelectorsClaimed = Math.Max(0, _standardState.fiveStarSelectorsClaimed);
_limitedState = data.limitedBannerState ?? new GachaBannerState(LimitedBannerId);
_limitedState.bannerId = LimitedBannerId;
_limitedState.EnsureLists();
_limitedState.pityCounter = Math.Max(0, _limitedState.pityCounter);
_limitedState.fiveStarPityCounter = Math.Max(0, _limitedState.fiveStarPityCounter);
_pullHistory.Clear();
for (int i = 0; i < data.gachaPullHistory.Count && i < MaxPullHistoryEntries; i++)
{
GachaPullHistoryEntry entry = CloneHistoryEntry(data.gachaPullHistory[i]);
if (entry != null) _pullHistory.Add(entry);
}
Changed?.Invoke();
}
@@ -101,6 +122,10 @@ namespace KernelPanic.Meta
data.commitsBalance = GetCurrencyBalance(GachaCurrencyType.StandardPull);
data.beginnerBannerState = CloneState(_beginnerState);
data.standardBannerState = CloneState(_standardState);
data.limitedBannerState = CloneState(_limitedState);
data.gachaPullHistory.Clear();
for (int i = 0; i < _pullHistory.Count && i < MaxPullHistoryEntries; i++)
data.gachaPullHistory.Add(CloneHistoryEntry(_pullHistory[i]));
}
public int GetCurrencyBalance(GachaCurrencyType currencyType)
@@ -235,7 +260,7 @@ namespace KernelPanic.Meta
return false;
}
}
else if (bannerId != StandardBannerId)
else if (bannerId != StandardBannerId && bannerId != LimitedBannerId)
{
failureReason = $"banner '{bannerId}' not implemented yet";
return false;
@@ -271,6 +296,11 @@ namespace KernelPanic.Meta
return pullCount == 10 ? StandardTenPullCost : StandardSinglePullCost;
}
if (bannerId == LimitedBannerId)
{
return pullCount == 10 ? LimitedTenPullCost : LimitedSinglePullCost;
}
return pullCount;
}
@@ -370,6 +400,64 @@ namespace KernelPanic.Meta
return new GachaPullResult(true, StandardBannerId, GachaCurrencyType.StandardPull, commitSpend, entropySpent, rewards, null);
}
public GachaPullResult PerformLimitedPull(int pullCount, EntropyWallet wallet, PullPaymentSource source)
{
if (!CanAffordPull(pullCount, wallet, source, LimitedBannerId, out string failureReason))
{
return GachaPullResult.Failed(LimitedBannerId, failureReason);
}
if (!PayForPull(pullCount, wallet, source, LimitedBannerId, out int commitSpend, out int entropySpent, out failureReason))
{
return GachaPullResult.Failed(LimitedBannerId, failureReason);
}
List<GachaReward> rewards = new();
for (int i = 0; i < pullCount; i++)
{
_limitedState.totalPulls++;
rewards.Add(RollLimitedReward(_limitedState));
}
Changed?.Invoke();
return new GachaPullResult(true, LimitedBannerId, GachaCurrencyType.StandardPull, commitSpend, entropySpent, rewards, null);
}
public void RecordPullHistory(GachaPullResult result, IReadOnlyList<CompletedGachaReward> completedRewards, DateTime utcNow)
{
if (!result.Success || completedRewards == null || completedRewards.Count == 0)
{
return;
}
GachaPullHistoryEntry entry = new()
{
pulledUtc = utcNow.ToUniversalTime().ToString("O"),
bannerId = result.BannerId,
currencySpent = Math.Max(0, result.CurrencySpent),
entropySpent = Math.Max(0, result.EntropySpent)
};
for (int i = 0; i < completedRewards.Count; i++)
{
CompletedGachaReward reward = completedRewards[i];
entry.rewards.Add(new GachaPullHistoryRewardEntry
{
stars = reward.Stars,
displayName = reward.DisplayName,
rewardType = reward.RewardType,
outcomeKind = reward.OutcomeKind,
duplicateValue = reward.MergesAwarded,
guaranteed = reward.Guaranteed,
pityTriggered = reward.PityTriggered
});
}
_pullHistory.Insert(0, entry);
if (_pullHistory.Count > MaxPullHistoryEntries)
_pullHistory.RemoveRange(MaxPullHistoryEntries, _pullHistory.Count - MaxPullHistoryEntries);
Changed?.Invoke();
}
public int GetStandardFiveStarSelectorProgress()
{
return _standardState.totalPulls % StandardFiveStarSelectorInterval;
@@ -526,6 +614,50 @@ namespace KernelPanic.Meta
return GachaReward.Package(4, "4-star package", pityTriggered, false);
}
private GachaReward RollLimitedReward(GachaBannerState state)
{
if (TryRollFiveStar(state, out bool fiveStarPityTriggered))
{
if (!ResolveFeaturedTierIsDistro())
{
return GachaReward.Package(5, "5-star package", fiveStarPityTriggered, false);
}
bool featuredWasGuaranteed = state.featuredFiveStarGuaranteed;
bool useStandardPool = ResolveLimitedFiveStarUsesStandardPool(state);
DistroDefinition distro = useStandardPool
? FindRandomBannerPoolDistroByStarsExcept(5, LimitedFeaturedFiveStarDistroId)
: FindBannerPoolDistroByStars(LimitedFeaturedFiveStarDistroId, 5) ?? FindRandomBannerPoolDistroByStars(5);
if (distro == null)
{
return GachaReward.Package(5, "5-star package", fiveStarPityTriggered, false);
}
return GachaReward.DistroReward(distro, 5, fiveStarPityTriggered, featuredWasGuaranteed,
featuredWasGuaranteed ? "feature-branch guarantee" : null);
}
bool pityTriggered = state.pityCounter >= FourStarHardPity - 1;
bool hitFourStar = pityTriggered || _random.NextDouble() < FourStarBaseChance;
if (!hitFourStar)
{
state.pityCounter++;
return GachaReward.Package(3, "3-star package", false, false);
}
state.pityCounter = 0;
if (ResolveFeaturedTierIsDistro())
{
DistroDefinition distro = FindLimitedFourStarDistro();
if (distro != null)
{
return GachaReward.DistroReward(distro, 4, pityTriggered, false);
}
}
return GachaReward.Package(4, "4-star package", pityTriggered, false);
}
private bool TryRollFiveStar(GachaBannerState state, out bool pityTriggered)
{
state ??= _beginnerState;
@@ -668,6 +800,35 @@ namespace KernelPanic.Meta
return eligible.Count == 0 ? null : eligible[_random.Next(eligible.Count)];
}
private DistroDefinition FindRandomBannerPoolDistroByStarsExcept(int stars, string excludedId)
{
List<DistroDefinition> eligible = new();
for (int i = 0; i < _bannerPool.Count; i++)
{
DistroDefinition distro = _bannerPool[i];
if (distro != null && GetDistroStars(distro) == stars
&& !string.Equals(distro.Id, excludedId, StringComparison.OrdinalIgnoreCase))
{
eligible.Add(distro);
}
}
return eligible.Count == 0 ? FindRandomBannerPoolDistroByStars(stars) : eligible[_random.Next(eligible.Count)];
}
private DistroDefinition FindLimitedFourStarDistro()
{
string[] featured = { "fedora", "ubuntu" };
List<DistroDefinition> eligible = new();
for (int i = 0; i < featured.Length; i++)
{
DistroDefinition distro = FindBannerPoolDistroByStars(featured[i], 4);
if (distro != null) eligible.Add(distro);
}
return eligible.Count == 0 ? FindRandomBannerPoolDistroByStars(4) : eligible[_random.Next(eligible.Count)];
}
private static int GetDistroStars(DistroDefinition distro)
{
return DistroRarity.Stars(distro);
@@ -694,6 +855,35 @@ namespace KernelPanic.Meta
clone.guaranteedDistroIds.AddRange(state.guaranteedDistroIds);
return clone;
}
private static GachaPullHistoryEntry CloneHistoryEntry(GachaPullHistoryEntry source)
{
if (source == null || string.IsNullOrWhiteSpace(source.bannerId)) return null;
source.EnsureLists();
GachaPullHistoryEntry clone = new()
{
pulledUtc = source.pulledUtc,
bannerId = source.bannerId,
currencySpent = Math.Max(0, source.currencySpent),
entropySpent = Math.Max(0, source.entropySpent)
};
for (int i = 0; i < source.rewards.Count; i++)
{
GachaPullHistoryRewardEntry reward = source.rewards[i];
if (reward == null) continue;
clone.rewards.Add(new GachaPullHistoryRewardEntry
{
stars = Math.Max(3, reward.stars),
displayName = reward.displayName,
rewardType = reward.rewardType,
outcomeKind = reward.outcomeKind,
duplicateValue = Math.Max(0, reward.duplicateValue),
guaranteed = reward.guaranteed,
pityTriggered = reward.pityTriggered
});
}
return clone;
}
}
/// <summary>
+21 -1
View File
@@ -16,7 +16,7 @@ namespace KernelPanic.Meta
public sealed class SaveService
{
private const string SaveFileName = "kernel-panic-save.json";
public const int CurrentSchemaVersion = 10;
public const int CurrentSchemaVersion = 11;
private static readonly object FileLock = new();
public string SavePath { get; }
@@ -300,6 +300,8 @@ namespace KernelPanic.Meta
public List<string> bannerPoolIds = new();
public GachaBannerState beginnerBannerState = new(GachaService.BeginnerBannerId);
public GachaBannerState standardBannerState = new(GachaService.StandardBannerId);
public GachaBannerState limitedBannerState = new(GachaService.LimitedBannerId);
public List<GachaPullHistoryEntry> gachaPullHistory = new();
public LastRunLoadoutSaveEntry lastRunLoadout = new();
public List<RunBuildDraftSaveEntry> runBuildDrafts = new();
public string lastSetupDistroId;
@@ -344,6 +346,24 @@ namespace KernelPanic.Meta
standardBannerState ??= new GachaBannerState(GachaService.StandardBannerId);
standardBannerState.bannerId = GachaService.StandardBannerId;
standardBannerState.EnsureLists();
limitedBannerState ??= new GachaBannerState(GachaService.LimitedBannerId);
limitedBannerState.bannerId = GachaService.LimitedBannerId;
limitedBannerState.EnsureLists();
gachaPullHistory ??= new List<GachaPullHistoryEntry>();
for (int i = gachaPullHistory.Count - 1; i >= 0; i--)
{
GachaPullHistoryEntry entry = gachaPullHistory[i];
if (entry == null || string.IsNullOrWhiteSpace(entry.bannerId))
{
gachaPullHistory.RemoveAt(i);
continue;
}
entry.EnsureLists();
}
if (gachaPullHistory.Count > GachaService.MaxPullHistoryEntries)
gachaPullHistory.RemoveRange(GachaService.MaxPullHistoryEntries,
gachaPullHistory.Count - GachaService.MaxPullHistoryEntries);
lastRunLoadout ??= new LastRunLoadoutSaveEntry();
lastRunLoadout.EnsureLists();
runBuildDrafts ??= new List<RunBuildDraftSaveEntry>();
+28 -41
View File
@@ -216,14 +216,9 @@ namespace KernelPanic.Run
string originalBuild = BuildSignature(combat.RunConfig);
var view = FindFirstObjectByType<CombatSceneController>();
var previewRoot = view.GetComponent<UIDocument>().rootVisualElement;
var executionPreview = previewRoot.Q<Button>("OpenExecutionPreview");
int drawsBeforePreview = RandomRoll.DrawCount;
Submit(executionPreview);
yield return null;
var previewContents = previewRoot.Q("ExecutionPreviewPopup") ?? executionPreview;
Require(RandomRoll.DrawCount == drawsBeforePreview && previewContents.Q<Label>(className: "terminal-body") != null,
"Execution preview changed RNG or did not render its explanation.");
Submit(previewRoot.Q<Button>("CloseExecutionPreview"));
Require(previewRoot.Q<Button>("OpenExecutionPreview") == null &&
previewRoot.Q<Button>("OpenTurnResolution") == null,
"Obsolete combat popup controls are still present.");
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-campaign-smoke"))
{
var campaign = CampaignScenario(combat, view);
@@ -493,15 +488,12 @@ namespace KernelPanic.Run
if (packageFixture)
{
yield return new WaitForSecondsRealtime(1);
var packagePanel = document.rootVisualElement.Q("CombatPackages");
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
var packageCapture = CapturePanel(document, "package-readiness");
while (packageCapture.MoveNext()) yield return packageCapture.Current;
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_timeshift", "Timeshift", "Full recovery notification with enough detail to overflow a narrow screen if it wraps"));
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_cinnamon", "Cinnamon", "JavaScript damage increased for this round"));
yield return null;
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
packageCapture = CapturePanel(document, "package-notification");
var hostPanel = document.rootVisualElement.Q(className: "player-panel");
hostPanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(hostPanel);
var packageCapture = CapturePanel(document, "package-notification");
while (packageCapture.MoveNext()) yield return packageCapture.Current;
}
// Isolated fixture gives the presentation time to display persistent state without ending the wave.
@@ -525,11 +517,9 @@ namespace KernelPanic.Run
Require(saveControl.worldBound.height > 0 && document.rootVisualElement.worldBound.Contains(saveControl.worldBound.min)
&& document.rootVisualElement.worldBound.Contains(saveControl.worldBound.max), "Planning save control is clipped.");
var capture = CapturePanel(document, "planning-save"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
Require(document.rootVisualElement.Q("ExecutionPreviewPopup") != null, "Preview dialog did not open.");
capture = CapturePanel(document, "execution-preview"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
Require(RandomRoll.DrawCount == draws, "Preview consumed randomness.");
Require(document.rootVisualElement.Q<Button>("OpenExecutionPreview") == null &&
document.rootVisualElement.Q("ExecutionPreviewPopup") == null,
"Execution preview should not interrupt combat.");
Submit(document.rootVisualElement.Q<Button>("SaveCombatButton"));
menu = null;
while (menu == null) { yield return null; menu = FindFirstObjectByType<MainMenuController>(); }
@@ -548,18 +538,17 @@ namespace KernelPanic.Run
Require(combat.Go.Active.Count == 1 && combat.Go.Active[0].RemainingTicks == 2, "Resumed goroutine did not tick exactly once.");
Require(combat.InterpreterQueue.Count == 0, "Resumed FIFO did not drain.");
_stage = "damage explanation";
Submit(document.rootVisualElement.Q<Button>("OpenTurnResolution"));
var resolution = document.rootVisualElement.Q("TurnResolutionPopup");
Require(resolution != null, "Results dialog did not open.");
capture = CapturePanel(document, "turn-resolution"); while (capture.MoveNext()) yield return capture.Current;
var explanation = resolution.Query<Foldout>().ToList().FirstOrDefault(f => f.text == "Damage calculation / recent hits");
Require(explanation != null, "Damage calculation foldout is missing."); explanation.value = true;
var journal = document.rootVisualElement.Q<Foldout>(className: "combat-journal");
Require(journal != null, "Combat journal is missing.");
journal.value = true;
yield return null;
capture = CapturePanel(document, "turn-journal"); while (capture.MoveNext()) yield return capture.Current;
var explanation = journal.Query<Foldout>(className: "journal-action-result").ToList()
.FirstOrDefault(f => f.Q<Label>(className: "journal-action-damage") != null);
Require(explanation != null, "Journal damage calculation is missing."); explanation.value = true;
yield return new WaitForSecondsRealtime(1);
Require(resolution.Q<ScrollView>("ResolutionActions").contentViewport.worldBound.height > 200, "Damage results viewport is too small.");
explanation.GetFirstAncestorOfType<ScrollView>()?.ScrollTo(explanation);
capture = CapturePanel(document, "damage-calculation"); while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("CloseTurnResolution"));
Require(document.rootVisualElement.Q("TurnResolutionPopup") == null, "Results dialog did not close.");
_stage = "deck analysis and upgrade comparison";
Field<System.Collections.Generic.List<EnemyInstance>>(combat, "_enemies").Clear(); Call(combat, "CheckWin");
while (!combat.AwaitingWaveContinue) yield return null;
@@ -706,14 +695,13 @@ namespace KernelPanic.Run
capturedResolution = true;
var trace = Field<CombatExecutionTrace>(view, "_executionTrace");
Require(trace.Actions.Count > 0 && trace.Actions.Any(a => a.Complete), "Practice has no observed resolution results.");
var resolution = root.Q<Button>("OpenTurnResolution");
Require(resolution != null, "Turn-resolution view is missing.");
Submit(resolution);
for (int frame = 0; frame < 4; frame++) yield return null;
var journal = root.Q<Foldout>(className: "combat-journal");
Require(journal != null, "Combat journal is missing.");
journal.value = true;
for (int frame = 0; frame < 4; frame++) yield return null;
var capture = CapturePanel(document, "training-" + language + "-resolution");
while (capture.MoveNext()) yield return capture.Current;
Submit(root.Q<Button>("CloseTurnResolution"));
journal.value = false;
}
if (combat.PendingGoroutineCard != null)
{
@@ -1121,16 +1109,13 @@ namespace KernelPanic.Run
while (capture.MoveNext()) yield return capture.Current;
var widget = root.Q<Button>("DailyQuestWidget");
var homeScroll = root.Q<ScrollView>(className: "home-scroll");
if (Screen.width >= 1280)
Require(widget.worldBound.yMax <= homeScroll.contentViewport.worldBound.yMax + 1,
"Quest widget must fit below neofetch without scrolling at 1280x720.");
else
if (widget.worldBound.yMax > homeScroll.contentViewport.worldBound.yMax + 1)
{
homeScroll.ScrollTo(widget);
capture = CapturePanel(document, "quest-widget");
while (capture.MoveNext()) yield return capture.Current;
}
Require(root.Q<Label>("DailyQuestCompleted").text == "1/3 completed", "Quest fixture progress is wrong.");
Require(root.Q<Label>("DailyQuestCompleted").text == "1/5 completed", "Quest fixture progress is wrong.");
Require(root.Q<Label>("DailyQuestRewardReady").text == "1 reward ready"
&& root.Q<Label>("DailyQuestInspect").text == "> claim available rewards", "Claimable widget feedback is wrong.");
var widgetPosition = widget.worldBound.center;
@@ -1145,6 +1130,7 @@ namespace KernelPanic.Run
var saved = new SaveService().Load();
var reward = DailyQuests.Reward(DailyQuestKind.Waves);
Require(saved.bandwidthBalance == reward.Bandwidth && saved.entropyBalance == reward.Entropy
&& saved.commitsBalance == DailyQuests.CommitReward(DailyQuestKind.Waves)
&& !root.Q<Button>("ClaimDailyQuestWaves").enabledSelf, "Quest claim did not commit exactly once.");
Require(root.Q<Button>("ClaimDailyQuestWaves").text == "[ CLAIMED ]"
&& root.Q<Label>("DailyQuestFeedback").text.Contains($"+{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited."),
@@ -1229,10 +1215,11 @@ namespace KernelPanic.Run
if (!capturedPreview && combat.InterpreterQueue.Count > 0)
{
capturedPreview = true;
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
var capture = CapturePanel(document, "execution-preview");
var journal = document.rootVisualElement.Q<Foldout>(className: "combat-journal");
journal.value = true;
var capture = CapturePanel(document, "combat-journal");
while (capture.MoveNext()) yield return capture.Current;
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
journal.value = false;
}
if (run.CurrentWaveNumber == RunJourney.BossWave && !capturedBoss)
{
+2 -1
View File
@@ -32,6 +32,7 @@ namespace KernelPanic.Run
public int bits;
public int bandwidth;
public int entropy;
public int commits;
public int maxUptimeBonus;
public int maxCyclesBonus;
public int ramBonus;
@@ -77,7 +78,7 @@ namespace KernelPanic.Run
}
Require(Guid.TryParseExact(runId, "N", out _), "Invalid run identity.");
Require(wave >= (fullCombat == null ? 2 : 1) && wave <= 100000 && wavesCleared == wave - 1, "Invalid checkpoint wave.");
Require(bits >= 0 && bandwidth >= 0 && entropy >= 0 && rerolls >= 0, "Invalid checkpoint balances.");
Require(bits >= 0 && bandwidth >= 0 && entropy >= 0 && commits >= 0 && rerolls >= 0, "Invalid checkpoint balances.");
Require(maxUptimeBonus >= 0 && maxCyclesBonus >= 0 && ramBonus >= 0, "Invalid run upgrades.");
Require(shopRandomDraws >= 0 && shopRandomDraws <= 10000000, "Invalid shop random cursor.");
Require(Enum.IsDefined(typeof(Language), primaryLanguage) && Enum.IsDefined(typeof(Language), secondaryLanguage)
+13 -2
View File
@@ -34,6 +34,7 @@ namespace KernelPanic.Run
private int _wavesCleared;
private int _accruedBandwidth;
private int _accruedEntropy;
private int _accruedCommits;
private bool _repositoryVisitActive;
private bool _rewardsSettled;
@@ -52,6 +53,7 @@ namespace KernelPanic.Run
public int WavesCleared => _wavesCleared;
public int AccruedBandwidth => _accruedBandwidth;
public int AccruedEntropy => _accruedEntropy;
public int AccruedCommits => _accruedCommits;
public bool RewardsSettled => _rewardsSettled;
public string RunId { get; private set; }
public bool IsSuspended { get; private set; }
@@ -242,6 +244,7 @@ namespace KernelPanic.Run
_wavesCleared = 0;
_accruedBandwidth = 0;
_accruedEntropy = 0;
_accruedCommits = 0;
_rewardsSettled = false;
ApplyKernelPackageBonuses(config);
InitializeRunDeck(config);
@@ -266,7 +269,7 @@ namespace KernelPanic.Run
startingCards = CurrentConfig.StartingDeck.Select(card => card.Id).ToList(),
deck = _runDeck.Select(CheckpointCard.Capture).ToList(), soldKeys = _soldOfferKeys.ToList(),
wave = currentWaveNumber, wavesCleared = _wavesCleared, bits = _bits,
bandwidth = _accruedBandwidth, entropy = _accruedEntropy,
bandwidth = _accruedBandwidth, entropy = _accruedEntropy, commits = _accruedCommits,
maxUptimeBonus = _maxUptimeBonus, maxCyclesBonus = _maxCyclesBonus, ramBonus = _ramBonus,
rerolls = _rerollsThisVisit, shopRandomDraws = _repositoryRandom.Draws,
version = 6, journey = Journey.Copy(), performance = Performance.Copy(),
@@ -307,6 +310,7 @@ namespace KernelPanic.Run
_bits = snapshot.bits;
_accruedBandwidth = snapshot.bandwidth;
_accruedEntropy = snapshot.entropy;
_accruedCommits = snapshot.commits;
_maxUptimeBonus = snapshot.maxUptimeBonus;
_maxCyclesBonus = snapshot.maxCyclesBonus;
_ramBonus = snapshot.ramBonus;
@@ -493,7 +497,7 @@ namespace KernelPanic.Run
}
_rewardsSettled = true;
return bandwidth > 0 || entropy > 0;
return bandwidth > 0 || entropy > 0 || _accruedCommits > 0;
}
public void MarkRunRewardsSettled()
@@ -536,6 +540,7 @@ namespace KernelPanic.Run
{
_accruedBandwidth += CalculateBandwidthReward(clearedWave);
_accruedEntropy += CalculateEntropyReward(clearedWave);
_accruedCommits += CalculateCommitReward(clearedWave);
}
currentWaveNumber = Mathf.Max(currentWaveNumber + 1, payload.WaveNumber + 1);
EnsureRouteSelection();
@@ -572,6 +577,12 @@ namespace KernelPanic.Run
return waveNumber >= CombatTuning.EntropyStartWave ? Mathf.Max(0, CombatTuning.EntropyPerWave) : 0;
}
private static int CalculateCommitReward(int waveNumber)
{
if (waveNumber <= 0 || waveNumber % 5 != 0) return 0;
return waveNumber == RunJourney.BossWave ? 2 : 1;
}
private void InitializeRunDeck(RunConfig config)
{
_runDeck.Clear();
+132 -74
View File
@@ -307,10 +307,20 @@ namespace KernelPanic.UI
return;
}
Label title = new("installed units");
title.AddToClassList("detail-section-title");
Label title = new("$ ls -lah ~/collection/units/");
title.AddToClassList("collection-ls-command");
_detail.Add(title);
Label total = new($"total {_units.Count}");
total.AddToClassList("collection-ls-total");
_detail.Add(total);
Label columns = new(LsText($"{"MODE",-12}{"OWNER",-8}{"SIZE",-6}{"VER",-6}{"LANG",-20}NAME"));
columns.AddToClassList("unit-ls-row");
columns.AddToClassList("unit-ls-line");
columns.AddToClassList("unit-ls-header");
_detail.Add(columns);
VisualElement roster = new();
roster.AddToClassList("unit-overview-roster");
_detail.Add(roster);
@@ -604,54 +614,51 @@ namespace KernelPanic.UI
private VisualElement BuildUnitOverviewRow(DistroDefinition unit)
{
int version = GetUnitVersion(unit);
string languages = unit.PrimaryLanguage == unit.SecondaryLanguage
? GetLanguageId(unit.PrimaryLanguage)
: $"{GetLanguageId(unit.PrimaryLanguage)}/{GetLanguageId(unit.SecondaryLanguage)}";
string upgradeMarker = CanUpgradeUnit(unit) ? " *" : string.Empty;
string listing = LsText($"{"drwxr-xr-x",-12}{"player",-8}{$"{GetDistroStars(unit)}★",-6}{$"{version}/{GachaTuning.MaxVersion}",-6}{languages,-20}{unit.Id}/{upgradeMarker}");
Button row = new();
row.AddToClassList("collection-row");
row.AddToClassList("unit-overview-row");
row.AddToClassList(RarityPresentation.ForStars(GetDistroStars(unit)).ClassName);
VisualElement top = new();
top.AddToClassList("unit-overview-top");
Label line = new(listing);
line.AddToClassList("unit-ls-line");
line.style.whiteSpace = WhiteSpace.NoWrap;
line.style.unityTextAlign = TextAnchor.MiddleLeft;
line.style.color = new StyleColor(unit.AccentColor);
row.Add(line);
Label name = new(DistroPresentation.DisplayName(unit));
name.AddToClassList("collection-row-name");
name.style.color = new StyleColor(unit.AccentColor);
top.Add(name);
RarityStyle rarity = RarityPresentation.ForStars(GetDistroStars(unit));
Label rarityLabel = new(rarity.Badge);
rarityLabel.AddToClassList("unit-overview-rarity");
rarityLabel.AddToClassList(rarity.ClassName);
top.Add(rarityLabel);
if (CanUpgradeUnit(unit))
{
Label upgrade = new("upgrade");
upgrade.AddToClassList("unit-overview-upgrade");
top.Add(upgrade);
}
row.Add(top);
VisualElement meta = new();
meta.AddToClassList("unit-overview-meta");
AddLanguageTag(meta, unit.PrimaryLanguage);
AddLanguageTag(meta, unit.SecondaryLanguage);
row.Add(meta);
int version = GetUnitVersion(unit);
Label release = new($"{DistroPresentation.DisplayName(unit)} {DistroVersionCatalog.GetReleaseLabel(unit.Id, version)} · v{version}/{GachaTuning.MaxVersion}");
release.AddToClassList("unit-overview-release");
row.Add(release);
VisualElement slots = new();
slots.AddToClassList("unit-overview-slots");
AddPackageSlotDot(slots, unit, PackageSlot.Kernel);
AddPackageSlotDot(slots, unit, PackageSlot.Runtime);
AddPackageSlotDot(slots, unit, PackageSlot.Daemon);
row.Add(slots);
string system = UnitPackageName(unit, PackageSlot.Kernel);
string tools = UnitPackageName(unit, PackageSlot.Runtime);
string services = UnitPackageName(unit, PackageSlot.Daemon);
Label packages = new($"└─ loadout system={system} tools={tools} services={services}");
packages.AddToClassList("unit-loadout-line");
row.Add(packages);
row.tooltip = $"System: {system}\nTools: {tools}\nServices: {services}";
return row;
}
private string UnitPackageName(DistroDefinition unit, PackageSlot slot)
{
PackageDefinition package = _packageLoadout == null || unit == null
? null
: _packageLoadout.GetEquippedPackage(unit.Id, slot);
return package == null ? "-" : PackageName(package);
}
private static string LsText(string value)
{
// UI Toolkit may wrap ordinary alignment spaces inside Button content.
// Non-breaking spaces preserve shell-style fixed columns at narrow widths.
return (value ?? string.Empty).Replace(' ', '\u00A0');
}
private void AddLanguageTag(VisualElement target, Language language)
{
Label tag = new(language.ToString());
@@ -805,7 +812,7 @@ namespace KernelPanic.UI
_unitDetailReturnsToOverview = returnToOverview;
_mode = CollectionMode.UnitDetail;
CurrentTitle = $"$ cat ~/units/{unit.Id}";
CurrentTitle = $"$ cat /etc/distros/{unit.Id}.conf";
CurrentHint = GetUnitDetailHint();
RenderUnitDetail(unit);
if (notify)
@@ -824,7 +831,7 @@ namespace KernelPanic.UI
TerminalTheme.PreserveFocus(_detail);
_detail.Clear();
_detailScroll.scrollOffset = Vector2.zero;
CurrentTitle = $"$ cat ~/units/{unit.Id}";
CurrentTitle = $"$ cat /etc/distros/{unit.Id}.conf";
CurrentHint = GetUnitDetailHint();
string identity = unit.Id + ":" + GetUnitVersion(unit);
@@ -854,16 +861,13 @@ namespace KernelPanic.UI
VisualElement nameBlock = new();
nameBlock.AddToClassList("unit-detail-header-copy");
int version = GetUnitVersion(unit);
Label name = new($"{DistroPresentation.DisplayName(unit)} {DistroVersionCatalog.GetReleaseLabel(unit.Id, version)} · v{version}/{GachaTuning.MaxVersion}");
Label path = new($"/etc/distros/{unit.Id}.conf");
path.AddToClassList("unit-config-path");
nameBlock.Add(path);
Label name = new($"# {DistroPresentation.DisplayName(unit)} · {DistroVersionCatalog.GetReleaseLabel(unit.Id, version)} · v{version}/{GachaTuning.MaxVersion}");
name.AddToClassList("collection-detail-name");
name.style.color = new StyleColor(unit.AccentColor);
nameBlock.Add(name);
VisualElement languages = new();
languages.AddToClassList("unit-overview-meta");
AddLanguageTag(languages, unit.PrimaryLanguage);
AddLanguageTag(languages, unit.SecondaryLanguage);
nameBlock.Add(languages);
header.Add(nameBlock);
RarityStyle rarity = RarityPresentation.ForStars(GetDistroStars(unit));
@@ -907,36 +911,88 @@ namespace KernelPanic.UI
private void AddUnitOverviewTab(VisualElement target, DistroDefinition unit)
{
VisualElement identity = TerminalLayout.Section("identity",
sectionClass: "unit-info-section unit-identity-section", headingClass: "detail-section-title");
identity.Add(BuildDetailLine("lang", DistroPresentation.FormatLanguages(unit)));
VisualElement identity = new();
identity.AddToClassList("unit-info-section");
identity.AddToClassList("unit-identity-section");
identity.Add(OverviewSectionLabel("[host]"));
Label description = TerminalLayout.BodyText(string.IsNullOrWhiteSpace(unit.Description) ? "--" : unit.Description,
className: "collection-detail-description");
VisualElement facts = new();
facts.AddToClassList("unit-overview-facts");
facts.Add(OverviewFact("languages", DistroPresentation.FormatLanguages(unit), "UnitOverview_languages", true));
facts.Add(OverviewFact("uptime", unit.BaseUptime.ToString(), "UnitOverview_uptime"));
facts.Add(OverviewFact("ram", unit.BaseRam.ToString(), "UnitOverview_ram"));
facts.Add(OverviewFact("cycles", unit.BaseCyclesPerTurn.ToString(), "UnitOverview_cycles"));
identity.Add(facts);
Label description = new(string.IsNullOrWhiteSpace(unit.Description) ? "--" : unit.Description)
{
name = "UnitOverview_description"
};
description.AddToClassList("unit-overview-description");
identity.Add(description);
target.Add(identity);
AddPassiveDetails(target, unit);
VisualElement readout = new();
readout.AddToClassList("collection-detail-readout");
VisualElement passive = new();
passive.AddToClassList("unit-info-section");
passive.AddToClassList("unit-passive-section");
VisualElement passiveHeading = new();
passiveHeading.AddToClassList("unit-passive-heading");
passiveHeading.Add(OverviewSectionLabel("[passive]"));
Label passiveName = new(unit.Passive == null ? "--" : unit.Passive.Name)
{
name = "UnitPassive_name"
};
passiveName.AddToClassList("unit-passive-name");
passiveHeading.Add(passiveName);
passive.Add(passiveHeading);
Label artLabel = new();
DistroArtPresenter.ConfigureArtLabel(artLabel, _monospaceFont);
AsciiArtFitter artFitter = new(artLabel, _monospaceFont);
VisualElement artPlaceholder = DistroArtPresenter.CreatePlaceholder();
artFitter.SetArt(DistroArtPresenter.Render(artLabel, artPlaceholder, unit));
readout.Add(artPlaceholder);
readout.Add(artLabel);
Label rules = new(GetPassiveRules(unit))
{
name = "UnitPassive_rules"
};
rules.AddToClassList("unit-passive-rules");
passive.Add(rules);
if (unit.Passive != null && !string.IsNullOrWhiteSpace(unit.Passive.FlavorText))
{
Label flavor = new("# " + unit.Passive.FlavorText)
{
name = "UnitPassive_flavor"
};
flavor.AddToClassList("unit-passive-flavor");
passive.Add(flavor);
}
target.Add(passive);
}
VisualElement details = new();
details.AddToClassList("collection-detail-values");
details.Add(BuildDetailLine("lang", DistroPresentation.FormatLanguages(unit)));
details.Add(BuildDetailLine("uptime", unit.BaseUptime.ToString()));
details.Add(BuildDetailLine("ram", unit.BaseRam.ToString()));
details.Add(BuildDetailLine("cycles", unit.BaseCyclesPerTurn.ToString()));
private static Label OverviewSectionLabel(string text)
{
Label label = new(text);
label.AddToClassList("unit-overview-section-label");
return label;
}
readout.Add(details);
target.Add(readout);
private static VisualElement OverviewFact(string key, string value, string name, bool wide = false)
{
VisualElement fact = new() { name = name };
fact.AddToClassList("unit-overview-fact");
if (wide) fact.AddToClassList("unit-overview-fact-wide");
Label keyLabel = new(key);
keyLabel.AddToClassList("unit-overview-fact-key");
Label valueLabel = new(value ?? "--");
valueLabel.AddToClassList("unit-overview-fact-value");
fact.Add(keyLabel);
fact.Add(valueLabel);
return fact;
}
private static string GetPassiveRules(DistroDefinition unit)
{
if (unit?.Passive == null) return "--";
if (unit.Id != "nixos") return unit.Passive.RulesText;
var policy = new NixGovernorState();
policy.BeginWave(1);
return "governor modes: " + string.Join("; ", Enum.GetValues(typeof(NixGovernor)).Cast<NixGovernor>().Select(governor =>
$"{governor.ToString().ToLowerInvariant()} {policy.DamageFor(governor)-100:+0;-0;0}% damage / {policy.ShieldFor(governor)-100:+0;-0;0}% shield"));
}
private void AddUnitUpgradeTab(VisualElement target, DistroDefinition unit)
@@ -1268,6 +1324,7 @@ namespace KernelPanic.UI
}, TrickleDown.TrickleDown);
_packageEquipDialog = new VisualElement();
_packageEquipDialog.AddToClassList("package-equip-dialog");
_packageEquipDialog.AddToClassList("terminal-pane");
_packageEquipOverlay.Add(_packageEquipDialog);
_root.Add(_packageEquipOverlay);
}
@@ -1312,7 +1369,8 @@ namespace KernelPanic.UI
VisualElement header = new();
header.AddToClassList("package-equip-header");
Label title = new($"equip: {_equipWindowSlot.DisplayName().ToLowerInvariant()} - {DistroPresentation.DisplayName(_equipWindowUnit)}");
header.AddToClassList("terminal-pane-titlebar");
Label title = new($"[ apt install --configure {_equipWindowSlot.DisplayName().ToLowerInvariant()} :: {DistroPresentation.DisplayName(_equipWindowUnit)} ]");
title.AddToClassList("collection-detail-name");
title.style.color = new StyleColor(_equipWindowUnit.AccentColor);
header.Add(title);
@@ -28,6 +28,10 @@ namespace KernelPanic.UI
VisualElement offers = new();
offers.AddToClassList("repository-offers");
VisualElement packageOperations = new();
packageOperations.AddToClassList("repository-package-operations");
packageOperations.Add(TerminalLayout.Heading("[ package operations ]", className: "repository-section-label"));
packageOperations.Add(TerminalLayout.BodyText("$ apt-cache search --upgradeable", className: "repository-command-heading"));
if (_runManager.RepositoryOffers.Count == 0)
{
offers.Add(EmptyState("repository clean: no offers left this visit"));
@@ -41,42 +45,53 @@ namespace KernelPanic.UI
}
body.Add(DeckAnalysisView.Build(_runManager.RunDeck));
body.Add(offers);
body.Add(RemoveCardBlock());
packageOperations.Add(offers);
packageOperations.Add(RemoveCardBlock());
body.Add(packageOperations);
repo.Add(body);
VisualElement footer = new();
footer.AddToClassList("repository-footer");
footer.AddToClassList("screen-frame-footer");
VisualElement packageControls = new();
packageControls.AddToClassList("repository-footer-group");
packageControls.AddToClassList("repository-package-controls");
packageControls.Add(TerminalLayout.BodyText("package cache", className: "repository-footer-label"));
Button reroll = new(() => _runManager.RerollRepositoryOffers(cardDatabase, languageDeckDatabase))
{
text = $"apt update {_runManager.RerollCost} bits"
text = $"$ apt update {_runManager.RerollCost} bits"
};
reroll.AddToClassList("primary-action");
reroll.AddToClassList("secondary-action");
reroll.AddToClassList("repository-footer-action");
reroll.AddToClassList("repository-reroll-action");
reroll.EnableInClassList("repo-unaffordable", _runManager.Bits < _runManager.RerollCost);
reroll.SetEnabled(_runManager.Bits >= _runManager.RerollCost);
footer.Add(reroll);
packageControls.Add(reroll);
footer.Add(packageControls);
Button leave = new(() =>
{
if (_runManager.Journey.campaign) SetRouteSelectionOpen(true);
else _combatManager.ContinueToNextWave();
}) { name = "BootNextWaveButton", text = "> boot next-wave" };
}) { name = "BootNextWaveButton", text = "$ boot --next-wave" };
leave.AddToClassList("primary-action");
leave.AddToClassList("repository-leave-action");
leave.AddToClassList("repository-primary-command");
leave.AddToClassList("repository-recommended-action");
leave.SetEnabled(!_runManager.IsSuspended);
VisualElement leaveBlock = new();
leaveBlock.AddToClassList("repository-leave-block");
leaveBlock.AddToClassList("repository-footer-group");
leaveBlock.Add(TerminalLayout.BodyText("recommended next action", className: "repository-footer-label repository-recommended-label"));
leaveBlock.Add(leave);
Label banked = new($"{_runManager.Bits} bits remaining");
banked.AddToClassList("repository-banked-hint");
banked.AddToClassList("screen-frame-hint");
leaveBlock.Add(banked);
var suspend = new Button(SaveAndExitRun) { name = "SaveAndExitRunButton", text = "save & exit" };
suspend.AddToClassList("primary-action");
var suspend = new Button(SaveAndExitRun) { name = "SaveAndExitRunButton", text = "$ shutdown --save" };
suspend.AddToClassList("secondary-action");
suspend.AddToClassList("repository-leave-action");
suspend.AddToClassList("repository-save-action");
suspend.SetEnabled(!_runManager.IsSuspended);
leaveBlock.Add(suspend);
if (!string.IsNullOrEmpty(_checkpointError))
@@ -300,7 +315,7 @@ namespace KernelPanic.UI
Button buy = new(() => _runManager.BuyOffer(offer, _combatManager.PlayerState))
{
text = offer.Sold ? "installed" : OfferActionText(offer.Kind)
text = offer.Sold ? "# installed" : "$ " + OfferActionText(offer.Kind)
};
buy.tooltip = OfferCommandText(offer);
buy.AddToClassList("repository-action");
@@ -317,6 +332,7 @@ namespace KernelPanic.UI
VisualElement card = CardFaceView(preview);
card.AddToClassList("repository-card-preview");
content.Add(card);
AddRepositoryRulesToggle(content, card, preview);
if (offer.CardDefinition != null && offer.CardDefinition.IsRunOnly)
{
@@ -335,6 +351,7 @@ namespace KernelPanic.UI
VisualElement target = CardFaceView(offer.TargetCard);
target.AddToClassList("repository-upgrade-card");
content.Add(target);
AddRepositoryRulesToggle(content, target, offer.TargetCard);
}
VisualElement delta = new();
@@ -352,6 +369,31 @@ namespace KernelPanic.UI
return content;
}
private static void AddRepositoryRulesToggle(VisualElement content, VisualElement card, CardInstance instance)
{
string rules = instance?.Definition == null ? "" : CardEffectFactory.GetRulesText(instance);
// Short manifests already scan well. Long cards keep their first authoritative
// sentence visible and put restrictions/edge cases behind an explicit reveal.
if (rules.Length < 140 || card.Q<Label>(className: "software-conditions") == null) return;
card.AddToClassList("repository-card-collapsible");
Button toggle = null;
toggle = new Button(() =>
{
bool expanded = !card.ClassListContains("repository-card-expanded");
card.EnableInClassList("repository-card-expanded", expanded);
toggle.text = expanded ? "▾ hide full rules" : "▸ show full rules";
toggle.EnableInClassList("expanded", expanded);
})
{
name = "RepositoryRulesToggle_" + instance.Definition.Id,
text = "▸ show full rules",
tooltip = "Show or hide the complete card manifest."
};
toggle.AddToClassList("repository-rules-toggle");
content.Add(toggle);
}
private VisualElement StatOfferContent(RepositoryOffer offer)
{
VisualElement content = new();
@@ -42,9 +42,12 @@ namespace KernelPanic.UI
var config = _runManager.CurrentConfig;
VisualElement reportHeader = new();
reportHeader.AddToClassList("death-report-header");
reportHeader.Add(SoftwareCardView.Text("RUN REPORT", "death-eyebrow"));
reportHeader.Add(SoftwareCardView.Text("$ cat /var/log/run-report", "death-eyebrow"));
reportHeader.Add(SoftwareCardView.Text($"seed {config?.RunSeed ?? 0}", "death-seed"));
content.Add(reportHeader);
string exitCode = _combatManager.RunCompleted ? "0" : _runEndedBySurrender ? "130" : "137";
string exitState = _combatManager.RunCompleted ? "[ OK ] objective completed" : _runEndedBySurrender ? "[ WARN ] interrupted by operator" : "[ PANIC ] host terminated";
content.Add(SoftwareCardView.Text($"{exitState} · process exited with code {exitCode}", "death-exit-code"));
content.Add(OverlayTitle(_combatManager.RunCompleted ? "KERNEL SECURED" : _runEndedBySurrender ? "SYSTEM HALTED" : "KERNEL PANIC"));
var report = GetRunHistoryEntry();
@@ -86,10 +89,11 @@ namespace KernelPanic.UI
rewards.AddToClassList("death-rewards");
rewards.Add(RewardReadout("#", _runManager.AccruedBandwidth, "bandwidth", false));
rewards.Add(RewardReadout("*", _runManager.AccruedEntropy, "entropy", _runManager.AccruedEntropy <= 0));
rewards.Add(RewardReadout("+", _runManager.AccruedCommits, "commits", _runManager.AccruedCommits <= 0));
content.Add(rewards);
content.Add(SoftwareCardView.Text("Return to your collection to prepare the next run.", "death-next-run"));
Button returnButton = new(() => SceneLoader.LoadMainMenu(_root)) { text = "> return to menu" };
Button returnButton = new(() => SceneLoader.LoadMainMenu(_root)) { text = "$ cd ~ && clear # return to menu" };
returnButton.AddToClassList("primary-action");
returnButton.AddToClassList("death-return-action");
if (!string.IsNullOrEmpty(_saveError))
@@ -134,6 +138,7 @@ namespace KernelPanic.UI
data.bandwidthBalance = Math.Max(0, data.bandwidthBalance) + _runManager.AccruedBandwidth;
LanguageUnlock.RecordCampaignClear(data, _runManager.CurrentConfig, _runManager.Journey, _runManager.WavesCleared);
data.entropyBalance = Math.Max(0, data.entropyBalance) + _runManager.AccruedEntropy;
data.commitsBalance = Math.Max(0, data.commitsBalance) + _runManager.AccruedCommits;
data.RecordRunStats(_runManager.CurrentConfig?.Distro?.Id,
_combatManager.RunCompleted ? _runManager.WavesCleared : _runManager.CurrentWaveNumber);
if (_combatManager.RunFinished) RunHistory.Record(data.recentRuns, GetRunHistoryEntry());
+267 -94
View File
@@ -41,6 +41,11 @@ namespace KernelPanic.UI
private VisualElement _statusBar;
private Label _waveLabel;
private Label _phaseLabel;
private VisualElement _commandPrompt;
private Label _commandPromptUser;
private Label _commandPromptCommand;
private Label _commandPromptArgs;
private Label _commandPromptResult;
private Label _entropyLabel;
private Label _bitsLabel;
private Label _bandwidthLabel;
@@ -51,15 +56,16 @@ namespace KernelPanic.UI
private VisualElement _lazyStackPile;
private VisualElement _tokenArea;
private VisualElement _enemyRow;
private VisualElement _processTableHeader;
private VisualElement _combatPaneTabs;
private VisualElement _handRow;
private VisualElement _turnResourceGrid;
private VisualElement _packageReadinessStrip;
private Label _packageActivationLabel;
private readonly Dictionary<string, VisualElement> _packageReadinessChips = new();
private int _packageActivationVersion;
private int _packageActivationFrame = -1;
private readonly Queue<string> _packageActivationMessages = new();
private VisualElement _journalEntries;
private VisualElement _journalActionResults;
private Foldout _journal;
private Button _endTurnButton;
private Button _prefetchButton;
@@ -69,15 +75,17 @@ namespace KernelPanic.UI
private ScrollView _journalScroll;
private ExecutionTrackView _queueView;
private ExecutionTrackView _stackView;
private ExecutionPreviewView _executionPreview;
private TurnResolutionView _turnResolution;
private CombatExecutionTrace _executionTrace;
private Label _encounterBrief;
private float _journalStartedAt;
private readonly Dictionary<EnemyInstance, Button> _enemyCards = new();
private readonly Dictionary<EnemyInstance, int> _enemyPids = new();
private int _nextEnemyPid = 1042;
private string _activeCombatPane = "processes";
private readonly HashSet<EnemyInstance> _restartingEnemies = new();
private readonly HashSet<IVisualElementScheduledItem> _scheduledFeedback = new();
private readonly Queue<string> _recentLog = new();
private readonly HashSet<ExecutionAction> _expandedJournalActions = new();
private readonly Dictionary<CardInstance, VisualElement> _retainedHandCards = new();
private int _executionSequence;
private Button _surrenderButton;
@@ -158,9 +166,11 @@ namespace KernelPanic.UI
{
_campaignUnlocksSaved = false;
_campaignUnlockNotice = _campaignUnlockError = null;
if (_executionTrace != null) _executionTrace.Changed -= RefreshJournalActionResults;
_executionTrace?.Dispose();
_executionTrace = new CombatExecutionTrace(_combatManager);
_turnResolution?.Bind(_executionTrace);
_executionTrace.Changed += RefreshJournalActionResults;
RefreshJournalActionResults();
_runTelemetry?.Dispose();
_runTelemetry = new CombatRunTelemetry(() => _combatManager.PlayerState, DescribeDamageSource)
{
@@ -308,8 +318,7 @@ namespace KernelPanic.UI
_feedbackLayer?.Clear();
_runTelemetry?.Dispose();
_runTelemetry = null;
_turnResolution?.Dispose();
_executionPreview?.Close();
if (_executionTrace != null) _executionTrace.Changed -= RefreshJournalActionResults;
_executionTrace?.Dispose();
_executionTrace = null;
}
@@ -325,17 +334,6 @@ namespace KernelPanic.UI
if (evt.keyCode == KeyCode.E && _tutorial.Guide.CanEndTurn) _combatManager.EndPlayerTurn();
evt.StopPropagation(); return;
}
if (_turnResolution?.IsOpen == true)
{
if (evt.keyCode == KeyCode.Escape) _turnResolution.Close();
evt.StopPropagation(); return;
}
if (_executionPreview?.IsOpen == true)
{
if (evt.keyCode == KeyCode.Escape) _executionPreview.Close();
evt.StopPropagation();
return;
}
if (_pileInspectorOpen)
{
if (evt.keyCode == KeyCode.Escape) ClosePileInspector();
@@ -465,6 +463,8 @@ namespace KernelPanic.UI
{
_root.Clear();
_lastCombatantFeedbackRects.Clear();
_enemyPids.Clear();
_nextEnemyPid = 1042;
_heldDeathUptime.Clear();
_deathBeatStartedCombatants.Clear();
_visuallyRemovedCombatants.Clear();
@@ -475,6 +475,11 @@ namespace KernelPanic.UI
_statusBar = BuildStatusBar();
_root.Add(_statusBar);
_commandPrompt = BuildCombatCommandPrompt();
_statusBar.Add(_commandPrompt);
_combatPaneTabs = BuildCombatPaneTabs();
_root.Add(_combatPaneTabs);
var workspace = new ScrollView(ScrollViewMode.Vertical);
workspace.AddToClassList("combat-workspace");
@@ -483,50 +488,37 @@ namespace KernelPanic.UI
workspace.Add(_firstBattleGuide.Element);
_encounterBrief = TerminalLayout.BodyText("", "EncounterBrief");
workspace.Add(_encounterBrief);
_executionPreview = new ExecutionPreviewView();
_turnResolution = new TurnResolutionView();
VisualElement main = new();
main.AddToClassList("main-layout");
workspace.Add(main);
_playerPanel = CreatePanel("host", "distro", 0);
_playerPanel = CreatePanel("[1] host", "distro", 0);
_playerPanel.AddToClassList("player-panel");
main.Add(_playerPanel);
VisualElement enemiesPanel = CreatePanel("process table", "select a process to target", 0);
VisualElement enemiesPanel = CreatePanel("[2] /proc/enemies", "select a process to target", 0);
enemiesPanel.AddToClassList("process-panel");
main.Add(enemiesPanel);
_targetHint = SoftwareCardView.Text("", "target-hint");
enemiesPanel.Add(_targetHint);
_processTableHeader = BuildProcessTableHeader();
enemiesPanel.Add(_processTableHeader);
_enemyRow = new();
_enemyRow.AddToClassList("enemy-row");
enemiesPanel.Add(_enemyRow);
var packages = new VisualElement { name = "CombatPackages" };
packages.AddToClassList("combat-packages");
packages.Add(TerminalLayout.Heading("installed packages", className: "package-loadout-title"));
_packageReadinessStrip = new VisualElement { name = "PackageReadiness" };
_packageReadinessStrip.AddToClassList("package-readiness-strip");
_packageReadinessChips.Clear();
packages.Add(_packageReadinessStrip);
_packageActivationLabel = SoftwareCardView.Text("", "package-activation");
_packageActivationLabel.name = "PackageActivation";
_packageActivationLabel.style.display = DisplayStyle.None;
packages.Add(_packageActivationLabel);
_playerPanel.Add(packages);
_playerPanel.Add(_packageActivationLabel);
VisualElement scheduler = new();
VisualElement scheduler = new() { name = "SchedulerPane" };
scheduler.AddToClassList("scheduler");
VisualElement schedulerHeader = PanelHeader("execution scheduler", "");
VisualElement schedulerHeader = PanelHeader("[3] scheduler", "");
_schedulerActivity = schedulerHeader.Q<Label>(className: "panel-subtitle");
_schedulerActivity.AddToClassList("scheduler-activity");
_schedulerActivity.text = "No operations dispatched.";
scheduler.Add(schedulerHeader);
var preview = new Button(() => { _turnResolution?.Close(); _executionPreview?.Open(_root); })
{ name = "OpenExecutionPreview", text = "preview turn" };
preview.AddToClassList("combat-status-action");
preview.tooltip = "Inspect the execution order and estimates before ending your turn.";
schedulerHeader.Add(preview);
BuildGoScheduler(scheduler);
_interpreterStrip = AddTrackZone(scheduler, "queue / FIFO", "Interpreter: resolves in order during the interpret phase", "track-zone-queue");
_lazyStackPile = AddTrackZone(scheduler, "stack / LIFO", "After FIFO: newest first. Captured multiplier scales damage and explicit Shield only.", "track-zone-stack");
@@ -544,7 +536,7 @@ namespace KernelPanic.UI
VisualElement bottom = new();
bottom.AddToClassList("bottom-layout");
_root.Add(bottom);
VisualElement handPanel = CreatePanel("executable buffer", "Tab / Enter to select · E end turn", 0);
VisualElement handPanel = CreatePanel("[4] ~/hand", "Tab / Enter to select · E end turn", 0);
handPanel.AddToClassList("hand-panel");
bottom.Add(handPanel);
_handScroll = new ScrollView(ScrollViewMode.VerticalAndHorizontal);
@@ -574,7 +566,7 @@ namespace KernelPanic.UI
});
}, TrickleDown.TrickleDown);
VisualElement commandPanel = CreatePanel("dispatch", "turn controls", 0);
VisualElement commandPanel = CreatePanel("[5] dispatch", "turn controls", 0);
commandPanel.AddToClassList("turn-panel");
bottom.Add(commandPanel);
_turnResourceGrid = new();
@@ -615,22 +607,30 @@ namespace KernelPanic.UI
_surrenderCancelButton.AddToClassList("hidden");
commandPanel.Add(_surrenderCancelButton);
var log = new Foldout { text = "journal / recent combat events", value = false };
// The latest event remains in the foldout title; open the full journal only
// when its history is useful so it does not permanently consume the playfield.
var log = new Foldout { text = "[6] journalctl -f", value = false };
_journal = log;
log.AddToClassList("combat-journal");
_journalEntries = new VisualElement();
_journalActionResults = new VisualElement { name = "JournalActionResults" };
_journalActionResults.AddToClassList("journal-action-results");
var logScroll = new ScrollView(ScrollViewMode.Vertical);
_journalScroll = logScroll;
_journalStartedAt = Time.realtimeSinceStartup;
logScroll.AddToClassList("journal-scroll");
logScroll.Add(_journalEntries);
logScroll.Add(_journalActionResults);
log.Add(logScroll);
log.RegisterValueChangedCallback(evt =>
{
if (!evt.newValue) return;
ScheduleFeedback(() =>
{
if (_journal.value && _journalEntries.childCount > 0)
if (!_journal.value) return;
if (_journalActionResults.childCount > 0)
_journalScroll.ScrollTo(_journalActionResults.ElementAt(_journalActionResults.childCount - 1));
else if (_journalEntries.childCount > 0)
_journalScroll.ScrollTo(_journalEntries.ElementAt(_journalEntries.childCount - 1));
}, 20);
});
@@ -651,6 +651,79 @@ namespace KernelPanic.UI
TerminalTheme.ConstrainModalFocus(_overlay);
_overlay.style.display = DisplayStyle.None;
_root.Add(_overlay);
SelectCombatPane(_activeCombatPane, false);
}
private VisualElement BuildCombatCommandPrompt()
{
VisualElement prompt = new() { name = "CombatCommandPrompt" };
prompt.AddToClassList("combat-command-prompt");
_commandPromptUser = SoftwareCardView.Text("player@kernel:~$", "syntax-prompt");
_commandPromptCommand = SoftwareCardView.Text("idle", "syntax-command");
_commandPromptArgs = SoftwareCardView.Text("", "syntax-argument");
_commandPromptResult = SoftwareCardView.Text("", "syntax-output");
prompt.Add(_commandPromptUser);
prompt.Add(_commandPromptCommand);
prompt.Add(_commandPromptArgs);
prompt.Add(_commandPromptResult);
return prompt;
}
private VisualElement BuildCombatPaneTabs()
{
VisualElement tabs = new() { name = "CombatPaneTabs" };
tabs.AddToClassList("combat-pane-tabs");
AddCombatPaneTab(tabs, "processes", "[1] processes");
AddCombatPaneTab(tabs, "scheduler", "[2] scheduler");
AddCombatPaneTab(tabs, "hand", "[3] hand");
AddCombatPaneTab(tabs, "log", "[4] log");
return tabs;
}
private void AddCombatPaneTab(VisualElement tabs, string pane, string text)
{
Button button = new(() => SelectCombatPane(pane))
{
name = "CombatPane_" + pane,
text = text,
tooltip = $"Show the {pane} terminal pane."
};
button.AddToClassList("combat-pane-tab");
button.userData = pane;
tabs.Add(button);
}
private void SelectCombatPane(string pane, bool engage = true)
{
_activeCombatPane = pane is "scheduler" or "hand" or "log" ? pane : "processes";
if (engage) _root.AddToClassList("combat-pane-filtered");
foreach (string candidate in new[] { "processes", "scheduler", "hand", "log" })
{
_root.EnableInClassList("combat-pane-" + candidate, candidate == _activeCombatPane);
_combatPaneTabs?.Q<Button>("CombatPane_" + candidate)?.EnableInClassList("selected", candidate == _activeCombatPane);
}
if (_activeCombatPane == "log" && _journal != null) _journal.value = true;
}
private static VisualElement BuildProcessTableHeader()
{
VisualElement row = new() { name = "ProcessTableHeader" };
row.AddToClassList("process-table-header");
row.Add(ProcessColumn("PID", "process-col-pid"));
row.Add(ProcessColumn("STATE", "process-col-state"));
row.Add(ProcessColumn("PROCESS", "process-col-name"));
row.Add(ProcessColumn("UPTIME", "process-col-uptime"));
row.Add(ProcessColumn("SHIELD", "process-col-shield"));
row.Add(ProcessColumn("NEXT", "process-col-intent"));
row.Add(ProcessColumn("RESULT", "process-col-result"));
return row;
}
private static Label ProcessColumn(string text, string className)
{
Label label = SoftwareCardView.Text(text, "process-column");
label.AddToClassList(className);
return label;
}
private VisualElement BuildStatusBar()
@@ -672,10 +745,6 @@ namespace KernelPanic.UI
_seedLabel = new("--");
_seedLabel.AddToClassList("seed-value");
bar.Add(_seedLabel);
var results = new Button(() => { _executionPreview?.Close(); _turnResolution?.Open(_root); }) { name = "OpenTurnResolution", text = "results" };
results.AddToClassList("combat-status-action");
results.tooltip = "Inspect resolved actions and damage calculations.";
bar.Add(results);
var combatSave = new Button(SaveAndExitRun) { name = "SaveCombatButton", text = "save & exit" };
combatSave.AddToClassList("combat-status-action");
combatSave.tooltip = "Save this planning state, including queued cards and persistent work. Finish selections first.";
@@ -743,11 +812,8 @@ namespace KernelPanic.UI
RefreshEnemies();
RefreshHand();
RefreshTurnPanel();
RefreshPackageReadiness();
RefreshCommandPrompt();
RefreshOverlay();
_executionPreview?.Refresh(_combatManager);
_root.Q<Button>("OpenExecutionPreview")?.SetEnabled(!_combatManager.RunFinished && !_combatManager.AwaitingWaveContinue);
if (_combatManager.RunFinished || _combatManager.AwaitingWaveContinue) _turnResolution?.Close();
if (_encounterBrief != null)
{
// Encounter advice belongs to onboarding, not every battle's workspace.
@@ -757,38 +823,39 @@ namespace KernelPanic.UI
_firstBattleGuide?.Refresh(_combatManager.AwaitingWaveContinue, _combatManager.RunFinished);
}
private void RefreshPackageReadiness()
private void RefreshCommandPrompt()
{
if (_packageReadinessStrip == null) return;
var readouts = _combatManager.GetPackageReadouts();
var currentIds = new HashSet<string>();
foreach (var readout in readouts)
if (_commandPrompt == null) return;
bool targeting = _combatManager.PendingTargetCard != null;
bool resolving = _combatManager.CurrentPhase != TurnPhase.Execute;
_root.EnableInClassList("combat-awaiting-target", targeting);
_root.EnableInClassList("combat-resolving", resolving && !_combatManager.AwaitingWaveContinue && !_combatManager.RunFinished);
_root.EnableInClassList("combat-planning", !targeting && !resolving);
string host = _runManager?.CurrentConfig?.Distro?.Id ?? "kernel";
_commandPromptUser.text = $"player@{host}:~$";
if (_combatManager.RunFinished)
SetCommandPrompt("cat", "/var/log/run-report", "# process exited; journal retained");
else if (_combatManager.AwaitingWaveContinue)
SetCommandPrompt("cd", "~/repository", "[OK] wave complete");
else if (targeting)
{
string id = readout.Definition.Id;
currentIds.Add(id);
if (!_packageReadinessChips.TryGetValue(id, out var chip))
{
chip = new VisualElement { name = "Readiness_" + id, focusable = true, tabIndex = 0 };
chip.AddToClassList("package-readiness-chip");
chip.Add(RarityPresentation.CreatePackageBadge(readout.Definition.Rarity));
var copy = new VisualElement();
copy.AddToClassList("package-readiness-copy");
copy.Add(SoftwareCardView.Text(readout.Definition.DisplayName, "package-readiness-name"));
copy.Add(SoftwareCardView.Text("", "package-readiness-state"));
chip.Add(copy);
_packageReadinessChips[id] = chip;
_packageReadinessStrip.Add(chip);
}
chip.Q<Label>(className: "package-readiness-state").text = readout.State;
chip.tooltip = readout.Definition.DisplayName + " / " + readout.State + "\n" + readout.Details;
CardInstance pending = _combatManager.PendingTargetCard;
CardPreview preview = CardPreviewService.Build(_combatManager, pending);
SetCommandPrompt("exec", $"{pending.Definition.Id} --target <pid>",
$"# {preview.Summary} · {GetDisplayCardCost(pending)}c");
}
foreach (var id in new List<string>(_packageReadinessChips.Keys))
{
if (currentIds.Contains(id)) continue;
_packageReadinessChips[id].RemoveFromHierarchy();
_packageReadinessChips.Remove(id);
}
_packageReadinessStrip.parent.style.display = readouts.Count > 0 ? DisplayStyle.Flex : DisplayStyle.None;
else if (_combatManager.CurrentPhase == TurnPhase.Execute)
SetCommandPrompt("exec", "<card> [--target pid]", "# Tab select · E dispatch");
else
SetCommandPrompt("wait", $"--phase {PhaseText(_combatManager.CurrentPhase)}", _schedulerActivity?.text ?? "# scheduler resolving");
}
private void SetCommandPrompt(string command, string arguments, string result)
{
_commandPromptCommand.text = command;
_commandPromptArgs.text = arguments;
_commandPromptResult.text = result;
}
private void HandlePackageActivated(PackageActivation activation)
@@ -850,7 +917,6 @@ namespace KernelPanic.UI
private void RefreshPlayer()
{
var uptimeMeter = _playerPanel.Q(className: "meter-block");
var packages = _packageReadinessStrip?.parent;
_playerPanel.Clear();
_combatantElements.Remove(_combatManager.PlayerState);
_combatantElements[_combatManager.PlayerState] = _playerPanel;
@@ -886,6 +952,7 @@ namespace KernelPanic.UI
}
_playerPanel.Add(StatusBlock(state, true));
_playerPanel.Add(_packageActivationLabel);
RefreshGovernorPanel();
var compilation = _combatManager.Compilation;
@@ -924,7 +991,6 @@ namespace KernelPanic.UI
{
_playerPanel.Add(ArchBtwCounter(state.ArchBtwStacks));
}
if (packages != null) _playerPanel.Add(packages);
}
private bool IsDistro(string id)
@@ -982,6 +1048,7 @@ namespace KernelPanic.UI
{
_enemyCards[enemy].RemoveFromHierarchy();
_enemyCards.Remove(enemy);
_enemyPids.Remove(enemy);
_combatantElements.Remove(enemy.State);
_restartingEnemies.Remove(enemy);
_previousUptime.Remove(enemy.State);
@@ -1010,6 +1077,7 @@ namespace KernelPanic.UI
if (!_enemyCards.TryGetValue(enemy, out Button card))
{
_enemyPids[enemy] = _nextEnemyPid++;
card = new Button(() =>
{
// Resolve the current index: an earlier process may have exited.
@@ -1017,18 +1085,39 @@ namespace KernelPanic.UI
if (ReferenceEquals(_combatManager.Enemies[target], enemy)) { _combatManager.SelectEnemy(target); break; }
}) { userData = enemy };
card.AddToClassList("enemy-card");
card.Add(SoftwareCardView.Text("", "process-state"));
card.Add(SoftwareCardView.Text("", "enemy-name"));
card.Add(MeterBlock("uptime", enemy.CurrentUptime, enemy.MaxUptime, MeterTone.Uptime));
VisualElement primary = new();
primary.AddToClassList("process-row-primary");
Label pid = SoftwareCardView.Text("", "process-pid");
pid.AddToClassList("process-col-pid");
primary.Add(pid);
Label state = SoftwareCardView.Text("", "process-state");
state.AddToClassList("process-col-state");
primary.Add(state);
Label name = SoftwareCardView.Text("", "enemy-name");
name.AddToClassList("process-col-name");
primary.Add(name);
VisualElement uptime = MeterBlock("uptime", enemy.CurrentUptime, enemy.MaxUptime, MeterTone.Uptime);
uptime.AddToClassList("process-col-uptime");
primary.Add(uptime);
Label shield = SoftwareCardView.Text("", "enemy-shield");
shield.AddToClassList("process-col-shield");
primary.Add(shield);
var intent = new VisualElement { name = "ProcessIntent" };
intent.AddToClassList("process-intent-slot");
card.Add(intent);
card.Add(SoftwareCardView.Text("", "enemy-shield"));
card.Add(SoftwareCardView.Text("", "process-behavior"));
card.Add(new VisualElement { name = "ProcessSignals" });
intent.AddToClassList("process-col-intent");
primary.Add(intent);
Label result = SoftwareCardView.Text("", "process-result");
result.name = "ProcessResult";
result.AddToClassList("process-col-result");
primary.Add(result);
card.Add(primary);
VisualElement detail = new();
detail.AddToClassList("process-row-detail");
detail.Add(new VisualElement { name = "ProcessSignals" });
var statusSlot = new VisualElement { name = "ProcessStatuses" };
statusSlot.AddToClassList("process-statuses");
card.Add(statusSlot);
detail.Add(statusSlot);
card.Add(detail);
_enemyCards.Add(enemy, card);
_enemyRow.Add(card);
}
@@ -1046,17 +1135,17 @@ namespace KernelPanic.UI
card.SetEnabled((!enemy.State.IsDefeated || holdDeathDisplay) && _combatManager.TutorialGuide?.AllowsEnemy(enemy) != false);
card.EnableInClassList("enemy-targetable", _combatManager.PendingTargetCard != null && !deathPending && !enemy.State.IsDefeated);
card.AddToClassList("process-" + enemy.ArchetypeId.Replace('_', '-'));
card.Q<Label>(className: "process-state").text = $"{(_combatManager.SelectedEnemyIndex == index ? "> " : " ")}{EnemyProcessPresentation.Symbol(enemy.ArchetypeId)} {EnemyProcessPresentation.Lifecycle(enemy)}";
card.Q<Label>(className: "process-pid").text = _enemyPids[enemy].ToString();
card.Q<Label>(className: "process-state").text = EnemyProcessPresentation.Lifecycle(enemy).ToUpperInvariant();
card.EnableInClassList("process-restarting", enemy.PendingRevive);
bool highlighted = _combatManager.SelectedEnemyIndex == index;
card.EnableInClassList("enemy-card-targeted", highlighted);
card.Q<Label>(className: "enemy-name").text = enemy.Name;
card.Q<Label>(className: "enemy-name").text = $"{EnemyProcessPresentation.Symbol(enemy.ArchetypeId)} {enemy.Name}";
card.tooltip = enemy.Name + " / " + IntentText(enemy.DisplayIntent);
if (enemy.HasBehavior(EnemyBehaviorFlags.ObfuscateIntent))
card.tooltip += "\nSurge: 8-10 damage. Harden: 6-8 Shield. Bypass: 3-4 damage ignoring Shield.\nDamage reveals this round's action, including hits absorbed by Shield. Hides again next round.";
if (enemy.HasBehavior(EnemyBehaviorFlags.LeavesOrphan))
card.tooltip += $"\n{CombatTuning.OrphanSpawnChancePercent}% chance to leave an orphan on permanent death.";
card.Q<Label>(className: "process-behavior").text = EnemyProcessPresentation.Behavior(enemy);
var signals = card.Q("ProcessSignals");
signals.Clear();
if (enemy.HasSpecialSignal)
@@ -1105,6 +1194,8 @@ namespace KernelPanic.UI
statuses.Clear();
statuses.EnableInClassList("hidden", enemy.State.Statuses.Count == 0);
if (enemy.State.Statuses.Count > 0) statuses.Add(StatusPipRow(enemy.State));
card.Q(className: "process-row-detail").EnableInClassList("process-row-detail-empty",
!enemy.HasSpecialSignal && enemy.State.Statuses.Count == 0);
if (ReferenceEquals(focusedEnemy, enemy)) card.Focus();
TrackCombatantFeedbackAnchor(enemy.State, card);
}
@@ -2086,6 +2177,7 @@ namespace KernelPanic.UI
string primaryText = text;
if (!shieldOnly && payload.ShieldDamage > 0) text += $" / -{payload.ShieldDamage} shield";
AppendCombatLog($"{CombatantName(payload.Target)}: {text}.", shieldOnly ? "journal-shield" : "journal-damage");
ShowProcessResult(payload.Target, primaryText, shieldOnly ? "shield" : "damage");
string tone = BuildDamageFloatClasses(tier, payload, shieldOnly);
string beatClass = fedoraPayoff ? "feedback-fedora-payoff" : BuildDamageBeatClass(tier, payload, shieldOnly);
if (fedoraPayoff)
@@ -2143,6 +2235,7 @@ namespace KernelPanic.UI
}
SpawnFloatingText(payload.Combatant, restartPending ? "restart pending" : "terminated", "float-kill float-large", 0);
ShowProcessResult(payload.Combatant, restartPending ? "RESTART" : "EXIT 0", restartPending ? "status" : "kill");
AppendCombatLog($"{combatantName}: {(restartPending ? "restart pending" : "terminated")}.", restartPending ? "journal-status" : "journal-damage");
if (!restartPending && TryGetCombatantFeedbackRect(payload.Combatant, out Rect targetBounds))
{
@@ -2480,14 +2573,18 @@ namespace KernelPanic.UI
if (_previousUptime.TryGetValue(state, out int oldUptime) && state.CurrentUptime > oldUptime)
{
SpawnFloatingText(element, $"+{state.CurrentUptime - oldUptime} HP", "float-heal");
AppendCombatLog($"{CombatantName(state)}: +{state.CurrentUptime - oldUptime} HP.", "journal-heal");
string result = $"+{state.CurrentUptime - oldUptime} HP";
SpawnFloatingText(element, result, "float-heal");
ShowProcessResult(state, result, "heal");
AppendCombatLog($"{CombatantName(state)}: {result}.", "journal-heal");
PlayElementBeat(element, "feedback-boost", 220);
}
if (_previousShield.TryGetValue(state, out int oldShield) && state.Shield > oldShield)
{
string result = $"+{state.Shield - oldShield} SH";
SpawnFloatingText(element, $"+{state.Shield - oldShield} shield", "float-shield");
ShowProcessResult(state, result, "shield");
AppendCombatLog($"{CombatantName(state)}: +{state.Shield - oldShield} shield.", "journal-shield");
PlayElementBeat(element, "feedback-block", 220);
}
@@ -2496,6 +2593,28 @@ namespace KernelPanic.UI
_previousShield[state] = state.Shield;
}
private void ShowProcessResult(CombatantState state, string text, string tone)
{
if (!TryGetCombatantElement(state, out VisualElement element)) return;
Label result = element.Q<Label>("ProcessResult");
if (result == null) return;
foreach (string className in new[] { "damage", "shield", "heal", "status", "kill" })
result.RemoveFromClassList("process-result-" + className);
result.text = text;
result.AddToClassList("process-result-active");
result.AddToClassList("process-result-" + tone);
int version = ++_feedbackBeatVersion;
_feedbackBeatVersions[result] = version;
ScheduleFeedback(() =>
{
if (!_feedbackBeatVersions.TryGetValue(result, out int current) || current != version) return;
result.text = string.Empty;
result.RemoveFromClassList("process-result-active");
result.RemoveFromClassList("process-result-" + tone);
_feedbackBeatVersions.Remove(result);
}, UIPreferences.ReducedMotion ? 900 : 1200);
}
private static string BuildDamageFloatClasses(HitMagnitudeTier tier, DamageDealtEvent payload, bool shieldOnly)
{
string classes = shieldOnly || payload.WasFullyBlocked ? "float-shield" : "float-damage";
@@ -3160,6 +3279,57 @@ namespace KernelPanic.UI
private void HandleCombatLog(string message) => AppendCombatLog(message);
private void RefreshJournalActionResults()
{
if (_journalActionResults == null) return;
bool atLatest = _journalScroll == null ||
_journalScroll.verticalScroller.highValue - _journalScroll.scrollOffset.y < 24;
IReadOnlyList<ExecutionAction> actions = _executionTrace?.Actions;
_expandedJournalActions.RemoveWhere(action => actions == null || !actions.Contains(action));
_journalActionResults.Clear();
if (actions == null || actions.Count == 0)
{
_journalActionResults.style.display = DisplayStyle.None;
return;
}
_journalActionResults.style.display = DisplayStyle.Flex;
for (int i = 0; i < actions.Count; i++)
{
ExecutionAction action = actions[i];
var metrics = new List<string>();
if (action.UptimeDamage > 0) metrics.Add($"{action.UptimeDamage} damage");
if (action.ShieldDamage > 0) metrics.Add($"{action.ShieldDamage} Shield damage");
if (action.ShieldGranted > 0) metrics.Add($"+{action.ShieldGranted} Shield");
if (action.PlayerUptimeLost > 0) metrics.Add($"-{action.PlayerUptimeLost} host Uptime");
if (action.PlayerShieldBlocked > 0) metrics.Add($"{action.PlayerShieldBlocked} blocked");
string summary = metrics.Count == 0 ? "" : " · " + string.Join(" · ", metrics);
var row = new Foldout
{
name = $"JournalActionResult_{i}",
text = $"[{action.Stage}] {action.Label} · {(action.Complete ? "done" : "resolving")}{summary}",
value = _expandedJournalActions.Contains(action)
};
row.AddToClassList("journal-action-result");
row.EnableInClassList("journal-action-active", !action.Complete);
row.RegisterValueChangedCallback(evt =>
{
if (evt.newValue) _expandedJournalActions.Add(action);
else _expandedJournalActions.Remove(action);
evt.StopPropagation();
});
foreach (string detail in action.Details)
row.Add(SoftwareCardView.Text("> " + detail, "journal-action-detail"));
foreach (string breakdown in action.DamageBreakdowns)
row.Add(SoftwareCardView.Text("calc> " + breakdown, "journal-action-damage"));
_journalActionResults.Add(row);
}
if (atLatest && _journalScroll != null)
ScheduleFeedback(() => _journalScroll.scrollOffset =
new Vector2(0, _journalScroll.verticalScroller.highValue), 0);
}
private void AppendCombatLog(string message, string tone = null)
{
if (string.IsNullOrEmpty(message) || message.Contains("would resolve:")) return;
@@ -3174,6 +3344,9 @@ namespace KernelPanic.UI
if (tone != null) entry.AddToClassList(tone);
_journalEntries.Add(entry);
while (_journalEntries.childCount > 64) _journalEntries.RemoveAt(0);
// CombatExecutionTrace records log details before this UI listener runs.
// Rebuild here so the journal's optional calculation rows include them immediately.
RefreshJournalActionResults();
if (atLatest) ScheduleFeedback(() => _journalScroll.scrollOffset = new Vector2(0, _journalScroll.verticalScroller.highValue), 0);
}
}
+40 -5
View File
@@ -9,12 +9,12 @@ namespace KernelPanic.UI
{
public static Button BuildWidget(DailyQuestState state, DateTime utcNow, Action open)
{
var widget = new Button(open) { name = "DailyQuestWidget", tooltip = "Open daily quests (Enter)" };
var widget = new Button(open) { name = "DailyQuestWidget" };
widget.AddToClassList("daily-quest-widget");
var counts = Counts(state);
var heading = new VisualElement();
heading.AddToClassList("daily-service-summary");
heading.Add(TerminalLayout.Heading("[ cron.daily ]", className: "daily-service-title"));
heading.Add(TerminalLayout.Heading("[ systemctl status cron.daily ]", className: "daily-service-title"));
var reward = TerminalLayout.BodyText(counts.Ready == 1 ? "1 reward ready" : $"{counts.Ready} rewards ready",
"DailyQuestRewardReady", "daily-reward-ready");
reward.style.display = counts.Ready > 0 ? DisplayStyle.Flex : DisplayStyle.None;
@@ -100,12 +100,13 @@ namespace KernelPanic.UI
overlay.AddToClassList("daily-quest-overlay");
var dialog = new VisualElement { name = "DailyQuestDialog" };
dialog.AddToClassList("daily-quest-dialog");
dialog.AddToClassList("terminal-pane");
var header = new VisualElement { name = "DailyQuestHeader" };
header.AddToClassList("daily-detail-header");
header.Add(TerminalLayout.BodyText("$ cat /etc/cron.daily/quests", className: "daily-detail-command"));
header.AddToClassList("terminal-pane-titlebar");
var titleRow = new VisualElement();
titleRow.AddToClassList("daily-service-summary");
titleRow.Add(TerminalLayout.Heading("DAILY TASKS", className: "daily-service-title"));
titleRow.Add(TerminalLayout.Heading("[ crontab -l ]", className: "daily-service-title"));
titleRow.Add(TerminalLayout.BodyText("", "DailyQuestDetailCountdown", "daily-service-meta"));
header.Add(titleRow);
header.Add(TerminalLayout.BodyText("", "DailyQuestDetailSummary", "daily-service-meta"));
@@ -148,6 +149,7 @@ namespace KernelPanic.UI
bool complete = progress >= DailyQuests.Target(kind);
row.EnableInClassList("daily-quest-complete", complete);
row.EnableInClassList("daily-quest-claimed", claimed);
row.Add(TerminalLayout.BodyText($"0 0 * * * /etc/cron.daily/{JobName(kind)}", className: "daily-cron-entry"));
row.Add(TerminalLayout.BodyText(DailyQuests.Description(kind), className: "daily-quest-name"));
int filled = progress * 10 / DailyQuests.Target(kind);
var progressRow = new VisualElement();
@@ -157,7 +159,13 @@ namespace KernelPanic.UI
progressRow.Add(TerminalLayout.BodyText($"{progress}/{DailyQuests.Target(kind)}", className: "daily-detail-values"));
row.Add(progressRow);
var reward = DailyQuests.Reward(kind);
row.Add(TerminalLayout.BodyText($"+{reward.Bandwidth} Bandwidth / +{reward.Entropy} Entropy"));
int commits = DailyQuests.CommitReward(kind);
string commitText = commits > 0 ? $" / +{commits} Commit{(commits == 1 ? string.Empty : "s")}" : string.Empty;
row.Add(TerminalLayout.BodyText($"+{reward.Bandwidth} Bandwidth / +{reward.Entropy} Entropy{commitText}"));
string status = claimed ? "status=exited exit=0 reward=committed"
: complete ? "status=exited exit=0 reward=pending"
: "status=running exit=--";
row.Add(TerminalLayout.BodyText(status, className: "daily-exit-status"));
var button = new Button(() => claim(kind, period))
{ name = "ClaimDailyQuest" + kind, text = claimed ? "[ CLAIMED ]" : complete ? "> CLAIM REWARD" : "[ in progress ]" };
button.AddToClassList("terminal-button");
@@ -168,7 +176,34 @@ namespace KernelPanic.UI
row.Add(button);
quests.Add(row);
}
var bonus = new VisualElement { name = "DailyQuestCompletionBonus" };
bonus.AddToClassList("daily-quest");
bonus.AddToClassList("daily-quest-completion-bonus");
bool bonusClaimed = DailyQuests.CompletionBonusClaimed(state);
int claimedCount = Counts(state).Claimed;
bonus.EnableInClassList("daily-quest-claimed", bonusClaimed);
bonus.Add(TerminalLayout.BodyText("[Service]", className: "daily-quest-name"));
bonus.Add(TerminalLayout.BodyText("ExecStartPost=/usr/bin/award-all-clear"));
bonus.Add(TerminalLayout.BodyText($"ConditionPathExists=/run/cron.daily/all-{DailyQuests.Count}.ok"));
bonus.Add(TerminalLayout.BodyText($"# claim all {DailyQuests.Count} task rewards ({claimedCount}/{DailyQuests.Count})"));
bonus.Add(TerminalLayout.BodyText($"+{DailyQuests.CompletionBonusBandwidth} Bandwidth / +{DailyQuests.CompletionBonusEntropy} Entropy / +{DailyQuests.CompletionBonusCommits} Commits"));
bonus.Add(TerminalLayout.BodyText(bonusClaimed ? "status=exited exit=0 reward=committed" : "status=waiting exit=-- # waiting for all five jobs to exit 0",
"DailyQuestCompletionBonusStatus", "daily-service-meta"));
quests.Add(bonus);
return panel;
}
private static string JobName(DailyQuestKind kind) => kind switch
{
DailyQuestKind.Waves => "clear-waves",
DailyQuestKind.Cards => "play-cards",
DailyQuestKind.Damage => "deal-uptime",
DailyQuestKind.BlockDamage => "block-damage",
DailyQuestKind.NativeCards => "run-native",
DailyQuestKind.ShieldDamage => "break-shields",
DailyQuestKind.SurviveRounds => "survive-rounds",
DailyQuestKind.WaveFive => "reach-wave-five",
_ => kind.ToString().ToLowerInvariant()
};
}
}
@@ -19,23 +19,5 @@ namespace KernelPanic.UI
: enemy.Archetype.Tier == EnemyTier.Boss ? "BOSS PROCESS"
: enemy.HasRevived ? "RUNNING / RESTART USED" : enemy.HasEliteSignal ? "ELITE PROCESS" : "RUNNING";
public static string Behavior(EnemyInstance enemy)
{
if (enemy.ArchetypeId == "process_supervisor") return "2 workers > Shield > interrupt / 8-process cap / attacks +3 below half Uptime";
if (enemy.ArchetypeId == "oom_reaper") return "-2 RAM / charge > 14-damage burst > recovery / attacks +3 below half Uptime";
if (enemy.ArchetypeId == "process_broker") return "Worker > attack / 8-process cap / attacks +3 below half Uptime";
if (enemy.HasBehavior(EnemyBehaviorFlags.BossCycle))
return "Shield > probe > heavy interrupt / next attacks +3 below half uptime";
if (enemy.HasBehavior(EnemyBehaviorFlags.Revive))
return enemy.PendingRevive ? "Revives next exchange" : enemy.HasRevived ? "Revival spent" : "Revival available / can be reaped";
if (enemy.HasBehavior(EnemyBehaviorFlags.Grow))
return $"Growing attack / {enemy.TurnsAlive} turns survived";
if (enemy.HasBehavior(EnemyBehaviorFlags.Countdown)) return $"Countdown: {enemy.CountdownRemaining}";
if (enemy.HasBehavior(EnemyBehaviorFlags.DefendAllies)) return "Shields self and adjacent processes";
if (enemy.HasBehavior(EnemyBehaviorFlags.ObfuscateIntent)) return enemy.IntentRevealed
? "Exposed this round / hides next round"
: "Hit to reveal / surge, Shield or bypass";
return "";
}
}
}
+1 -1
View File
@@ -51,6 +51,7 @@ namespace KernelPanic.UI
_emptyHintLabel = root.Q<Label>("FeaturedUnitEmptyHint");
_populatedState = root.Q<VisualElement>("FeaturedUnitPopulatedState");
_emptyState = root.Q<VisualElement>("FeaturedUnitEmptyState");
_panel.tooltip = string.Empty;
DistroArtPresenter.ConfigureArtLabel(_asciiLabel, _monospaceFont);
_asciiFitter = new AsciiArtFitter(_asciiLabel, _monospaceFont);
@@ -141,7 +142,6 @@ namespace KernelPanic.UI
_emptyState.AddToClassList("hidden");
_currentUnit = unit;
TerminalTheme.SetDistro(_panel, unit);
_panel.tooltip = "[F2] next distro / [Enter] inspect";
_titleLabel.text = "[ neofetch ]";
_asciiFitter.SetArt(DistroArtPresenter.Render(_asciiLabel, _asciiPlaceholder, unit));
+228 -28
View File
@@ -37,6 +37,10 @@ namespace KernelPanic.UI
private VisualElement _selectorOverlay;
private VisualElement _selectorDialog;
private VisualElement _selectorReturnFocus;
private Button _pullHistoryButton;
private VisualElement _pullHistoryOverlay;
private ScrollView _pullHistoryDialog;
private VisualElement _pullHistoryReturnFocus;
private DistroDatabase _distroDatabase;
private PackageDatabase _packageDatabase;
private FontAsset _monospaceFont;
@@ -76,6 +80,9 @@ namespace KernelPanic.UI
_requestPullCutscene = pullCutsceneCallback;
_bannerList = root.Q<VisualElement>("GachaBannerList");
_bannerDetail = root.Q<VisualElement>("GachaBannerDetail");
if (_pullHistoryButton != null) _pullHistoryButton.clicked -= OpenPullHistory;
_pullHistoryButton = root.Q<Button>("GachaPullHistoryButton");
if (_pullHistoryButton != null) _pullHistoryButton.clicked += OpenPullHistory;
}
public void Open()
@@ -89,6 +96,17 @@ namespace KernelPanic.UI
Refresh();
}
public void OpenPullHistory()
{
if (_root == null || _gachaService == null) return;
EnsurePullHistoryOverlay();
_pullHistoryReturnFocus = _root.focusController?.focusedElement as VisualElement;
RenderPullHistory();
_pullHistoryOverlay.RemoveFromClassList("hidden");
_pullHistoryOverlay.AddToClassList("modal-open");
_pullHistoryDialog.Q<Button>("ClosePullHistory")?.Focus();
}
public void Refresh()
{
if (_bannerList == null || _bannerDetail == null || _gachaService == null)
@@ -98,6 +116,12 @@ namespace KernelPanic.UI
_bannerRows.Clear();
_bannerList.Clear();
if (_pullHistoryButton != null)
_pullHistoryButton.text = $"git log --pulls\n{_gachaService.PullHistory.Count} saved";
Label branchCommand = new("$ git branch --list");
branchCommand.AddToClassList("gacha-branch-command");
_bannerList.Add(branchCommand);
for (int i = 0; i < _bannerIds.Length; i++)
{
@@ -119,7 +143,7 @@ namespace KernelPanic.UI
for (var target = evt.target as VisualElement; target != null && target != _root; target = target.parent)
if (target.ClassListContains("gacha-last-pull")) return;
if (evt.keyCode != KeyCode.UpArrow && evt.keyCode != KeyCode.DownArrow) return;
SelectBanner((_selectedBannerIndex + 1) % 2);
SelectBanner((_selectedBannerIndex + 1) % _bannerRows.Count);
_bannerRows[_selectedBannerIndex].Focus();
evt.StopPropagation();
}
@@ -127,13 +151,13 @@ namespace KernelPanic.UI
private VisualElement BuildBannerRow(string bannerId)
{
Button row = new();
row.SetEnabled(bannerId != GachaService.LimitedBannerId);
row.SetEnabled(true);
row.AddToClassList("gacha-banner-row");
row.Add(new Label(">") { name = $"GachaBannerCursor_{bannerId}" });
row.Add(new Label(" ") { name = $"GachaBannerCursor_{bannerId}" });
row.ElementAt(0).AddToClassList("command-cursor");
row.Add(new Label(GetBannerTitle(bannerId)) { name = $"GachaBannerName_{bannerId}" });
row.Add(new Label(GetBannerRef(bannerId)) { name = $"GachaBannerName_{bannerId}" });
row.ElementAt(1).AddToClassList("command-text");
row.Add(new Label(GetBannerStatus(bannerId)) { name = $"GachaBannerStatus_{bannerId}" });
@@ -162,7 +186,9 @@ namespace KernelPanic.UI
{
bool selected = i == _selectedBannerIndex;
_bannerRows[i].EnableInClassList(SelectedClassName, selected);
_bannerRows[i].Q<Label>(className: "command-cursor").visible = selected;
Label cursor = _bannerRows[i].Q<Label>(className: "command-cursor");
cursor.visible = true;
cursor.text = selected ? "*" : " ";
}
RenderSelectedBanner();
@@ -185,6 +211,12 @@ namespace KernelPanic.UI
return;
}
if (bannerId == GachaService.LimitedBannerId)
{
RenderLimitedBanner();
return;
}
RenderFutureBanner(bannerId);
}
@@ -193,10 +225,6 @@ namespace KernelPanic.UI
GachaBannerState state = _gachaService.BeginnerState;
_bannerDetail.Add(BuildBannerHero("beginner install media"));
Label title = new("beginner install media");
title.AddToClassList("gacha-detail-title");
_bannerDetail.Add(title);
_bannerDetail.Add(BuildInfoLine("Entropy", _wallet == null ? "--" : _wallet.Balance.ToString()));
_bannerDetail.Add(BuildInfoLine("Commits", _gachaService.PullTokens.ToString()));
_bannerDetail.Add(BuildInfoLine("pulls", $"{state.totalPulls}/{GachaService.BeginnerMaxPulls}"));
@@ -248,10 +276,6 @@ namespace KernelPanic.UI
GachaBannerState state = _gachaService.StandardState;
_bannerDetail.Add(BuildBannerHero("stable branch"));
Label title = new("stable branch");
title.AddToClassList("gacha-detail-title");
_bannerDetail.Add(title);
_bannerDetail.Add(BuildInfoLine("Entropy", _wallet == null ? "--" : _wallet.Balance.ToString()));
_bannerDetail.Add(BuildInfoLine("Commits", _gachaService.PullTokens.ToString()));
_bannerDetail.Add(BuildInfoLine("pulls", state.totalPulls.ToString()));
@@ -310,6 +334,149 @@ namespace KernelPanic.UI
}
}
private void RenderLimitedBanner()
{
GachaBannerState state = _gachaService.LimitedState;
_bannerDetail.Add(BuildBannerHero("feature branch: NixOS"));
_bannerDetail.Add(BuildInfoLine("Entropy", _wallet == null ? "--" : _wallet.Balance.ToString()));
_bannerDetail.Add(BuildInfoLine("Commits", _gachaService.PullTokens.ToString()));
_bannerDetail.Add(BuildInfoLine("pulls", state.totalPulls.ToString()));
_bannerDetail.Add(BuildInfoLine("4-star pity", $"{state.pityCounter}/{GachaService.FourStarHardPity}"));
_bannerDetail.Add(BuildInfoLine("5-star pity", $"{state.fiveStarPityCounter}/{GachaService.FiveStarHardPity}"));
_bannerDetail.Add(BuildInfoLine("featured guarantee", state.featuredFiveStarGuaranteed ? "armed" : "not armed"));
_bannerDetail.Add(BuildInfoLine("cost", $"{GachaService.LimitedSinglePullCost} Commit / {GachaService.LimitedTenPullCost} for ten"));
Label rules = new("Featured 5-star distro: NixOS. A 4-star package or featured Fedora/Ubuntu is guaranteed every 10 pulls. Five-star odds ramp from pull 66 and guarantee by pull 80. A 5-star first splits between package and distro; a non-featured 5-star distro arms the next distro hit as guaranteed NixOS.");
rules.AddToClassList("gacha-rules");
_bannerDetail.Add(rules);
VisualElement actions = new();
actions.AddToClassList("gacha-actions");
Button singleButton = new(() => RequestPullSelectedBanner(1))
{
text = $"git pull --single\n{GachaService.LimitedSinglePullCost}x {GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)}"
};
singleButton.AddToClassList("terminal-button");
singleButton.AddToClassList("gacha-action-button");
singleButton.SetEnabled(CanAttemptLimitedPull(1));
actions.Add(singleButton);
Button tenButton = new(() => RequestPullSelectedBanner(10))
{
text = $"git pull --ten\n{GachaService.LimitedTenPullCost}x {GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)}"
};
tenButton.AddToClassList("terminal-button");
tenButton.AddToClassList("gacha-action-button");
tenButton.SetEnabled(CanAttemptLimitedPull(10));
actions.Add(tenButton);
_bannerDetail.Insert(_bannerDetail.IndexOf(rules), actions);
if (_pendingPullCount > 0) _bannerDetail.Add(BuildEntropyPrompt());
if (_resultBannerId == GachaService.LimitedBannerId &&
(_resultRewardLines.Count > 0 || !string.IsNullOrWhiteSpace(_resultText)))
_bannerDetail.Add(BuildPullResultReveal());
}
private void RenderPullHistory()
{
if (_pullHistoryDialog == null) return;
TerminalTheme.PreserveFocus(_pullHistoryDialog);
_pullHistoryDialog.Clear();
bool emptyHistory = _gachaService.PullHistory.Count == 0;
_pullHistoryDialog.EnableInClassList("is-empty", emptyHistory);
VisualElement header = new();
header.AddToClassList("package-equip-header");
header.AddToClassList("terminal-pane-titlebar");
Label title = new("[ git log --pulls ]");
title.AddToClassList("gacha-detail-title");
header.Add(title);
Button close = new(ClosePullHistory) { name = "ClosePullHistory", text = "x", focusable = true };
close.AddToClassList("modal-close-button");
header.Add(close);
_pullHistoryDialog.Add(header);
if (emptyHistory)
{
Label command = new("$ git log --pulls --all");
command.AddToClassList("gacha-history-command");
_pullHistoryDialog.Add(command);
Label empty = new("fatal: no committed pulls found\n" +
"hint: completed pull receipts appear after rewards are committed");
empty.AddToClassList("gacha-rules");
empty.AddToClassList("gacha-history-empty");
_pullHistoryDialog.Add(empty);
return;
}
_pullHistoryDialog.Add(BuildInfoLine("retention", $"latest {GachaService.MaxPullHistoryEntries} transactions"));
_pullHistoryDialog.Add(BuildInfoLine("entries", _gachaService.PullHistory.Count.ToString()));
for (int i = 0; i < _gachaService.PullHistory.Count; i++)
{
GachaPullHistoryEntry entry = _gachaService.PullHistory[i];
string payment = entry.entropySpent > 0 ? $"{entry.entropySpent} Entropy" : $"{entry.currencySpent} Commits";
string timestamp = DateTime.TryParse(entry.pulledUtc, out DateTime parsed)
? parsed.ToLocalTime().ToString("yyyy-MM-dd HH:mm")
: entry.pulledUtc;
Foldout transaction = new()
{
text = $"{timestamp} {GetBannerTitle(entry.bannerId)} [{entry.rewards.Count}] -{payment}",
value = i == 0
};
transaction.AddToClassList("gacha-result-block");
for (int rewardIndex = 0; rewardIndex < entry.rewards.Count; rewardIndex++)
{
GachaPullHistoryRewardEntry reward = entry.rewards[rewardIndex];
string duplicateUnit = reward.rewardType == GachaRewardType.Package ? "Cache" : "Merges";
string status = reward.outcomeKind switch
{
PullOutcomeKind.Granted => " NEW",
PullOutcomeKind.Dupe => $" +{reward.duplicateValue} {duplicateUnit}",
PullOutcomeKind.DupeOverflow => $" +{reward.duplicateValue} {duplicateUnit}",
_ => reward.guaranteed ? " guaranteed" : reward.pityTriggered ? " pity" : string.Empty
};
Label line = new($"{rewardIndex + 1:00}: {reward.stars}★ {reward.displayName}{status}");
line.AddToClassList("gacha-result-card");
line.AddToClassList(RarityClassForStars(reward.stars));
transaction.Add(line);
}
_pullHistoryDialog.Add(transaction);
}
}
private void EnsurePullHistoryOverlay()
{
if (_root == null || _pullHistoryOverlay != null) return;
_pullHistoryOverlay = new VisualElement { name = "GachaPullHistoryOverlay" };
TerminalTheme.ConstrainModalFocus(_pullHistoryOverlay);
_pullHistoryOverlay.AddToClassList("modal-overlay");
_pullHistoryOverlay.AddToClassList("gacha-pull-history-overlay");
_pullHistoryOverlay.AddToClassList("hidden");
_pullHistoryOverlay.RegisterCallback<KeyDownEvent>(evt => evt.StopPropagation());
_pullHistoryOverlay.RegisterCallback<KeyDownEvent>(evt =>
{
if (evt.keyCode != KeyCode.Escape) return;
ClosePullHistory();
evt.StopImmediatePropagation();
}, TrickleDown.TrickleDown);
_pullHistoryDialog = new ScrollView(ScrollViewMode.Vertical) { name = "GachaPullHistoryDialog" };
_pullHistoryDialog.horizontalScrollerVisibility = ScrollerVisibility.Hidden;
_pullHistoryDialog.AddToClassList("gacha-pull-history-dialog");
_pullHistoryDialog.AddToClassList("dialog-scroll");
_pullHistoryDialog.AddToClassList("terminal-pane");
_pullHistoryOverlay.Add(_pullHistoryDialog);
_root.Add(_pullHistoryOverlay);
}
private void ClosePullHistory()
{
_pullHistoryOverlay?.RemoveFromClassList("modal-open");
_pullHistoryOverlay?.AddToClassList("hidden");
if (_pullHistoryReturnFocus?.panel != null) _pullHistoryReturnFocus.Focus();
_pullHistoryReturnFocus = null;
}
private void EnsureSelectorOverlay()
{
if (_root == null || _selectorOverlay != null)
@@ -332,6 +499,7 @@ namespace KernelPanic.UI
_selectorDialog = new ScrollView(ScrollViewMode.Vertical);
_selectorDialog.AddToClassList("five-star-selector-dialog");
_selectorDialog.AddToClassList("dialog-scroll");
_selectorDialog.AddToClassList("terminal-pane");
_selectorOverlay.Add(_selectorDialog);
_root.Add(_selectorOverlay);
}
@@ -376,13 +544,14 @@ namespace KernelPanic.UI
VisualElement header = new();
header.AddToClassList("package-equip-header");
header.AddToClassList("terminal-pane-titlebar");
string stepTitle = _selectorStep switch
{
SelectorStep.Character => "5-star selector: choose a standard character",
SelectorStep.Equipment => "5-star selector: choose standard equipment",
_ => "5-star selector"
};
Label title = new(stepTitle);
Label title = new($"[ {stepTitle} ]");
title.AddToClassList("gacha-detail-title");
header.Add(title);
Button close = new(CloseFiveStarSelector) { text = "x", focusable = true };
@@ -500,7 +669,8 @@ namespace KernelPanic.UI
return;
}
if (bannerId != GachaService.BeginnerBannerId && bannerId != GachaService.StandardBannerId)
if (bannerId != GachaService.BeginnerBannerId && bannerId != GachaService.StandardBannerId
&& bannerId != GachaService.LimitedBannerId)
{
_resultBannerId = bannerId;
_resultText = $"git pull origin {bannerId}: remote not implemented yet";
@@ -511,9 +681,13 @@ namespace KernelPanic.UI
}
PullPaymentSource source = entropyTokenCount > 0 ? PullPaymentSource.Entropy : PullPaymentSource.Commits;
GachaPullResult result = bannerId == GachaService.BeginnerBannerId
? _gachaService.PerformBeginnerPull(pullCount, _wallet, source)
: _gachaService.PerformStandardPull(pullCount, _wallet, source);
GachaPullResult result = bannerId switch
{
GachaService.BeginnerBannerId => _gachaService.PerformBeginnerPull(pullCount, _wallet, source),
GachaService.StandardBannerId => _gachaService.PerformStandardPull(pullCount, _wallet, source),
GachaService.LimitedBannerId => _gachaService.PerformLimitedPull(pullCount, _wallet, source),
_ => GachaPullResult.Failed(bannerId, "remote not implemented yet")
};
if (!result.Success)
{
_resultBannerId = bannerId;
@@ -683,7 +857,8 @@ namespace KernelPanic.UI
private void RequestPullSelectedBanner(int pullCount)
{
string bannerId = _bannerIds[_selectedBannerIndex];
if (bannerId != GachaService.BeginnerBannerId && bannerId != GachaService.StandardBannerId)
if (bannerId != GachaService.BeginnerBannerId && bannerId != GachaService.StandardBannerId
&& bannerId != GachaService.LimitedBannerId)
{
PullSelectedBanner(pullCount, 0);
return;
@@ -796,6 +971,17 @@ namespace KernelPanic.UI
_gachaService.RootCredits > 0);
}
private bool CanAttemptLimitedPull(int pullCount)
{
if (_gachaService.CanAffordPull(pullCount, _wallet, PullPaymentSource.Commits, GachaService.LimitedBannerId, out _))
return true;
int cost = _gachaService.GetPullCost(GachaService.LimitedBannerId, pullCount);
int missingTokens = _gachaService.GetMissingPullTokens(GachaCurrencyType.StandardPull, cost);
return missingTokens > 0 &&
((_wallet != null && _wallet.Balance >= cost * GachaService.EntropyPerCommit) ||
_gachaService.RootCredits > 0);
}
private void ClearEntropyPrompt()
{
_pendingPullCount = 0;
@@ -811,24 +997,25 @@ namespace KernelPanic.UI
artRow.AddToClassList("gacha-hero-art-row");
IReadOnlyList<DistroDefinition> distros = _distroDatabase == null ? Array.Empty<DistroDefinition>() : _distroDatabase.AllDistros;
int artCount = Mathf.Min(3, distros.Count);
for (int i = 0; i < artCount; i++)
List<DistroDefinition> heroDistros = new();
if (bannerTitle.IndexOf("NixOS", StringComparison.OrdinalIgnoreCase) >= 0)
{
artRow.Add(BuildDistroArtCard(distros[i]));
for (int i = 0; i < distros.Count; i++)
if (string.Equals(distros[i]?.Id, GachaService.LimitedFeaturedFiveStarDistroId, StringComparison.OrdinalIgnoreCase))
heroDistros.Add(distros[i]);
}
for (int i = 0; i < distros.Count && heroDistros.Count < 3; i++)
if (distros[i] != null && !heroDistros.Contains(distros[i])) heroDistros.Add(distros[i]);
for (int i = 0; i < heroDistros.Count; i++) artRow.Add(BuildDistroArtCard(heroDistros[i]));
if (artCount == 0)
if (heroDistros.Count == 0)
{
Label empty = new("ascii art unavailable");
empty.AddToClassList("gacha-rules");
artRow.Add(empty);
}
Label title = new(bannerTitle);
title.AddToClassList("gacha-hero-title");
hero.Add(artRow);
hero.Add(title);
return hero;
}
@@ -892,7 +1079,9 @@ namespace KernelPanic.UI
{
GachaService.BeginnerBannerId => _gachaService.IsBeginnerBannerAvailable ? $"{_gachaService.BeginnerState.totalPulls}/{GachaService.BeginnerMaxPulls}" : "closed",
GachaService.StandardBannerId => _gachaService.PendingStandardFiveStarSelectors > 0 ? "selector ready" : $"{_gachaService.GetStandardFiveStarSelectorProgress()}/{GachaService.StandardFiveStarSelectorInterval}",
GachaService.LimitedBannerId => "soon",
GachaService.LimitedBannerId => _gachaService.LimitedState.featuredFiveStarGuaranteed
? "featured guaranteed"
: $"{_gachaService.LimitedState.fiveStarPityCounter}/{GachaService.FiveStarHardPity}",
_ => "--"
};
}
@@ -907,5 +1096,16 @@ namespace KernelPanic.UI
_ => bannerId
};
}
private static string GetBannerRef(string bannerId)
{
return bannerId switch
{
GachaService.BeginnerBannerId => "beginner",
GachaService.StandardBannerId => "stable",
GachaService.LimitedBannerId => "feature/nixos",
_ => "remote/" + bannerId
};
}
}
}
@@ -78,6 +78,7 @@ namespace KernelPanic.UI
{
GachaService.BeginnerBannerId => gacha.PerformBeginnerPull(pending.PullCount, wallet, paymentSource),
GachaService.StandardBannerId => gacha.PerformStandardPull(pending.PullCount, wallet, paymentSource),
GachaService.LimitedBannerId => gacha.PerformLimitedPull(pending.PullCount, wallet, paymentSource),
_ => GachaPullResult.Failed(pending.BannerId, "remote not implemented yet")
};
@@ -138,6 +139,7 @@ namespace KernelPanic.UI
completedRewards.Add(new CompletedGachaReward(i + 1, reward.StarRating, displayName, reward.RewardType, outcomeKind, merges, languages, reward.Guaranteed, reward.PityTriggered, display));
}
gacha.RecordPullHistory(result, completedRewards, DateTime.UtcNow);
WriteState(saveService, saveData, wallet, collection, gacha);
return new CompletedGachaPull(result.BannerId, string.Join(" / ", header), completedRewards, gacha.PendingStandardFiveStarSelectors);
}
+94 -23
View File
@@ -19,6 +19,7 @@ namespace KernelPanic.UI
{
internal static class TerminalFontResolver
{
private const string BundledFontResourcePath = "Fonts/JetBrainsMono-Regular";
private static readonly string[] PreferredMonospaceFontFamilies =
{
"Consolas",
@@ -46,8 +47,12 @@ namespace KernelPanic.UI
return _runtimeMonospaceFont;
}
Font dynamicFont = Font.CreateDynamicFontFromOSFont(PreferredMonospaceFontFamilies, 16);
if (dynamicFont == null)
// Keep metrics and ASCII alignment identical on every supported platform.
// The OS lookup remains as a recovery path for development projects that
// deliberately remove the bundled font.
Font sourceFont = Resources.Load<Font>(BundledFontResourcePath);
sourceFont ??= Font.CreateDynamicFontFromOSFont(PreferredMonospaceFontFamilies, 16);
if (sourceFont == null)
{
if (!_warnedMissingFont)
{
@@ -58,7 +63,7 @@ namespace KernelPanic.UI
return null;
}
_runtimeMonospaceFont = FontAsset.CreateFontAsset(dynamicFont);
_runtimeMonospaceFont = FontAsset.CreateFontAsset(sourceFont);
return _runtimeMonospaceFont;
}
}
@@ -229,12 +234,12 @@ namespace KernelPanic.UI
TerminalTheme.ConstrainModalFocus(_root.Q("RootCreditExchangeModal"));
Toggle motion = _root.Q<Toggle>("ReducedMotionToggle");
motion.SetValueWithoutNotify(UIPreferences.ReducedMotion);
motion.text = UIPreferences.ReducedMotion ? "[ true ]" : "[ false ]";
motion.text = UIPreferences.ReducedMotion ? "true" : "false";
motion.RegisterValueChangedCallback(evt =>
{
UIPreferences.ReducedMotion = evt.newValue;
UIPreferences.Save();
motion.text = evt.newValue ? "[ true ]" : "[ false ]";
motion.text = evt.newValue ? "true" : "false";
_root.EnableInClassList("reduced-motion", evt.newValue);
_shellRoot.EnableInClassList("reduced-motion", evt.newValue);
if (evt.newValue && !_bootIntroPanel.ClassListContains(HiddenClassName)) CompleteBootIntro();
@@ -242,12 +247,13 @@ namespace KernelPanic.UI
});
Button textSize = _root.Q<Button>("TextSizeButton");
Button density = _root.Q<Button>("DensityButton");
_root.Q<Button>("SoundVolumeButton").clicked += () =>
SliderInt soundVolume = _root.Q<SliderInt>("SoundVolumeSlider");
soundVolume.RegisterValueChangedCallback(evt =>
{
UIPreferences.SoundVolume = (UIPreferences.SoundVolume / 25 + 1) % 5 * 25;
UIPreferences.SoundVolume = evt.newValue;
UIPreferences.Save();
RefreshPreferenceControls();
};
RefreshSoundVolumeControl();
});
textSize.clicked += () =>
{
UIPreferences.TextSize = UIPreferences.TextSize == UITextSize.Standard ? UITextSize.Large : UITextSize.Standard;
@@ -267,10 +273,20 @@ namespace KernelPanic.UI
{
Toggle motion = _root.Q<Toggle>("ReducedMotionToggle");
motion.SetValueWithoutNotify(UIPreferences.ReducedMotion);
motion.text = UIPreferences.ReducedMotion ? "[ true ]" : "[ false ]";
_root.Q<Button>("TextSizeButton").text = UIPreferences.TextSize == UITextSize.Large ? "[ large ]" : "[ standard ]";
_root.Q<Button>("DensityButton").text = UIPreferences.Density == UILayoutDensity.Comfortable ? "[ comfortable ]" : "[ compact ]";
_root.Q<Button>("SoundVolumeButton").text = UIPreferences.SoundVolume == 0 ? "[ muted ]" : $"[ {UIPreferences.SoundVolume}% ]";
motion.text = UIPreferences.ReducedMotion ? "true" : "false";
_root.Q<Button>("TextSizeButton").text = UIPreferences.TextSize == UITextSize.Large ? "large" : "standard";
_root.Q<Button>("DensityButton").text = UIPreferences.Density == UILayoutDensity.Comfortable ? "comfortable" : "compact";
RefreshSoundVolumeControl();
}
private void RefreshSoundVolumeControl()
{
SliderInt slider = _root.Q<SliderInt>("SoundVolumeSlider");
slider.SetValueWithoutNotify(UIPreferences.SoundVolume);
int filled = Mathf.RoundToInt(UIPreferences.SoundVolume / 10f);
string meter = new string('#', filled) + new string('-', 10 - filled);
_root.Q<Label>("SoundVolumeValue").text = UIPreferences.SoundVolume == 0
? "[----------] muted" : $"[{meter}] {UIPreferences.SoundVolume}%";
}
private void ComposeMetaServices()
@@ -285,6 +301,10 @@ namespace KernelPanic.UI
private void OnEnable()
{
// A script import can re-enable the scene component before Awake has rebound the
// UIDocument. The next normal Play-mode enable follows the usual Awake -> OnEnable
// order; this guard only protects that editor/domain-reload edge.
if (_root == null) return;
RegisterCallbacks();
_root.Focus();
_root.EnableInClassList("reduced-motion", UIPreferences.ReducedMotion);
@@ -322,7 +342,7 @@ namespace KernelPanic.UI
private void OnDisable()
{
UnregisterCallbacks();
if (_root != null) UnregisterCallbacks();
_blinkSchedule?.Pause();
_backgroundLog?.Stop();
_bootIntroSchedule?.Pause();
@@ -926,9 +946,15 @@ namespace KernelPanic.UI
private void ClaimDailyQuest(DailyQuestKind kind, long period)
{
if (PersistenceBlocked || _runLaunchPending) return;
bool completionBonusWasClaimed = DailyQuests.CompletionBonusClaimed(_saveData.dailyQuests);
bool claimed = DailyQuests.Claim(_saveData, kind, period, DateTime.UtcNow);
bool completionBonusAwarded = claimed && !completionBonusWasClaimed
&& DailyQuests.CompletionBonusClaimed(_saveData.dailyQuests);
if (claimed)
{
_wallet.SetBalance(_saveData.entropyBalance);
_gachaService.SetCurrencyBalance(GachaCurrencyType.StandardPull, _saveData.commitsBalance);
}
// Balances and the claim bit are committed in the same atomic save.
// On failure the existing recovery dialog blocks spending until retry succeeds.
SaveCurrentState();
@@ -939,7 +965,12 @@ namespace KernelPanic.UI
if (feedback != null && claimed && !PersistenceBlocked)
{
var reward = DailyQuests.Reward(kind);
feedback.text = $"[ OK ] Daily task completed.\n[ OK ] +{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited.";
int commits = DailyQuests.CommitReward(kind);
string commitText = commits > 0 ? $" +{commits} Commit{(commits == 1 ? string.Empty : "s")} deposited." : string.Empty;
feedback.text = $"[ OK ] Daily task completed.\n[ OK ] +{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited.{commitText}";
if (completionBonusAwarded)
feedback.text += $"\n[ BONUS ] All {DailyQuests.Count} tasks: +{DailyQuests.CompletionBonusBandwidth} Bandwidth, "
+ $"+{DailyQuests.CompletionBonusEntropy} Entropy, +{DailyQuests.CompletionBonusCommits} Commits.";
feedback.style.display = DisplayStyle.Flex;
}
else if (feedback != null && PersistenceBlocked) feedback.style.display = DisplayStyle.None;
@@ -2543,6 +2574,12 @@ namespace KernelPanic.UI
_dailyQuestReturnToPrompt = true;
return;
}
if (index == 7)
{
ShowGacha();
gachaScreen.OpenPullHistory();
return;
}
_commandEntries[index].Activate();
_root.Focus();
}
@@ -2587,24 +2624,58 @@ namespace KernelPanic.UI
string detail = valid
? $"{DistroPresentation.DisplayName(distro)} v{last.distroVersion}; {string.Join(" + ", last.languages)}. Uses the saved build and upgrade levels."
: string.IsNullOrWhiteSpace(last?.distroId) ? "No previous build saved. Start a run to enable retries." : failure;
actions.Add(TerminalLayout.Heading("[last build]"));
actions.Add(TerminalLayout.BodyText(detail, "LastRunBuildSummary", "run-archive-summary"));
actions.Add(TerminalLayout.Heading("$ history --runs --format=table"));
var columns = TerminalLayout.BodyText("# TIMESTAMP DISTRO SEED WAVE EXIT", className: "run-archive-columns");
actions.Add(columns);
if (_saveData?.recentRuns == null || _saveData.recentRuns.Count == 0)
{
actions.Add(TerminalLayout.BodyText("history: no completed runs (exit 1)", "RunArchiveEmpty", "run-archive-empty"));
}
else
{
int visible = Mathf.Min(RunHistory.Capacity, _saveData.recentRuns.Count);
for (int i = 0; i < visible; i++)
actions.Add(TerminalLayout.BodyText(FormatRunHistoryRow(i + 1, _saveData.recentRuns[i]),
$"RunArchiveRow{i}", "run-archive-table-row"));
}
actions.Add(TerminalLayout.BodyText("# saved build", className: "run-archive-section-label"));
actions.Add(TerminalLayout.BodyText((valid ? "ready: " : "unavailable: ") + detail,
"LastRunBuildSummary", "run-archive-summary"));
var commandsRow = new VisualElement();
commandsRow.AddToClassList("run-archive-commands");
var same = new Button(() => RetryLastRun(true))
{
name = "RetrySameSeedButton", text = "retry last run / same seed",
name = "RetrySameSeedButton", text = "$ retry --build=last --seed=same",
tooltip = valid && !last.hasRunSeed ? "The previous run has no saved seed. Repeat the build with a new seed instead." : detail
};
same.AddToClassList("terminal-button");
same.AddToClassList("run-archive-command");
same.SetEnabled(valid && last.hasRunSeed);
actions.Add(same);
var fresh = new Button(() => RetryLastRun(false)) { name = "RetryNewSeedButton", text = "repeat build / new seed", tooltip = detail };
commandsRow.Add(same);
var fresh = new Button(() => RetryLastRun(false)) { name = "RetryNewSeedButton", text = "$ retry --build=last --seed=random", tooltip = detail };
fresh.AddToClassList("terminal-button");
fresh.AddToClassList("run-archive-command");
fresh.SetEnabled(valid);
actions.Add(fresh);
commandsRow.Add(fresh);
var history = new Button(OpenRunHistory) { name = "RecentRunsButton", text = "recent runs" };
var history = new Button(OpenRunHistory) { name = "RecentRunsButton", text = "$ history --runs --inspect" };
history.AddToClassList("terminal-button");
actions.Add(history);
history.AddToClassList("run-archive-command");
commandsRow.Add(history);
actions.Add(commandsRow);
}
private static string FormatRunHistoryRow(int index, RunHistoryEntry entry)
{
if (entry == null) return $"{index,2} <corrupt entry>";
string timestamp = DateTimeOffset.TryParse(entry.endedUtc, out var ended)
? ended.ToLocalTime().ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture)
: "unknown";
string distro = entry.distroName ?? entry.distroId ?? "unknown";
if (distro.Length > 16) distro = distro.Substring(0, 15) + "~";
string exit = entry.victory ? "0" : entry.surrendered ? "130" : "1";
return $"{index,2} {timestamp,-16} {distro,-16} {entry.seed,10} {entry.waveReached,4} {exit}";
}
private void AddResumeRunControl(VisualElement actions)
+12 -5
View File
@@ -23,26 +23,33 @@ namespace KernelPanic.UI
var dialog = new VisualElement();
dialog.AddToClassList("root-credit-dialog");
dialog.AddToClassList("run-history-dialog");
dialog.AddToClassList("terminal-pane");
dialog.style.width = Length.Percent(94);
dialog.style.maxWidth = 760;
dialog.style.maxHeight = Length.Percent(92);
bool empty = entries == null || entries.Count == 0;
dialog.EnableInClassList("is-empty", empty);
overlay.Add(dialog);
dialog.Add(SoftwareCardView.Text($"RECENT RUNS / last {RunHistory.Capacity}", "section-title"));
var titleBar = new VisualElement();
titleBar.AddToClassList("terminal-pane-titlebar");
titleBar.Add(SoftwareCardView.Text("[ history --runs --inspect ]", "section-title"));
dialog.Add(titleBar);
dialog.Add(new Label { name = "RunHistoryNotice", enableRichText = false });
dialog.Q<Label>("RunHistoryNotice").style.whiteSpace = WhiteSpace.Normal;
var scroll = new ScrollView(ScrollViewMode.Vertical);
scroll.style.flexShrink = 1;
scroll.style.flexGrow = 1;
scroll.style.flexGrow = empty ? 0 : 1;
scroll.style.minHeight = 0;
scroll.horizontalScrollerVisibility = ScrollerVisibility.Hidden;
dialog.Add(scroll);
if (entries == null || entries.Count == 0)
scroll.Add(Text("No completed runs yet. Your next run report will appear here."));
if (empty)
scroll.Add(Text("history: No completed runs (exit 1)"));
else for (int index = 0; index < entries.Count; index++)
{
var entry = entries[index];
if (entry == null) continue;
var item = new VisualElement();
item.AddToClassList("run-history-entry");
item.style.marginBottom = 16;
item.Add(Text($"{entry.distroName ?? entry.distroId} V{entry.distroVersion} / {entry.languages}"));
item.Add(Text($"Wave {entry.waveReached} reached / {entry.wavesCleared} cleared / seed {entry.seed}"));
@@ -100,7 +107,7 @@ namespace KernelPanic.UI
item.Add(copySeed);
scroll.Add(item);
}
var dismiss = new Button(close) { text = "Close [Esc]", name = "CloseRunHistory" };
var dismiss = new Button(close) { text = "[ Esc ] close", name = "CloseRunHistory" };
dismiss.AddToClassList("terminal-button");
dismiss.style.flexShrink = 0;
dialog.Add(dismiss);
+13 -3
View File
@@ -72,7 +72,8 @@ namespace KernelPanic.UI
body.AddToClassList("software-body");
// Break at a sentence boundary only. Never reinterpret effect amounts or conditions.
int split = displayRules.IndexOf(". ", System.StringComparison.Ordinal);
body.Add(Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect"));
int lineNumber = 1;
body.Add(CodeLine(lineNumber++, Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect")));
if (split >= 0)
{
string details = displayRules.Substring(split + 2);
@@ -86,10 +87,10 @@ namespace KernelPanic.UI
var rule = new VisualElement();
rule.AddToClassList("software-python-rule");
rule.Add(Text(line, "software-conditions"));
body.Add(rule);
body.Add(CodeLine(lineNumber++, rule));
}
}
else body.Add(Text(details, "software-conditions"));
else body.Add(CodeLine(lineNumber, Text(details, "software-conditions")));
}
target.Add(body);
@@ -111,5 +112,14 @@ namespace KernelPanic.UI
label.AddToClassList(className);
return label;
}
private static VisualElement CodeLine(int number, VisualElement content)
{
var row = new VisualElement();
row.AddToClassList("software-code-line");
row.Add(Text(number.ToString("00"), "software-line-number"));
row.Add(content);
return row;
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ namespace KernelPanic.UI
internal static readonly string[] Commands =
{
"./start_run", "ls ~/collection", "curl gacha.sh | sh", "dpkg-reconfigure", "history --runs", "shutdown -h now",
"cat /etc/cron.daily/quests"
"cat /etc/cron.daily/quests", "git log --pulls"
};
private readonly List<string> _history = new();
private readonly TextField _input;
+9 -104
View File
@@ -18,11 +18,14 @@ namespace KernelPanic.UI
if (sheet != null) root.styleSheets.Add(sheet);
StyleSheet readability = Resources.Load<StyleSheet>("Readability");
if (readability != null) root.styleSheets.Add(readability);
StyleSheet program = Resources.Load<StyleSheet>("TerminalProgram");
if (program != null) root.styleSheets.Add(program);
root.RegisterCallback<GeometryChangedEvent>(evt =>
{
root.EnableInClassList("compact", evt.newRect.width < 1100);
root.EnableInClassList("narrow", evt.newRect.width < 760);
root.EnableInClassList("short-screen", evt.newRect.height < 760);
root.EnableInClassList("very-short-screen", evt.newRect.height < 520);
});
AttachPreferences(root);
root.RegisterCallback<FocusInEvent>(evt =>
@@ -35,7 +38,7 @@ namespace KernelPanic.UI
scroll.contentContainer.Contains(control))
scroll.ScrollTo(control);
});
AttachHints(root);
SuppressAutomaticTooltips(root);
}
private static void AttachPreferences(VisualElement root)
@@ -106,110 +109,12 @@ namespace KernelPanic.UI
}, TrickleDown.TrickleDown);
}
// UI Toolkit's editor tooltip window is not available in standalone players.
// Use the same tooltip strings for pointer and keyboard inspection at runtime.
private static void AttachHints(VisualElement root)
// Dense terminal screens should never grow a new row merely because focus or the
// pointer moved. Keep tooltip text on controls for deliberate inspectors and tests,
// but suppress Unity's automatic floating tooltip window as well.
private static void SuppressAutomaticTooltips(VisualElement root)
{
var hint = new ScrollView(ScrollViewMode.Vertical) { focusable = false };
hint.AddToClassList("runtime-hint");
hint.style.display = DisplayStyle.None;
hint.horizontalScrollerVisibility = ScrollerVisibility.Hidden;
hint.verticalScrollerVisibility = ScrollerVisibility.Auto;
hint.contentContainer.focusable = false;
hint.contentViewport.focusable = false;
foreach (var control in new VisualElement[] { hint.verticalScroller, hint.verticalScroller.slider,
hint.verticalScroller.lowButton, hint.verticalScroller.highButton })
control.focusable = false;
var body = new Label { pickingMode = PickingMode.Ignore, enableRichText = false, name = "RuntimeHintText" };
body.style.whiteSpace = WhiteSpace.Normal;
body.style.flexShrink = 0;
hint.Add(body);
VisualElement owner = null;
IVisualElementScheduledItem pending = null;
IVisualElementScheduledItem pendingHide = null;
IVisualElementScheduledItem refresh = null;
bool InsideHint(VisualElement element) => element == hint || (element != null && hint.Contains(element));
void Hide()
{
pending?.Pause();
pendingHide?.Pause();
refresh?.Pause();
owner = null;
hint.style.display = DisplayStyle.None;
}
void RefreshVisible()
{
if (owner?.panel == null || owner.resolvedStyle.display == DisplayStyle.None || string.IsNullOrWhiteSpace(owner.tooltip))
{ Hide(); return; }
body.text = owner.tooltip;
float width = Mathf.Max(1, Mathf.Min(380, root.layout.width - 24));
float heightLimit = Mathf.Max(1, root.layout.height - 24);
// Reserve the vertical scrollbar in the measurement so long descriptions wrap
// inside the viewport instead of growing the popup beyond the window edge.
float measured = body.MeasureTextSize(body.text, Mathf.Max(1, width - 44),
VisualElement.MeasureMode.Exactly, 0, VisualElement.MeasureMode.Undefined).y;
float height = Mathf.Min(heightLimit, Mathf.Max(44, measured + 24));
hint.style.width = width;
hint.style.maxWidth = width;
hint.style.height = height;
hint.style.maxHeight = heightLimit;
Vector2 point = root.WorldToLocal(owner.worldBound.min);
hint.style.left = Mathf.Clamp(point.x, 12, Mathf.Max(12, root.layout.width - width - 12));
hint.style.top = Mathf.Clamp(point.y - height - 8, 12, Mathf.Max(12, root.layout.height - height - 12));
}
void Inspect(VisualElement element)
{
pendingHide?.Pause();
if (InsideHint(element)) return;
while (element != null && element != root && string.IsNullOrWhiteSpace(element.tooltip)) element = element.parent;
if (element == null || element == root)
{
// Allow the pointer to cross the small gap from the inspected item to its popup.
pendingHide = root.schedule.Execute(Hide).StartingIn(180);
return;
}
if (owner == element) return;
Hide();
owner = element;
pending = root.schedule.Execute(() =>
{
if (owner?.panel == null || owner.resolvedStyle.display == DisplayStyle.None) { Hide(); return; }
if (hint.parent == null) root.Add(hint);
hint.BringToFront();
hint.style.display = DisplayStyle.Flex;
hint.scrollOffset = Vector2.zero;
RefreshVisible();
refresh ??= root.schedule.Execute(RefreshVisible).Every(100);
refresh.Resume();
}).StartingIn(450);
}
root.RegisterCallback<PointerOverEvent>(evt => Inspect(evt.target as VisualElement));
root.RegisterCallback<FocusInEvent>(evt => Inspect(evt.target as VisualElement));
root.RegisterCallback<PointerLeaveEvent>(_ => Hide());
root.RegisterCallback<FocusOutEvent>(_ => Hide());
root.RegisterCallback<PointerDownEvent>(evt => { if (!InsideHint(evt.target as VisualElement)) Hide(); }, TrickleDown.TrickleDown);
root.RegisterCallback<WheelEvent>(evt => { if (!InsideHint(evt.target as VisualElement)) Hide(); }, TrickleDown.TrickleDown);
root.RegisterCallback<KeyDownEvent>(evt =>
{
var focused = root.focusController?.focusedElement as VisualElement;
if (owner != null && hint.style.display.value != DisplayStyle.None &&
(focused == owner || (focused != null && owner.Contains(focused))) &&
(evt.keyCode == KeyCode.PageDown || evt.keyCode == KeyCode.PageUp))
{
float direction = evt.keyCode == KeyCode.PageDown ? 1 : -1;
hint.scrollOffset = new Vector2(0, Mathf.Clamp(hint.scrollOffset.y + direction * hint.contentViewport.layout.height * 0.8f,
0, hint.verticalScroller.highValue));
evt.StopImmediatePropagation();
return;
}
Hide();
}, TrickleDown.TrickleDown);
root.RegisterCallback<DetachFromPanelEvent>(_ => Hide());
root.RegisterCallback<TooltipEvent>(evt => evt.StopImmediatePropagation(), TrickleDown.TrickleDown);
}
public static void SetDistro(VisualElement root, DistroDefinition distro)
+11
View File
@@ -370,6 +370,17 @@ public class CampaignTests
Assert.That(_run.RewardsSettled, Is.False);
}
[Test]
public void CommitMilestonesPayAtFiveBossAndEndlessIntervals()
{
var method=typeof(RunManager).GetMethod("CalculateCommitReward",BindingFlags.Static|BindingFlags.NonPublic);
Assert.That(method,Is.Not.Null);
Assert.That(method.Invoke(null,new object[]{4}),Is.EqualTo(0));
Assert.That(method.Invoke(null,new object[]{5}),Is.EqualTo(1));
Assert.That(method.Invoke(null,new object[]{RunJourney.BossWave}),Is.EqualTo(2));
Assert.That(method.Invoke(null,new object[]{15}),Is.EqualTo(1));
}
[Test]
public void PreviewUsesFifoThenLifoCapturedTargetsAndDoesNotConsumeAnything()
{
+49 -17
View File
@@ -49,6 +49,17 @@ public class CollectionLayoutTests
screen.Bind(root, null, null, null, owned);
var scroll = root.Q<ScrollView>("CollectionDetail");
window.position = new Rect(32, 32, 1280, 720);
root.style.width = 1280;
root.style.height = 720;
screen.RefreshUnits(database.AllDistros);
for (int frame = 0; frame < 5; frame++) yield return null;
var columns = scroll.Q<Label>(className: "unit-ls-header");
var firstUnit = scroll.Q<Button>(className: "unit-overview-row");
Assert.That(firstUnit.worldBound.yMin, Is.GreaterThanOrEqualTo(columns.worldBound.yMax - 1));
Assert.That(firstUnit.worldBound.yMin - columns.worldBound.yMax, Is.LessThan(12),
"The distro roster should start immediately below its ls header, not at the bottom of the pane.");
foreach (var size in Viewports)
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
foreach (var density in new[] { UILayoutDensity.Compact, UILayoutDensity.Comfortable })
@@ -68,23 +79,40 @@ public class CollectionLayoutTests
var passive = scroll.Q(className: "unit-passive-section");
Assert.That(identity, Is.Not.Null, context);
Assert.That(passive, Is.Not.Null, context);
var identityTitle = identity.Q<Label>(className: "detail-section-title");
var languages = identity.Q(className: "kv-row");
var description = identity.Q<Label>(className: "collection-detail-description");
var passiveTitle = passive.Q<Label>(className: "detail-section-title");
var rules = passive.Q<Label>(className: "collection-detail-description");
var identityTitle = identity.Q<Label>(className: "unit-overview-section-label");
var facts = identity.Q(className: "unit-overview-facts");
var languages = identity.Q("UnitOverview_languages");
var uptime = identity.Q("UnitOverview_uptime");
var ram = identity.Q("UnitOverview_ram");
var cycles = identity.Q("UnitOverview_cycles");
var description = identity.Q<Label>("UnitOverview_description");
var passiveTitle = passive.Q<Label>(className: "unit-overview-section-label");
var passiveName = passive.Q<Label>("UnitPassive_name");
var rules = passive.Q<Label>("UnitPassive_rules");
Assert.That(identityTitle.text, Is.EqualTo("[host]"), context);
Assert.That(passiveTitle.text, Is.EqualTo("[passive]"), context);
Assert.That(description.text, Is.EqualTo(unit.Description), context);
Assert.That(passiveTitle.text, Is.EqualTo(unit.Passive.Name), context);
Assert.That(passiveName.text, Is.EqualTo(unit.Passive.Name), context);
Assert.That(languages.Q<Label>(className: "unit-overview-fact-value").text,
Is.EqualTo(DistroPresentation.FormatLanguages(unit)), context);
Assert.That(uptime.Q<Label>(className: "unit-overview-fact-value").text,
Is.EqualTo(unit.BaseUptime.ToString()), context);
Assert.That(ram.Q<Label>(className: "unit-overview-fact-value").text,
Is.EqualTo(unit.BaseRam.ToString()), context);
Assert.That(cycles.Q<Label>(className: "unit-overview-fact-value").text,
Is.EqualTo(unit.BaseCyclesPerTurn.ToString()), context);
if (unit.Id == "nixos")
Assert.That(rules.text, Does.Contain("performance: +20% card damage").And.Contain("powersave: -20% card damage").And.Contain("schedutil: +5% card damage"), context);
Assert.That(rules.text, Does.Contain("performance +20% damage").And.Contain("powersave -20% damage").And.Contain("schedutil +5% damage"), context);
else
Assert.That(rules.text, Is.EqualTo(unit.Passive.RulesText), context);
float copyGap = density == UILayoutDensity.Comfortable ? 14 : 10;
float sectionGap = density == UILayoutDensity.Comfortable ? 31.5f : 23.5f;
AssertVerticalGap(identityTitle, languages, copyGap, context + ": identity heading");
AssertVerticalGap(languages, description, copyGap, context + ": language row");
AssertVerticalGap(description, passiveTitle, sectionGap, context + ": passive section");
AssertVerticalGap(passiveTitle, rules, copyGap, context + ": passive heading");
Assert.That(identity.Q("UnitConfig_name"), Is.Null, context + ": duplicate name");
Assert.That(identity.Q("UnitConfig_release"), Is.Null, context + ": duplicate release");
Assert.That(identity.Q("UnitConfig_version"), Is.Null, context + ": duplicate version");
Assert.That(identity.Q("UnitConfig_rarity"), Is.Null, context + ": duplicate rarity");
Assert.That(languages.worldBound.yMin, Is.GreaterThan(identityTitle.worldBound.yMin), context);
Assert.That(description.worldBound.yMin, Is.GreaterThanOrEqualTo(facts.worldBound.yMax - 1), context);
Assert.That(passiveTitle.worldBound.yMin, Is.GreaterThan(description.worldBound.yMin), context);
Assert.That(rules.worldBound.yMin, Is.GreaterThan(passiveTitle.worldBound.yMin), context);
Assert.That(rules.resolvedStyle.fontSize, Is.EqualTo(textSize == UITextSize.Large ? 17 : 15), context);
foreach (var section in new[] { identity, passive })
@@ -98,11 +126,15 @@ public class CollectionLayoutTests
Assert.That(label.worldBound.yMax, Is.LessThanOrEqualTo(section.worldBound.yMax + 1), context);
}
}
var flavor = passive.Q<Label>(className: "flavor-text");
if (flavor != null) AssertVerticalGap(rules, flavor, copyGap, context + ": flavor text");
var flavor = passive.Q<Label>("UnitPassive_flavor");
if (flavor != null)
{
Assert.That(flavor.text, Is.EqualTo("# " + unit.Passive.FlavorText), context);
Assert.That(flavor.worldBound.yMin, Is.GreaterThan(rules.worldBound.yMin), context + ": comment");
}
// On a short viewport the document must scroll, retaining the same gaps and text height.
if (size.y == 400)
if (size.y == 400 && scroll.contentContainer.layout.height > scroll.contentViewport.layout.height + 1)
{
Assert.That(scroll.contentContainer.layout.height,
Is.GreaterThan(scroll.contentViewport.layout.height), context + ": scrollable content");
@@ -110,7 +142,7 @@ public class CollectionLayoutTests
scroll.ScrollTo(passive);
for (int frame = 0; frame < 2; frame++) yield return null;
Assert.That(scroll.scrollOffset.y, Is.GreaterThan(0), context);
AssertVerticalGap(passiveTitle, rules, copyGap, context + ": scrolled passive heading");
Assert.That(rules.worldBound.yMin, Is.GreaterThan(passiveTitle.worldBound.yMin), context + ": scrolled passive heading");
AssertTextFits(rules, context);
}
}
+199 -114
View File
@@ -359,6 +359,142 @@ public class CombatLayoutTests
_root.style.height = size.y;
}
[UnityTest]
public IEnumerator CombatUsesProcessRowsCommandTokensAndNarrowPaneSwitching()
{
Resize(new Vector2(1280, 720));
Call(_view, "RefreshEnemies");
Call(_view, "RefreshCommandPrompt");
for (int frame = 0; frame < 4; frame++) yield return null;
var prompt = _root.Q("CombatCommandPrompt");
Assert.That(prompt, Is.Not.Null);
Assert.That(prompt.Q<Label>(className: "syntax-prompt").text, Does.StartWith("player@gentoo"));
Assert.That(prompt.Q<Label>(className: "syntax-command").text, Is.EqualTo("exec"));
Assert.That(prompt.Q<Label>(className: "syntax-argument").text, Does.Contain("--target pid"));
var header = _root.Q("ProcessTableHeader");
CollectionAssert.AreEqual(new[] { "PID", "STATE", "PROCESS", "UPTIME", "SHIELD", "NEXT", "RESULT" },
header.Query<Label>(className: "process-column").ToList().Select(label => label.text).ToArray());
var stateColumn = header.Q<Label>(className: "process-col-state");
var processColumn = header.Q<Label>(className: "process-col-name");
Assert.That(processColumn.worldBound.xMin - stateColumn.worldBound.xMin, Is.GreaterThanOrEqualTo(125));
Assert.That(processColumn.worldBound.width, Is.InRange(230, 250));
var processes = _root.Query<Button>(className: "enemy-card").ToList();
Assert.That(processes.Count, Is.EqualTo(2));
Assert.That(processes.Select(row => row.Q<Label>(className: "process-pid").text).Distinct().Count(), Is.EqualTo(2));
foreach (var process in processes)
{
Assert.That(process.Q<Label>(className: "process-state").text, Is.Not.Empty);
Assert.That(process.Q<Label>(className: "enemy-name").text, Is.Not.Empty);
Assert.That(process.Q(className: "process-col-uptime"), Is.Not.Null);
Assert.That(process.Q("ProcessIntent"), Is.Not.Null);
Assert.That(process.Q<Label>("ProcessResult"), Is.Not.Null);
Assert.That(process.Q<Label>(className: "process-behavior"), Is.Null,
"Lifecycle and intent columns replace the old expanding explanation line.");
}
Resize(new Vector2(390, 844));
for (int frame = 0; frame < 5; frame++) yield return null;
Assert.That(_root.ClassListContains("narrow"), Is.True);
var hand = _root.Q<Button>("CombatPane_hand");
using (var submit = NavigationSubmitEvent.GetPooled())
{
submit.target = hand;
hand.SendEvent(submit);
}
Assert.That(_root.ClassListContains("combat-pane-hand"), Is.True);
Assert.That(hand.ClassListContains("selected"), Is.True);
Assert.That(_root.Q<Button>("CombatPane_processes").ClassListContains("selected"), Is.False);
LogAssert.NoUnexpectedReceived();
}
[UnityTest]
public IEnumerator RestartingZombieCannotWrapLivingTargetsOutOfTheProcessList()
{
var database = AssetDatabase.LoadAssetAtPath<CardDatabase>("Assets/Data/Cards/CardDatabase.asset");
var enemies = (List<EnemyInstance>)_combat.Enemies;
enemies.Clear();
var zombie = new EnemyInstance(EnemyArchetypeCatalog.Get("zombie_process"), 7);
zombie.MarkPendingRevive();
enemies.Add(zombie);
enemies.Add(new EnemyInstance(EnemyArchetypeCatalog.Get("cron_job"), 8));
var fetch = new CardInstance(database.FindById("lang_js_fetch"));
_combat.HandController.Add(fetch);
Assert.That(_combat.PlayCard(fetch), Is.False, "The first play should enter enemy targeting.");
Assert.That(_combat.PendingTargetCard, Is.SameAs(fetch));
Call(_view, "RefreshEnemies");
Resize(new Vector2(1280, 720));
for (int frame = 0; frame < 6; frame++) yield return null;
var rows = _root.Query<Button>(className: "enemy-card").ToList();
Assert.That(rows.Count, Is.EqualTo(2));
var zombieRow = rows.Single(row => row.Q<Label>(className: "enemy-name").text.Contains("Zombie"));
var cronRow = rows.Single(row => row.Q<Label>(className: "enemy-name").text.Contains("Cron"));
Assert.That(zombieRow.parent.resolvedStyle.flexWrap, Is.EqualTo(Wrap.NoWrap));
Assert.That(cronRow.worldBound.xMin, Is.EqualTo(zombieRow.worldBound.xMin).Within(1),
"A taller restarting process must not wrap the next target into an off-screen column.");
Assert.That(cronRow.worldBound.yMin, Is.GreaterThanOrEqualTo(zombieRow.worldBound.yMax - 1));
Assert.That(cronRow.enabledInHierarchy, Is.True);
Assert.That(cronRow.worldBound.width, Is.GreaterThan(100));
using (var submit = NavigationSubmitEvent.GetPooled())
{
submit.target = cronRow;
cronRow.SendEvent(submit);
}
Assert.That(_combat.PendingTargetCard, Is.Null);
Assert.That(_combat.HandController.Cards.Contains(fetch), Is.False,
"The living process below a restarting Zombie must remain selectable.");
LogAssert.NoUnexpectedReceived();
}
[UnityTest]
public IEnumerator DefaultCombatViewCollapsesSecondaryTelemetryUntilRequested()
{
Resize(new Vector2(1280, 720));
Call(_view, "RefreshTracks");
Call(_view, "RefreshHand");
for (int frame = 0; frame < 6; frame++) yield return null;
var scheduler = _root.Q(className: "scheduler");
Assert.That(scheduler.ClassListContains("scheduler-idle"), Is.True);
foreach (var zone in scheduler.Query(className: "track-zone").ToList())
Assert.That(zone.resolvedStyle.display, Is.EqualTo(DisplayStyle.None));
var journal = _root.Q<Foldout>(className: "combat-journal");
Assert.That(journal.value, Is.False, "The full log should be opt-in; its title still reports the latest event.");
for (int i = 0; i < 12; i++)
Call(_view, "AppendCombatLog", $"layout event {i}", "journal-operation");
for (int frame = 0; frame < 3; frame++) yield return null;
var handPanel = _root.Q(className: "hand-panel");
var handViewport = _root.Q<ScrollView>(className: "hand-scroll").contentViewport;
Assert.That(handViewport.worldBound.height, Is.GreaterThanOrEqualTo(210),
"The collapsed journal should leave enough vertical room to inspect a standard card.");
float collapsedHandTop = handPanel.worldBound.yMin;
journal.value = true;
for (int frame = 0; frame < 4; frame++) yield return null;
Assert.That(handPanel.worldBound.yMin, Is.LessThan(collapsedHandTop - 40),
"Opening the journal should lift the hand instead of permanently reserving log space.");
journal.value = false;
for (int frame = 0; frame < 4; frame++) yield return null;
Assert.That(handPanel.worldBound.yMin, Is.EqualTo(collapsedHandTop).Within(2),
"Closing the journal should return the hand to its lower resting position.");
var face = _root.Query<Button>(className: "hand-card").First();
Assert.That(face.Query<Label>(className: "software-line-number").ToList()
.All(label => label.resolvedStyle.display == DisplayStyle.None), Is.True);
var preview = face.Q<Label>(className: "software-live-preview");
Assert.That(preview, Is.Not.Null);
Assert.That(preview.resolvedStyle.display, Is.EqualTo(DisplayStyle.None));
face.Focus();
yield return null;
Assert.That(preview.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex),
"Calculated detail should appear for the card the player is actively inspecting.");
LogAssert.NoUnexpectedReceived();
}
[UnityTest]
public IEnumerator TutorialSpotlightKeepsTargetAndControlsReachableAtEveryViewport()
{
@@ -578,6 +714,22 @@ public class CombatLayoutTests
}
var footer = repository.Q(className: "repository-footer");
Assert.That(footer.worldBound.yMax, Is.LessThanOrEqualTo(_root.worldBound.yMax + 1), context);
var timeshiftToggle = repository.Q<Button>("RepositoryRulesToggle_mint_timeshift");
Assert.That(timeshiftToggle, Is.Not.Null, context);
var timeshiftCard = timeshiftToggle.parent.Q(className: "repository-card-preview");
var timeshiftDetails = timeshiftCard.Query<Label>(className: "software-conditions").ToList();
Assert.That(timeshiftDetails.Count, Is.GreaterThan(0), context);
Assert.That(timeshiftDetails.All(label => label.resolvedStyle.display == DisplayStyle.None), Is.True, context);
using (var submit = NavigationSubmitEvent.GetPooled())
{
submit.target = timeshiftToggle;
timeshiftToggle.SendEvent(submit);
}
for (int frame = 0; frame < 2; frame++) yield return null;
Assert.That(timeshiftCard.ClassListContains("repository-card-expanded"), Is.True, context);
Assert.That(timeshiftDetails.All(label => label.resolvedStyle.display == DisplayStyle.Flex), Is.True, context);
Assert.That(timeshiftToggle.text, Does.Contain("hide full rules"), context);
LogAssert.NoUnexpectedReceived();
}
}
@@ -905,87 +1057,44 @@ public class CombatLayoutTests
}
[UnityTest]
public IEnumerator PlanningActionsAndResultsDialogFitEveryViewport()
public IEnumerator JournalOwnsOptionalActionDetailsWithoutCombatPopups()
{
var view = typeof(CombatSceneController).GetField("_turnResolution", Private).GetValue(_view);
foreach (var size in Viewports)
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
{
UIPreferences.TextSize = textSize;
Resize(size);
Call(_view, "RefreshTurnPanel");
for (int frame = 0; frame < 4; frame++) yield return null;
foreach (string name in new[] { "SaveCombatButton", "OpenTurnResolution" })
{
var control = _root.Q<Button>(name);
Assert.That(control.worldBound.height, Is.GreaterThan(20), name);
AssertContainedHorizontally(control, _root, name);
Assert.That(control.worldBound.yMin, Is.GreaterThanOrEqualTo(_root.worldBound.yMin - 1), name);
Assert.That(control.worldBound.yMax, Is.LessThanOrEqualTo(_root.worldBound.yMax + 1), name);
}
view.GetType().GetMethod("Open").Invoke(view, new object[] { _root });
for (int frame = 0; frame < 4; frame++) yield return null;
var popup = _root.Q("TurnResolutionPopup");
var dialog = popup.Q("TurnResolutionDialog");
AssertContainedHorizontally(dialog, _root, $"{size}/{textSize}");
Assert.That(dialog.worldBound.yMin, Is.GreaterThanOrEqualTo(_root.worldBound.yMin - 1));
Assert.That(dialog.worldBound.yMax, Is.LessThanOrEqualTo(_root.worldBound.yMax + 1));
Assert.That(popup.Q<ScrollView>().contentViewport.worldBound.height, Is.GreaterThan(80));
var close = popup.Q<Button>("CloseTurnResolution");
using (var endTurn = KeyDownEvent.GetPooled('e', KeyCode.E, EventModifiers.None))
{ endTurn.target = close; close.SendEvent(endTurn); }
Assert.That(_combat.CurrentPhase, Is.EqualTo(TurnPhase.Execute));
using (var escape = KeyDownEvent.GetPooled('\0', KeyCode.Escape, EventModifiers.None))
{ escape.target = close; close.SendEvent(escape); }
Assert.That(_root.Q("TurnResolutionPopup"), Is.Null);
Assert.That(_root.Q("ResolutionActions"), Is.Null, "Results must not occupy the battlefield after closing.");
Assert.That(_root.focusController.focusedElement, Is.SameAs(_root.Q<Button>("OpenTurnResolution")));
}
}
Resize(new Vector2(1280, 720));
Assert.That(_root.Q<Button>("OpenExecutionPreview"), Is.Null);
Assert.That(_root.Q<Button>("OpenTurnResolution"), Is.Null);
Assert.That(_root.Q("ExecutionPreviewPopup"), Is.Null);
Assert.That(_root.Q("TurnResolutionPopup"), Is.Null);
[UnityTest]
public IEnumerator ExecutionPreviewWrapsAndDoesNotDisplaceDispatchControls()
{
var preview = _root.Q<Button>("OpenExecutionPreview");
var view = typeof(CombatSceneController).GetField("_executionPreview", Private).GetValue(_view);
view.GetType().GetMethod("Refresh").Invoke(view, new object[] { _combat });
foreach (var size in Viewports)
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
{
UIPreferences.TextSize = textSize;
Resize(size);
Call(_view, "RefreshTurnPanel");
for (int frame = 0; frame < 3; frame++) yield return null;
var before = _root.Q<ScrollView>(className: "combat-workspace").worldBound;
using (var submit = NavigationSubmitEvent.GetPooled()) { submit.target = preview; preview.SendEvent(submit); }
for (int frame = 0; frame < 5; frame++) yield return null;
var popup = _root.Q("ExecutionPreviewPopup");
Assert.That(popup, Is.Not.Null, "Preview must always open as a dialog.");
var scroll = popup.Q<ScrollView>();
Assert.That(popup.Query(className: "execution-step").ToList().Count, Is.EqualTo(6));
var workspace = _root.Q<ScrollView>(className: "combat-workspace");
Assert.That(workspace.worldBound, Is.EqualTo(before), "Opening the preview must not shift the battlefield.");
var visiblePreview = popup.Q("ExecutionPreviewDialog");
var availableArea = _root;
Assert.That(visiblePreview.worldBound.yMin, Is.GreaterThanOrEqualTo(availableArea.worldBound.yMin - 1));
Assert.That(visiblePreview.worldBound.yMax, Is.LessThanOrEqualTo(availableArea.worldBound.yMax + 1));
foreach (var label in scroll.Query<Label>(className: "terminal-body").ToList())
AssertContainedHorizontally(label, scroll.contentViewport, $"{size}/{textSize}");
Assert.That(_root.Q<Button>(className: "primary-action").worldBound.yMax,
Is.LessThanOrEqualTo(_root.worldBound.yMax + 1));
if (popup != null)
{
var close = popup.Q<Button>("CloseExecutionPreview");
using (var endTurn = KeyDownEvent.GetPooled('e', KeyCode.E, EventModifiers.None))
{ endTurn.target = close; close.SendEvent(endTurn); }
Assert.That(_combat.CurrentPhase, Is.EqualTo(TurnPhase.Execute), "Preview must consume combat shortcuts.");
using (var escape = KeyDownEvent.GetPooled('\0', KeyCode.Escape, EventModifiers.None))
{ escape.target = close; close.SendEvent(escape); }
Assert.That(_root.Q("ExecutionPreviewPopup"), Is.Null);
Assert.That(_root.Q("ExecutionPreviewSteps"), Is.Null);
Assert.That(_root.focusController.focusedElement, Is.SameAs(preview));
}
}
var trace = (CombatExecutionTrace)typeof(CombatSceneController)
.GetField("_executionTrace", Private).GetValue(_view);
Assert.That(trace, Is.Not.Null);
var action = new ExecutionAction();
typeof(ExecutionAction).GetProperty("Stage").SetValue(action, "FIFO");
typeof(ExecutionAction).GetProperty("Label").SetValue(action, "print()");
typeof(ExecutionAction).GetProperty("Complete").SetValue(action, true);
typeof(ExecutionAction).GetProperty("UptimeDamage").SetValue(action, 12L);
action.Details.Add("print() resolved / queue / FIFO");
action.DamageBreakdowns.Add("Zombie Process / base 12 - Shield 0 = 12 Uptime");
var actions = (List<ExecutionAction>)typeof(CombatExecutionTrace)
.GetField("_actions", Private).GetValue(trace);
actions.Add(action);
Call(_view, "RefreshJournalActionResults");
var journal = _root.Q<Foldout>(className: "combat-journal");
journal.value = true;
for (int frame = 0; frame < 5; frame++) yield return null;
var result = _root.Q<Foldout>(className: "journal-action-result");
Assert.That(result, Is.Not.Null);
Assert.That(result.text, Does.Contain("[FIFO] print() · done · 12 damage"));
Assert.That(result.value, Is.False, "Detailed calculations should remain opt-in.");
result.value = true;
for (int frame = 0; frame < 2; frame++) yield return null;
var damage = result.Q<Label>(className: "journal-action-damage");
Assert.That(damage, Is.Not.Null);
Assert.That(damage.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex));
Assert.That(damage.text, Does.Contain("base 12"));
Assert.That(_root.Q<Button>("SaveCombatButton"), Is.Not.Null);
LogAssert.NoUnexpectedReceived();
}
[UnityTest]
@@ -1239,7 +1348,7 @@ public class CombatLayoutTests
}
[UnityTest]
public IEnumerator MintPackageStatusAndNotificationsStayInsideCompactRows()
public IEnumerator PackagesDoNotReserveHostSpaceAndActivationFeedbackStaysTransient()
{
var packages = AssetDatabase.LoadAssetAtPath<PackageDatabase>("Assets/Data/Packages/PackageDatabase.asset");
var mint = AssetDatabase.LoadAssetAtPath<DistroDefinition>("Assets/Data/Distros/Mint.asset");
@@ -1248,39 +1357,29 @@ public class CombatLayoutTests
.Select(id => new PackageInstance(packages.FindById(id), 5)).ToArray(), 17, 5));
var activation = _root.Q<Label>("PackageActivation");
Assert.That(activation.style.display.value, Is.EqualTo(DisplayStyle.None));
Assert.That(_root.Q("CombatPackages"), Is.Null);
Assert.That(_root.Q("PackageReadiness"), Is.Null);
foreach (var size in Viewports)
foreach (var textSize in new[] { UITextSize.Standard, UITextSize.Large })
{
UIPreferences.TextSize = textSize;
Resize(size);
Call(_view, "RefreshPackageReadiness");
Call(_view, "RefreshPlayer");
for (int frame = 0; frame < 5; frame++) yield return null;
string context = $"{size}/{textSize}";
var strip = _root.Q("PackageReadiness");
Assert.That(_root.Q(className: "player-panel").Contains(strip), Is.True, "Packages belong with the host.");
foreach (var chip in strip.Query(className: "package-readiness-chip").ToList())
{
AssertContainedHorizontally(chip, strip, context);
Assert.That(chip.worldBound.height, Is.LessThan(70), context);
foreach (var label in chip.Query<Label>().ToList())
{
AssertContainedHorizontally(label, chip, context);
Assert.That(label.worldBound.yMin, Is.GreaterThanOrEqualTo(chip.worldBound.yMin), context);
Assert.That(label.worldBound.yMax, Is.LessThanOrEqualTo(chip.worldBound.yMax), context);
}
Assert.That(chip.tooltip, Does.Contain(chip.Q<Label>(className: "package-readiness-state").text));
}
Assert.That(_root.Q("CombatPackages"), Is.Null, context);
Assert.That(_root.Q("PackageReadiness"), Is.Null, context);
Call(_view, "HandlePackageActivated", new PackageActivation("pkg_mint_timeshift", "Timeshift", "Full recovery notification with enough detail to overflow a narrow screen if it wraps"));
Call(_view, "HandlePackageActivated", new PackageActivation("pkg_mint_cinnamon", "Cinnamon", "JavaScript damage increased for this round"));
for (int frame = 0; frame < 3; frame++) yield return null;
AssertContainedHorizontally(activation, strip.parent, context);
AssertContainedHorizontally(activation, _root.Q(className: "player-panel"), context);
Assert.That(activation.worldBound.height, Is.LessThan(30), context);
Assert.That(activation.tooltip, Is.EqualTo(activation.text));
}
}
[UnityTest]
public IEnumerator LivePreviewsAndPackageReadinessWrapAndRetainKeyboardFocus()
public IEnumerator LivePreviewsRemainReadableWithoutPersistentPackageRows()
{
var packages = AssetDatabase.LoadAssetAtPath<PackageDatabase>("Assets/Data/Packages/PackageDatabase.asset");
var config = new RunConfig(_gentoo, Language.Haskell, Language.C, _gentoo.ExclusiveCards.Take(4).ToArray(),
@@ -1295,27 +1394,13 @@ public class CombatLayoutTests
UIPreferences.TextSize = textSize;
UIPreferences.Density = density;
Resize(size);
Call(_view, "RefreshPackageReadiness");
Call(_view, "RefreshHand");
for (int frame = 0; frame < 6; frame++) yield return null;
string context = $"{size}, {textSize}, {density}";
var strip = _root.Q("PackageReadiness");
var chips = strip.Query(className: "package-readiness-chip").ToList();
Assert.That(chips.Count, Is.EqualTo(3), context);
foreach (var chip in chips)
{
AssertContainedHorizontally(chip, strip, context);
Assert.That(chip.worldBound.height, Is.GreaterThan(16), context);
Assert.That(chip.tooltip, Does.Contain("\n"), context);
foreach (var label in chip.Query<Label>().ToList())
AssertContainedHorizontally(label, chip, context);
}
var ccache = _root.Q("Readiness_pkg_gentoo_ccache");
ccache.Focus();
Call(_view, "RefreshPackageReadiness");
Assert.That(_root.focusController.focusedElement, Is.SameAs(ccache), context);
Assert.That(_root.Q("CombatPackages"), Is.Null, context);
Assert.That(_root.Q("PackageReadiness"), Is.Null, context);
Call(_view, "RefreshPlayer");
Assert.That(_root.Q("PackageReadiness"), Is.SameAs(strip), "Refreshing host stats must retain installed packages.");
Assert.That(_root.Q("CombatPackages"), Is.Null, context);
foreach (var face in _root.Query(className: "hand-card").ToList())
{
var preview = face.Q<Label>(className: "software-live-preview");
+30 -12
View File
@@ -18,13 +18,18 @@ public class DailyQuestLayoutTests
{
var state = new DailyQuestState
{
selectedQuests = new[] { DailyQuestKind.Cards, DailyQuestKind.Damage, DailyQuestKind.Waves },
selectedQuests = new[]
{
DailyQuestKind.Cards, DailyQuestKind.Damage, DailyQuestKind.Waves,
DailyQuestKind.BlockDamage, DailyQuestKind.NativeCards
},
cards = 15, damage = 200, waves = 3, claimedMask = 1 << (int)DailyQuestKind.Waves,
refreshAtUtcTicks = DateTime.UtcNow.AddHours(12).Ticks
};
var widget = DailyQuestView.BuildWidget(state, DateTime.UtcNow, () => { });
Assert.That(widget.tooltip, Is.Empty, "The terminal widget must not spawn a native floating tooltip over the menu.");
Assert.That(widget.Q<Label>("DailyQuestRewardReady").text, Is.EqualTo("1 reward ready"));
Assert.That(widget.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("2/3 completed"));
Assert.That(widget.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("2/5 completed"));
Assert.That(widget.Q<Label>("DailyQuestClaimed").text, Is.EqualTo("1 claimed"));
foreach (var child in widget.Query<VisualElement>().ToList().Where(child => child != widget))
Assert.That(child.pickingMode, Is.EqualTo(PickingMode.Ignore), "Every part of the widget belongs to its button.");
@@ -35,6 +40,14 @@ public class DailyQuestLayoutTests
Assert.That(overlay.Q<Button>("ClaimDailyQuestCards").enabledSelf, Is.False);
Assert.That(overlay.Q<Button>("ClaimDailyQuestDamage").enabledSelf, Is.True);
Assert.That(overlay.Q<Button>("ClaimDailyQuestWaves").enabledSelf, Is.False);
Assert.That(overlay.Q<Label>("DailyQuestCompletionBonusStatus").text, Does.Contain("waiting for all five jobs to exit 0"));
Assert.That(overlay.Q<Label>(className: "daily-service-title").text, Is.EqualTo("[ crontab -l ]"));
Assert.That(overlay.Q("DailyQuestCards").Q<Label>(className: "daily-cron-entry").text,
Is.EqualTo("0 0 * * * /etc/cron.daily/play-cards"));
Assert.That(overlay.Q("DailyQuestDamage").Q<Label>(className: "daily-exit-status").text,
Does.Contain("exit=0").And.Contain("reward=pending"));
Assert.That(overlay.Q("DailyQuestCompletionBonus").Query<Label>().ToList().Select(label => label.text),
Does.Contain($"+{DailyQuests.CompletionBonusBandwidth} Bandwidth / +{DailyQuests.CompletionBonusEntropy} Entropy / +{DailyQuests.CompletionBonusCommits} Commits"));
Assert.That(overlay.Q("DailyQuestCards").Q<Label>(className: "daily-detail-progress").text, Is.EqualTo("[######....]"));
foreach (var label in overlay.Query<Label>(className: "daily-detail-progress").ToList())
Assert.That(label.text.Length, Is.EqualTo(12));
@@ -69,6 +82,8 @@ public class DailyQuestLayoutTests
var featured = new FeaturedUnitPanel();
featured.Bind(root, null);
featured.Refresh(new[] { AssetDatabase.LoadAssetAtPath<DistroDefinition>("Assets/Data/Distros/Ubuntu.asset") });
Assert.That(root.Q("FeaturedUnitPanel").tooltip, Is.Empty,
"The neofetch preview must not spawn a native floating tooltip over the menu.");
var scroll = root.Q<ScrollView>(className: "home-scroll");
// 1024x576 also covers 1280x720 with the player's 1.25 panel scale.
foreach (var size in new[] { new Vector2(1920, 1080), new Vector2(1366, 768), new Vector2(1280, 720), new Vector2(1024, 576), new Vector2(390, 844), new Vector2(960, 400) })
@@ -82,8 +97,8 @@ public class DailyQuestLayoutTests
var data = SaveData.CreateDefault();
var now = DateTime.UtcNow;
DailyQuests.Refresh(data.dailyQuests, now);
data.dailyQuests.selectedQuests = new[] { DailyQuests.Pool[group],
DailyQuests.Pool[(group + 1) % DailyQuests.Pool.Count], DailyQuests.Pool[(group + 2) % DailyQuests.Pool.Count] };
data.dailyQuests.selectedQuests = Enumerable.Range(0, DailyQuests.Count)
.Select(offset => DailyQuests.Pool[(group + offset) % DailyQuests.Pool.Count]).ToArray();
foreach (var kind in DailyQuests.Active(data.dailyQuests))
DailyQuests.Record(data.dailyQuests, kind, int.MaxValue, now);
var host = root.Q("DailyQuestsHost");
@@ -106,7 +121,7 @@ public class DailyQuestLayoutTests
scroll.scrollOffset = Vector2.zero;
for (int frame = 0; frame < 6; frame++) yield return null;
string context = $"{size}, {textSize}";
Assert.That(host.Query(className: "daily-service-entry").ToList().Count, Is.EqualTo(3), context);
Assert.That(host.Query(className: "daily-service-entry").ToList().Count, Is.EqualTo(DailyQuests.Count), context);
Assert.That(host.Q<ProgressBar>(), Is.Null);
Assert.That(host.parent, Is.SameAs(root.Q("FeaturedUnitPanel").parent));
Assert.That(host.worldBound.yMin, Is.GreaterThanOrEqualTo(root.Q("FeaturedUnitPanel").worldBound.yMax - 1), context);
@@ -138,15 +153,16 @@ public class DailyQuestLayoutTests
Assert.That(dialog.worldBound.xMax, Is.LessThanOrEqualTo(size.x + 1), context);
Assert.That(dialog.worldBound.yMin, Is.GreaterThanOrEqualTo(0), context);
Assert.That(dialog.worldBound.yMax, Is.LessThanOrEqualTo(size.y + 1), context);
Assert.That(dialog.worldBound.center.x, Is.EqualTo(overlay.worldBound.center.x).Within(1),
context + ": dialog is horizontally centered");
Assert.That(dialog.worldBound.center.y, Is.EqualTo(overlay.worldBound.center.y).Within(1),
context + ": dialog is vertically centered");
var details = overlay.Q<ScrollView>("DailyQuestDetailScroll");
// Include the two-line confirmation in the desktop fit requirement.
var feedback = overlay.Q<Label>("DailyQuestFeedback");
feedback.text = "[ OK ] Daily task completed.\n[ OK ] +250 Bandwidth, +125 Entropy deposited.";
feedback.style.display = DisplayStyle.Flex;
for (int frame = 0; frame < 3; frame++) yield return null;
if (size.x >= 1024 && size.y >= 576)
Assert.That(details.contentContainer.worldBound.height, Is.LessThanOrEqualTo(details.contentViewport.worldBound.height + 1),
context + ": all three tasks fit without scrolling, including feedback");
if (size.y <= 400)
Assert.That(details.contentContainer.worldBound.height, Is.GreaterThan(details.contentViewport.worldBound.height), context + ": short viewports scroll");
var headerBounds = overlay.Q("DailyQuestHeader").worldBound;
@@ -154,7 +170,7 @@ public class DailyQuestLayoutTests
{
var reward = DailyQuests.Reward(kind);
Assert.That(details.Q("DailyQuest" + kind).Query<Label>().ToList().Select(label => label.text),
Does.Contain($"+{reward.Bandwidth} Bandwidth / +{reward.Entropy} Entropy"));
Has.Some.StartsWith($"+{reward.Bandwidth} Bandwidth / +{reward.Entropy} Entropy"));
}
foreach (var label in details.Query<Label>().ToList())
{
@@ -174,9 +190,11 @@ public class DailyQuestLayoutTests
submit.target = button;
button.SendEvent(submit);
}
Assert.That(data.bandwidthBalance, Is.EqualTo(DailyQuests.Active(data.dailyQuests).Sum(kind => DailyQuests.Reward(kind).Bandwidth)));
Assert.That(data.entropyBalance, Is.EqualTo(DailyQuests.Active(data.dailyQuests).Sum(kind => DailyQuests.Reward(kind).Entropy)));
Assert.That(host.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("3/3 completed"));
Assert.That(data.bandwidthBalance, Is.EqualTo(DailyQuests.Active(data.dailyQuests).Sum(kind => DailyQuests.Reward(kind).Bandwidth)
+ DailyQuests.CompletionBonusBandwidth));
Assert.That(data.entropyBalance, Is.EqualTo(DailyQuests.Active(data.dailyQuests).Sum(kind => DailyQuests.Reward(kind).Entropy)
+ DailyQuests.CompletionBonusEntropy));
Assert.That(host.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("5/5 completed"));
Assert.That(host.Q("DailyQuestRewardReady").style.display.value, Is.EqualTo(DisplayStyle.None));
using (var escape = KeyDownEvent.GetPooled(new Event { type = EventType.KeyDown, keyCode = KeyCode.Escape }))
{
+88 -11
View File
@@ -34,7 +34,7 @@ public class DailyQuestTests
public void TearDown() => Directory.Delete(_directory, true);
[Test]
public void LegacyDataStartsWithThreeEmptyQuestsWithoutChangingBalances()
public void LegacyDataStartsWithFiveEmptyQuestsWithoutChangingBalances()
{
var data = JsonUtility.FromJson<SaveData>("{\"entropyBalance\":73,\"bandwidthBalance\":129}");
data.EnsureLists();
@@ -96,8 +96,10 @@ public class DailyQuestTests
data = _save.Load();
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.False);
}
Assert.That(data.bandwidthBalance, Is.EqualTo(325));
Assert.That(data.entropyBalance, Is.EqualTo(150));
Assert.That(data.bandwidthBalance, Is.EqualTo(750));
Assert.That(data.entropyBalance, Is.EqualTo(350));
Assert.That(data.commitsBalance, Is.EqualTo(3));
Assert.That(DailyQuests.CompletionBonusClaimed(data.dailyQuests), Is.True);
DailyQuests.Refresh(data.dailyQuests, Start.AddDays(1));
var nextQuest = DailyQuests.Active(data.dailyQuests)[0];
DailyQuests.Record(data.dailyQuests, nextQuest, int.MaxValue, Start.AddDays(1));
@@ -117,7 +119,7 @@ public class DailyQuestTests
public void DifficultyRewardsPayExactAmountsOnceAcrossReload(DailyQuestKind kind, int bandwidth, int entropy)
{
var data = FixedQuests();
data.dailyQuests.selectedQuests = new[] { kind }.Concat(DailyQuests.Pool.Where(other => other != kind).Take(2)).ToArray();
data.dailyQuests.selectedQuests = new[] { kind }.Concat(DailyQuests.Pool.Where(other => other != kind).Take(DailyQuests.Count - 1)).ToArray();
data.bandwidthBalance = 37;
data.entropyBalance = 19;
long period = data.dailyQuests.refreshAtUtcTicks;
@@ -130,6 +132,7 @@ public class DailyQuestTests
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.False);
Assert.That(data.bandwidthBalance, Is.EqualTo(37 + bandwidth));
Assert.That(data.entropyBalance, Is.EqualTo(19 + entropy));
Assert.That(data.commitsBalance, Is.EqualTo(DailyQuests.CommitReward(kind)));
Assert.That(data.dailyQuests.refreshAtUtcTicks, Is.EqualTo(period));
Assert.That(DailyQuests.Progress(data.dailyQuests, kind), Is.EqualTo(DailyQuests.Target(kind)));
}
@@ -140,7 +143,7 @@ public class DailyQuestTests
foreach (var kind in DailyQuests.Pool)
{
var data = FixedQuests();
data.dailyQuests.selectedQuests = new[] { kind }.Concat(DailyQuests.Pool.Where(other => other != kind).Take(2)).ToArray();
data.dailyQuests.selectedQuests = new[] { kind }.Concat(DailyQuests.Pool.Where(other => other != kind).Take(DailyQuests.Count - 1)).ToArray();
DailyQuests.Record(data.dailyQuests, kind, int.MaxValue, Start);
long period = data.dailyQuests.refreshAtUtcTicks;
var reward = DailyQuests.Reward(kind);
@@ -155,11 +158,21 @@ public class DailyQuestTests
Assert.That(data.entropyBalance, Is.EqualTo(entropy));
Assert.That(DailyQuests.Claimed(data.dailyQuests, kind), Is.False);
}
if (DailyQuests.CommitReward(kind) > 0)
{
data.bandwidthBalance = int.MaxValue - reward.Bandwidth;
data.entropyBalance = int.MaxValue - reward.Entropy;
data.commitsBalance = int.MaxValue;
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.False, kind + " Commit overflow");
Assert.That(DailyQuests.Claimed(data.dailyQuests, kind), Is.False);
}
data.bandwidthBalance = int.MaxValue - reward.Bandwidth;
data.entropyBalance = int.MaxValue - reward.Entropy;
data.commitsBalance = int.MaxValue - DailyQuests.CommitReward(kind);
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.True);
Assert.That(data.bandwidthBalance, Is.EqualTo(int.MaxValue));
Assert.That(data.entropyBalance, Is.EqualTo(int.MaxValue));
Assert.That(data.commitsBalance, Is.EqualTo(int.MaxValue));
}
}
@@ -260,8 +273,8 @@ public class DailyQuestTests
var now = Start.AddDays(day);
Assert.That(DailyQuests.Refresh(data.dailyQuests, now), Is.True);
var active = DailyQuests.Active(data.dailyQuests).ToArray();
Assert.That(active.Length, Is.EqualTo(3));
Assert.That(active.Distinct().Count(), Is.EqualTo(3));
Assert.That(active.Length, Is.EqualTo(DailyQuests.Count));
Assert.That(active.Distinct().Count(), Is.EqualTo(DailyQuests.Count));
Assert.That(active.All(kind => DailyQuests.Pool.Contains(kind)), Is.True);
if (previous != null) Assert.That(active, Is.Not.EquivalentTo(previous));
foreach (var kind in active) seen.Add(kind);
@@ -284,14 +297,70 @@ public class DailyQuestTests
data.dailyQuests.cards = 7;
data.dailyQuests.claimedMask = 1;
Assert.That(DailyQuests.Refresh(data.dailyQuests, Start), Is.True);
Assert.That(DailyQuests.Active(data.dailyQuests), Is.EqualTo(new[] { DailyQuestKind.Waves, DailyQuestKind.Cards, DailyQuestKind.Damage }));
Assert.That(DailyQuests.Active(data.dailyQuests), Is.EqualTo(new[]
{
DailyQuestKind.Waves, DailyQuestKind.Cards, DailyQuestKind.Damage,
DailyQuestKind.BlockDamage, DailyQuestKind.NativeCards
}));
Assert.That(data.dailyQuests.waves, Is.EqualTo(3));
Assert.That(data.dailyQuests.cards, Is.EqualTo(7));
Assert.That(DailyQuests.Claim(data, DailyQuestKind.Waves, data.dailyQuests.refreshAtUtcTicks, Start), Is.False);
DailyQuests.Refresh(data.dailyQuests, Start.AddDays(1));
Assert.That(data.dailyQuests.claimedMask, Is.Zero);
Assert.That(data.dailyQuests.cards, Is.Zero);
Assert.That(DailyQuests.Active(data.dailyQuests), Is.Not.EquivalentTo(new[] { DailyQuestKind.Waves, DailyQuestKind.Cards, DailyQuestKind.Damage }));
Assert.That(DailyQuests.Active(data.dailyQuests), Is.Not.EquivalentTo(new[]
{
DailyQuestKind.Waves, DailyQuestKind.Cards, DailyQuestKind.Damage,
DailyQuestKind.BlockDamage, DailyQuestKind.NativeCards
}));
}
[Test]
public void FifthClaimPaysAllClearBonusExactlyOnceAcrossReload()
{
var data = FixedQuests();
long period = data.dailyQuests.refreshAtUtcTicks;
foreach (var kind in DailyQuests.Active(data.dailyQuests))
DailyQuests.Record(data.dailyQuests, kind, int.MaxValue, Start);
var finalKind = DailyQuests.Active(data.dailyQuests).Last();
foreach (var kind in DailyQuests.Active(data.dailyQuests).Where(kind => kind != finalKind))
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.True);
int bandwidthBefore = data.bandwidthBalance;
int entropyBefore = data.entropyBalance;
int commitsBefore = data.commitsBalance;
Assert.That(DailyQuests.CompletionBonusClaimed(data.dailyQuests), Is.False);
Assert.That(DailyQuests.Claim(data, finalKind, period, Start), Is.True);
Assert.That(data.bandwidthBalance, Is.EqualTo(bandwidthBefore + DailyQuests.Reward(finalKind).Bandwidth + DailyQuests.CompletionBonusBandwidth));
Assert.That(data.entropyBalance, Is.EqualTo(entropyBefore + DailyQuests.Reward(finalKind).Entropy + DailyQuests.CompletionBonusEntropy));
Assert.That(data.commitsBalance, Is.EqualTo(commitsBefore + DailyQuests.CommitReward(finalKind) + DailyQuests.CompletionBonusCommits));
Assert.That(DailyQuests.AllClaimed(data.dailyQuests), Is.True);
Assert.That(DailyQuests.CompletionBonusClaimed(data.dailyQuests), Is.True);
_save.Save(data);
data = _save.Load();
Assert.That(DailyQuests.Claim(data, finalKind, period, Start), Is.False);
Assert.That(DailyQuests.CompletionBonusClaimed(data.dailyQuests), Is.True);
}
[Test]
public void AllClearOverflowLeavesFinalClaimAndEveryBalanceUnchanged()
{
var data = FixedQuests();
long period = data.dailyQuests.refreshAtUtcTicks;
foreach (var kind in DailyQuests.Active(data.dailyQuests))
DailyQuests.Record(data.dailyQuests, kind, int.MaxValue, Start);
var finalKind = DailyQuests.Active(data.dailyQuests).Last();
foreach (var kind in DailyQuests.Active(data.dailyQuests).Where(kind => kind != finalKind))
Assert.That(DailyQuests.Claim(data, kind, period, Start), Is.True);
data.bandwidthBalance = int.MaxValue - DailyQuests.Reward(finalKind).Bandwidth - DailyQuests.CompletionBonusBandwidth + 1;
int bandwidth = data.bandwidthBalance;
int entropy = data.entropyBalance;
int commits = data.commitsBalance;
Assert.That(DailyQuests.Claim(data, finalKind, period, Start), Is.False);
Assert.That(data.bandwidthBalance, Is.EqualTo(bandwidth));
Assert.That(data.entropyBalance, Is.EqualTo(entropy));
Assert.That(data.commitsBalance, Is.EqualTo(commits));
Assert.That(DailyQuests.Claimed(data.dailyQuests, finalKind), Is.False);
Assert.That(DailyQuests.CompletionBonusClaimed(data.dailyQuests), Is.False);
}
[Test]
@@ -312,7 +381,11 @@ public class DailyQuestTests
public void AddedCombatObjectivesCountOnlyTheMatchingGameplay()
{
var data = FixedQuests();
data.dailyQuests.selectedQuests = new[] { DailyQuestKind.BlockDamage, DailyQuestKind.ShieldDamage, DailyQuestKind.NativeCards };
data.dailyQuests.selectedQuests = new[]
{
DailyQuestKind.BlockDamage, DailyQuestKind.ShieldDamage, DailyQuestKind.NativeCards,
DailyQuestKind.SurviveRounds, DailyQuestKind.WaveFive
};
_save.Save(data);
var player = new CombatantState(100, 6, 3);
var enemy = new CombatantState(100, 6, 3);
@@ -327,7 +400,11 @@ public class DailyQuestTests
Assert.That(data.dailyQuests.nativeCards, Is.EqualTo(1));
Assert.That(data.dailyQuests.blockedDamage, Is.EqualTo(9));
Assert.That(data.dailyQuests.shieldDamage, Is.EqualTo(7));
data.dailyQuests.selectedQuests = new[] { DailyQuestKind.SurviveRounds, DailyQuestKind.WaveFive, DailyQuestKind.Waves };
data.dailyQuests.selectedQuests = new[]
{
DailyQuestKind.SurviveRounds, DailyQuestKind.WaveFive, DailyQuestKind.Waves,
DailyQuestKind.BlockDamage, DailyQuestKind.ShieldDamage
};
_save.Save(data);
GameEvents.RaisePhaseChanged(new PhaseChangedEvent(TurnPhase.Allocate, TurnPhase.Execute));
GameEvents.RaisePhaseChanged(new PhaseChangedEvent(TurnPhase.EnemyProcess, TurnPhase.GarbageCollection));
@@ -102,6 +102,53 @@ public class GentooProgressionTests
Assert.That(DistroRarity.Stars(Asset<DistroDefinition>("Assets/Data/Distros/Ubuntu.asset")),Is.EqualTo(4));
}
[Test]
public void FeatureBranchHasIndependentPityAndGuaranteesNixOsAfterAnOffBannerDistro()
{
var service=Service();
var standard=service.PerformStandardPull(1,null,PullPaymentSource.Commits);
Assert.That(standard.Success,Is.True);
Assert.That(service.StandardState.totalPulls,Is.EqualTo(1));
Assert.That(service.LimitedState.totalPulls,Is.Zero);
var offBanner=service.PerformLimitedPull(1,null,PullPaymentSource.Commits);
Assert.That(offBanner.Success,Is.True);
Assert.That(offBanner.Rewards.Single().Distro?.Id,Is.Not.EqualTo(GachaService.LimitedFeaturedFiveStarDistroId));
Assert.That(service.LimitedState.featuredFiveStarGuaranteed,Is.True);
Assert.That(service.StandardState.totalPulls,Is.EqualTo(1));
var guaranteed=service.PerformLimitedPull(1,null,PullPaymentSource.Commits);
Assert.That(guaranteed.Rewards.Single().Distro?.Id,Is.EqualTo(GachaService.LimitedFeaturedFiveStarDistroId));
Assert.That(guaranteed.Rewards.Single().Guaranteed,Is.True);
Assert.That(service.LimitedState.featuredFiveStarGuaranteed,Is.False);
}
[Test]
public void PullHistoryIsNewestFirstBoundedAndRoundTripsWithBannerState()
{
var service=Service();
for(int i=0;i<GachaService.MaxPullHistoryEntries+3;i++)
{
var pull=service.PerformLimitedPull(1,null,PullPaymentSource.Commits);
if(!pull.Success)
{
service.AddCurrency(GachaCurrencyType.StandardPull,100);
pull=service.PerformLimitedPull(1,null,PullPaymentSource.Commits);
}
var reward=pull.Rewards[0];
var completed=new CompletedGachaReward(1,reward.StarRating,$"reward-{i}",reward.RewardType,
PullOutcomeKind.Granted,0,null,reward.Guaranteed,reward.PityTriggered);
service.RecordPullHistory(pull,new[]{completed},new DateTime(2026,1,1,0,i%60,0,DateTimeKind.Utc).AddHours(i/60));
}
Assert.That(service.PullHistory.Count,Is.EqualTo(GachaService.MaxPullHistoryEntries));
Assert.That(service.PullHistory[0].rewards[0].displayName,Is.EqualTo("reward-102"));
var save=SaveData.CreateDefault(); service.WriteProgress(save);
var restored=new GachaService(); restored.LoadProgress(save);
Assert.That(restored.PullHistory.Count,Is.EqualTo(GachaService.MaxPullHistoryEntries));
Assert.That(restored.PullHistory[0].bannerId,Is.EqualTo(GachaService.LimitedBannerId));
Assert.That(restored.LimitedState.totalPulls,Is.EqualTo(service.LimitedState.totalPulls));
}
[Test]
public void BeginnerGuaranteedFifthTenPullRemainsFiveStarDistribution()
{
@@ -479,6 +479,7 @@ public class MenuPersistenceTests
var saved = _save.Load();
Assert.That(saved.entropyBalance, Is.EqualTo(DailyQuests.Reward(DailyQuestKind.Waves).Entropy));
Assert.That(saved.bandwidthBalance, Is.EqualTo(DailyQuests.Reward(DailyQuestKind.Waves).Bandwidth));
Assert.That(saved.commitsBalance, Is.EqualTo(DailyQuests.CommitReward(DailyQuestKind.Waves)));
Assert.That(DailyQuests.Claimed(saved.dailyQuests, DailyQuestKind.Waves), Is.True);
Assert.That(((EntropyWallet)Get("_wallet")).Balance, Is.EqualTo(saved.entropyBalance));
}
@@ -512,7 +513,7 @@ public class MenuPersistenceTests
Call("LoadMetaState");
for (int frame = 0; frame < 4; frame++) yield return null;
var widget = _root.Q<Button>("DailyQuestWidget");
Assert.That(_root.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("2/3 completed"));
Assert.That(_root.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("2/5 completed"));
Assert.That(_root.Q<Label>("DailyQuestRewardReady").text, Is.EqualTo("2 rewards ready"));
Assert.That(_root.Q<Label>("DailyQuestInspect").text, Is.EqualTo("> claim available rewards"));
var position = widget.worldBound.center;
@@ -527,7 +528,7 @@ public class MenuPersistenceTests
Assert.That(claim.text, Is.EqualTo("> CLAIM REWARD"));
Assert.That(_root.Q<Button>("ClaimDailyQuestCards").text, Is.EqualTo("[ in progress ]"));
Assert.That(_root.Q<Button>("ClaimDailyQuestCards").enabledSelf, Is.False);
Assert.That(_root.Q<Label>("DailyQuestDetailSummary").text, Is.EqualTo("3 tasks / 2 completed"));
Assert.That(_root.Q<Label>("DailyQuestDetailSummary").text, Is.EqualTo("5 tasks / 2 completed"));
Assert.That(_root.Q("DailyQuestFeedback").style.display.value, Is.EqualTo(DisplayStyle.None));
claim.Focus();
using (var tab = NavigationMoveEvent.GetPooled(NavigationMoveEvent.Direction.Next))
@@ -546,7 +547,7 @@ public class MenuPersistenceTests
Assert.That(_root.Q<Label>("DailyQuestClaimed").text, Is.EqualTo("1 claimed"));
var reward = DailyQuests.Reward(DailyQuestKind.Waves);
Assert.That(_root.Q<Label>("DailyQuestFeedback").text,
Is.EqualTo($"[ OK ] Daily task completed.\n[ OK ] +{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited."));
Is.EqualTo($"[ OK ] Daily task completed.\n[ OK ] +{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited. +1 Commit deposited."));
Assert.That(_root.Q("DailyQuestFeedback").style.display.value, Is.EqualTo(DisplayStyle.Flex));
Assert.That(_root.focusController.focusedElement, Is.SameAs(_root.Q<Button>("CloseDailyQuests")),
"Repeated Enter must not automatically activate the next reward.");
@@ -582,10 +583,10 @@ public class MenuPersistenceTests
Assert.That(_root.Q<Label>("DailyQuestCountdown").text, Does.StartWith("refresh in 00:04:"));
current.dailyQuests.refreshAtUtcTicks = DateTime.UtcNow.AddSeconds(-1).Ticks;
Call("TickDailyQuests");
Assert.That(_root.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("0/3 completed"));
Assert.That(_root.Q<Label>("DailyQuestCompleted").text, Is.EqualTo("0/5 completed"));
Assert.That(_root.Q("DailyQuestRewardReady").style.display.value, Is.EqualTo(DisplayStyle.None));
Assert.That(_root.Q("DailyQuestOverlay"), Is.Not.Null, "Rollover refreshes the open details.");
Assert.That(_root.Q<Label>("DailyQuestDetailSummary").text, Is.EqualTo("3 tasks / 0 completed"));
Assert.That(_root.Q<Label>("DailyQuestDetailSummary").text, Is.EqualTo("5 tasks / 0 completed"));
Assert.That(_root.Q("DailyQuestFeedback").style.display.value, Is.EqualTo(DisplayStyle.None));
Assert.That(_save.Load().bandwidthBalance, Is.EqualTo(DailyQuests.Reward(DailyQuestKind.Waves).Bandwidth));
Call("CloseDailyQuestDetails");
+7 -34
View File
@@ -179,7 +179,7 @@ public class ReadabilityTests
}
Assert.That(settings.Q<Label>(className: "settings-description").resolvedStyle.fontSize,
Is.EqualTo(size == UITextSize.Large ? 17 : 15), context);
foreach (var control in new VisualElement[] { settings.Q<Toggle>("ReducedMotionToggle"), settings.Q<Button>("TextSizeButton"), settings.Q<Button>("DensityButton"), settings.Q<Button>("SoundVolumeButton") })
foreach (var control in new VisualElement[] { settings.Q<Toggle>("ReducedMotionToggle"), settings.Q<Button>("TextSizeButton"), settings.Q<Button>("DensityButton"), settings.Q<SliderInt>("SoundVolumeSlider") })
{
Assert.That(control.focusable, Is.True, context);
control.Focus();
@@ -254,7 +254,7 @@ public class ReadabilityTests
}
[UnityTest]
public IEnumerator LongRuntimeHintsStayOnscreenScrollWithoutTakingFocusAndRefreshRetainedOwners()
public IEnumerator TooltipsNeverCreateAnAutomaticBottomPanel()
{
RequireGraphics();
var window = ScriptableObject.CreateInstance<TerminalFocusTestWindow>();
@@ -269,42 +269,15 @@ public class ReadabilityTests
UIPreferences.TextSize = UITextSize.Large;
Attach(root);
var owner = new Button { text = "Inspect live card" };
var lines = new string[24];
for (int i = 0; i < lines.Length; i++) lines[i] = "Compilation and equipment modify this card.";
owner.tooltip = string.Join("\n", lines);
owner.tooltip = "Compilation and equipment modify this card.";
root.Add(owner);
owner.Focus();
double waitUntil = EditorApplication.timeSinceStartup + 0.7;
double waitUntil = EditorApplication.timeSinceStartup + 0.35;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
var hint = root.Q<ScrollView>(className: "runtime-hint");
Assert.That(hint, Is.Not.Null);
Assert.That(hint.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex));
Assert.That(hint.worldBound.xMin, Is.GreaterThanOrEqualTo(root.worldBound.xMin));
Assert.That(hint.worldBound.xMax, Is.LessThanOrEqualTo(root.worldBound.xMax));
Assert.That(hint.worldBound.yMin, Is.GreaterThanOrEqualTo(root.worldBound.yMin));
Assert.That(hint.worldBound.yMax, Is.LessThanOrEqualTo(root.worldBound.yMax));
Assert.That(hint.verticalScroller.highValue, Is.GreaterThan(0));
Assert.That(hint.focusable, Is.False);
Assert.That(hint.verticalScroller.slider.focusable, Is.False);
using (var pageDown = KeyDownEvent.GetPooled('\0', KeyCode.PageDown, EventModifiers.None)) owner.SendEvent(pageDown);
yield return null;
Assert.That(hint.scrollOffset.y, Is.GreaterThan(0));
Assert.That(root.Q(className: "runtime-hint"), Is.Null);
Assert.That(root.childCount, Is.EqualTo(1));
Assert.That(owner.tooltip, Is.EqualTo("Compilation and equipment modify this card."));
Assert.That(root.focusController.focusedElement, Is.SameAs(owner));
owner.tooltip = "Updated preview: 24 damage; 7 Shield; cost 1 Cycle.";
waitUntil = EditorApplication.timeSinceStartup + 0.3;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
Assert.That(hint.Q<Label>("RuntimeHintText").text, Is.EqualTo(owner.tooltip));
Assert.That(hint.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex));
root.Clear();
var replacement = new Button { text = "Inspect another card", tooltip = "Current package readiness" };
root.Add(replacement);
replacement.Focus();
waitUntil = EditorApplication.timeSinceStartup + 0.7;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
Assert.That(root.Q<ScrollView>(className: "runtime-hint"), Is.SameAs(hint));
Assert.That(hint.Q<Label>("RuntimeHintText").text, Is.EqualTo(replacement.tooltip));
LogAssert.NoUnexpectedReceived();
}
finally { window.Close(); }
@@ -57,6 +57,7 @@ public class RewardSettlementTests
Directory.CreateDirectory(_save.BackupPath);
Set(_run, "_accruedBandwidth", 7);
Set(_run, "_accruedEntropy", 3);
Set(_run, "_accruedCommits", 2);
Set(_run, "currentWaveNumber", 4);
Settle();
@@ -72,6 +73,7 @@ public class RewardSettlementTests
SaveData settled = _save.Load();
Assert.That(settled.bandwidthBalance, Is.EqualTo(27));
Assert.That(settled.entropyBalance, Is.EqualTo(12));
Assert.That(settled.commitsBalance, Is.EqualTo(2));
Assert.That(settled.GetBestWave("gentoo"), Is.EqualTo(4));
string once = File.ReadAllText(_save.SavePath);
@@ -79,6 +81,7 @@ public class RewardSettlementTests
Assert.That(File.ReadAllText(_save.SavePath), Is.EqualTo(once));
Assert.That(_save.Load().bandwidthBalance, Is.EqualTo(27));
Assert.That(_save.Load().entropyBalance, Is.EqualTo(12));
Assert.That(_save.Load().commitsBalance, Is.EqualTo(2));
}
[Test]
@@ -82,6 +82,7 @@ public class RunCheckpointTests
Set(_run, "_wavesCleared", 2);
Set(_run, "_accruedBandwidth", 9);
Set(_run, "_accruedEntropy", 2);
Set(_run, "_accruedCommits", 3);
_run.AddBits(1000);
_run.GenerateRepositoryOffers(_cards, _languages);
RandomRoll.Seed(config.RunSeed);
@@ -148,6 +149,7 @@ public class RunCheckpointTests
Assert.That(_run.WavesCleared, Is.EqualTo(2));
Assert.That(_run.Bits, Is.EqualTo(1000));
Assert.That(_run.AccruedBandwidth, Is.EqualTo(9));
Assert.That(_run.AccruedCommits, Is.EqualTo(3));
Assert.That(_run.RepositoryVisitActive, Is.True);
Assert.That(_run.IsSuspended, Is.False);
}
+67 -2
View File
@@ -178,6 +178,40 @@ public class TerminalUiTests
}
}
[Test]
public void PullHistoryIsAToolbarModalAndNotABanner()
{
var root = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/UI/MainMenu.uxml").CloneTree();
var screen = new GachaScreenController();
screen.Bind(root, null, null, null, new GachaService(), new PlayerCollection(), new EntropyWallet(),
null, null, () => { }, () => { }, null);
screen.Open();
var bannerList = root.Q("GachaBannerList");
var branches = bannerList.Query<Button>(className: "gacha-banner-row").ToList();
Assert.That(branches.Count, Is.EqualTo(3));
Assert.That(bannerList.Q<Label>(className: "gacha-branch-command").text, Is.EqualTo("$ git branch --list"));
Assert.That(branches[0].Q<Label>(className: "command-cursor").text, Is.EqualTo("*"));
Assert.That(branches[0].Q<Label>(className: "command-text").text, Is.EqualTo("beginner"));
Assert.That(branches[1].Q<Label>(className: "command-text").text, Is.EqualTo("stable"));
Assert.That(branches[2].Q<Label>(className: "command-text").text, Is.EqualTo("feature/nixos"));
Assert.That(bannerList.Q("GachaPullHistoryButton"), Is.Null);
Assert.That(root.Q<Button>("GachaPullHistoryButton"), Is.Not.Null);
Assert.That(root.Q("GachaBannerDetail").Query<Label>(className: "gacha-detail-title").ToList(), Is.Empty,
"The selected branch already identifies the banner; the detail pane should not repeat its title.");
screen.OpenPullHistory();
var overlay = root.Q("GachaPullHistoryOverlay");
Assert.That(overlay, Is.Not.Null);
Assert.That(overlay.ClassListContains("modal-open"), Is.True);
Assert.That(overlay.ClassListContains("hidden"), Is.False);
Assert.That(overlay.Q<Label>(className: "gacha-detail-title").text, Is.EqualTo("[ git log --pulls ]"));
Assert.That(overlay.Q<Label>(className: "gacha-history-empty").text, Does.StartWith("fatal: no committed pulls found"));
Assert.That(overlay.Q<Button>("ClosePullHistory"), Is.Not.Null);
Assert.That(bannerList.Query<Button>(className: "selected").ToList().Count, Is.EqualTo(1),
"Opening history must not replace the selected banner.");
}
[Test]
public void UnitIdentityAndTabsSurviveAllFourDetailViews()
{
@@ -206,6 +240,31 @@ public class TerminalUiTests
Assert.That(root.Q("CollectionContextHeader").ClassListContains("hidden"), Is.True);
}
[Test]
public void UnitOverviewListsEquippedPackageLoadout()
{
var root = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/UI/MainMenu.uxml").CloneTree();
var unit = AssetDatabase.LoadAssetAtPath<DistroDefinition>("Assets/Data/Distros/Ubuntu.asset");
var package = AssetDatabase.LoadAssetAtPath<PackageDefinition>("Assets/Data/Packages/AptFast.asset");
var database = AssetDatabase.LoadAssetAtPath<PackageDatabase>("Assets/Data/Packages/PackageDatabase.asset");
var owned = new PlayerCollection();
owned.Add(unit);
owned.AddPackage(package);
var loadout = new PackageLoadout(owned, database);
Assert.That(loadout.TryEquip(unit.Id, package.Slot, package.Id, out _), Is.True);
var screen = new CollectionScreenController();
screen.Bind(root, null, null, null, owned, packageDatabase: database, packageLoadout: loadout);
screen.RefreshUnits(owned.OwnedUnits);
var row = root.Q<Button>(className: "unit-overview-row");
var packages = row.Q<Label>(className: "unit-loadout-line");
Assert.That(packages, Is.Not.Null);
Assert.That(packages.text, Does.Contain(package.DisplayName));
Assert.That(packages.text, Does.Contain("system=").And.Contain("tools=").And.Contain("services="));
Assert.That(row.tooltip, Does.Contain(package.DisplayName));
}
[Test]
public void InventoryRowsUseCompactMetadataAndKeepEffectsInDetails()
{
@@ -338,7 +397,7 @@ public class TerminalUiTests
var commands = (string[])type.GetField("Commands", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
Assert.That(commands, Is.EqualTo(new[]
{
"./start_run", "ls ~/collection", "curl gacha.sh | sh", "dpkg-reconfigure", "history --runs", "shutdown -h now", "cat /etc/cron.daily/quests"
"./start_run", "ls ~/collection", "curl gacha.sh | sh", "dpkg-reconfigure", "history --runs", "shutdown -h now", "cat /etc/cron.daily/quests", "git log --pulls"
}));
for (int i = 0; i < commands.Length; i++)
{
@@ -349,13 +408,14 @@ public class TerminalUiTests
}
input.value = "./start_run; shutdown";
type.GetMethod("Submit", Private).Invoke(line, null);
Assert.That(activated, Is.EqualTo(6));
Assert.That(activated, Is.EqualTo(7));
Assert.That(root.Q<Label>("CommandOutput").text, Does.Contain("command not found"));
}
[TestCase("his", "history --runs", 4)]
[TestCase("shut", "shutdown -h now", 5)]
[TestCase("cat /etc/cron", "cat /etc/cron.daily/quests", 6)]
[TestCase("git log", "git log --pulls", 7)]
public void ArchiveAndQuitCommandsCompleteAndKeepTheirOwnActionIndices(string prefix, string command, int index)
{
var root = new VisualElement();
@@ -494,7 +554,12 @@ public class TerminalUiTests
Assert.That(root.Q(id), Is.Not.Null, id);
Assert.That(root.Q<TextField>("CommandInput"), Is.Not.Null);
Assert.That(root.Q<Toggle>("ReducedMotionToggle"), Is.Not.Null);
Assert.That(root.Q<SliderInt>("SoundVolumeSlider"), Is.Not.Null);
Assert.That(root.Q<Button>("SoundVolumeButton"), Is.Null);
Assert.That(AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Resources/KernelTheme.uss"), Is.Not.Null);
Assert.That(AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Resources/TerminalProgram.uss"), Is.Not.Null);
Assert.That(AssetDatabase.LoadAssetAtPath<Font>("Assets/Resources/Fonts/JetBrainsMono-Regular.ttf"), Is.Not.Null,
"The terminal must ship one deterministic monospace font instead of depending on the host OS.");
}
}
+3 -3
View File
@@ -6,9 +6,9 @@
</ui:VisualElement>
<ui:VisualElement class="screen-frame-content">
<ui:VisualElement class="collection-actions">
<ui:Button name="CollectionUnitsButton" text="units" class="collection-tab" />
<ui:Button name="CollectionLanguagesButton" text="languages" class="collection-tab" />
<ui:Button name="CollectionPackagesButton" text="packages" class="collection-tab" />
<ui:Button name="CollectionUnitsButton" text="$ ls units/" class="collection-tab" />
<ui:Button name="CollectionLanguagesButton" text="$ ls languages/" class="collection-tab" />
<ui:Button name="CollectionPackagesButton" text="$ dpkg -l" class="collection-tab" />
</ui:VisualElement>
<ui:VisualElement name="CollectionContextHeader" class="collection-context hidden" />
<ui:VisualElement name="CollectionFilters" class="context-filters hidden" />
+10 -5
View File
@@ -5,11 +5,16 @@
<ui:Label class="screen-frame-title" />
</ui:VisualElement>
<ui:VisualElement class="screen-frame-content">
<ui:VisualElement name="GachaContent" class="gacha-shell">
<ui:VisualElement name="GachaBannerList" class="gacha-banner-list" />
<ui:ScrollView name="GachaBannerDetailScroll" class="gacha-banner-detail-scroll">
<ui:VisualElement name="GachaBannerDetail" class="gacha-banner-detail" />
</ui:ScrollView>
<ui:VisualElement name="GachaContent" class="gacha-content">
<ui:VisualElement class="gacha-toolbar">
<ui:Button name="GachaPullHistoryButton" text="git log --pulls&#10;0 saved" class="terminal-button gacha-history-button" />
</ui:VisualElement>
<ui:VisualElement class="gacha-shell">
<ui:VisualElement name="GachaBannerList" class="gacha-banner-list" />
<ui:ScrollView name="GachaBannerDetailScroll" class="gacha-banner-detail-scroll">
<ui:VisualElement name="GachaBannerDetail" class="gacha-banner-detail" />
</ui:ScrollView>
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement class="screen-frame-footer">
+201 -18
View File
@@ -534,6 +534,26 @@ Button {
background-color: var(--kp-panel);
}
.gacha-content {
flex-grow: 1;
min-height: 0;
}
.gacha-toolbar {
flex-direction: row;
justify-content: flex-end;
flex-shrink: 0;
min-height: 38px;
margin-bottom: 8px;
}
.gacha-history-button {
width: 220px;
min-height: 38px;
margin: 0;
white-space: normal;
}
.gacha-shell {
flex-grow: 1;
min-height: 0;
@@ -604,6 +624,20 @@ Button {
transition-duration: 120ms;
}
.gacha-banner-row .command-cursor {
width: 18px;
min-width: 18px;
flex-shrink: 0;
color: var(--kp-primary);
}
.gacha-branch-command {
color: var(--kp-primary-dim);
padding: 8px 12px 5px 12px;
border-bottom-width: 1px;
border-bottom-color: var(--kp-border);
}
.gacha-banner-row:hover,
.gacha-banner-row.selected {
background-color: var(--kp-hover);
@@ -812,8 +846,9 @@ Button {
}
.collection-detail-full .unity-scroll-view__content-container {
flex-grow: 1;
flex-grow: 0;
min-height: 0;
justify-content: flex-start;
}
.collection-detail-readout {
@@ -994,26 +1029,126 @@ Button {
}
.unit-overview-roster {
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
flex-grow: 0;
flex-shrink: 0;
}
.unit-overview-row {
width: 31%;
min-width: 280px;
min-height: 118px;
margin-right: 12px;
margin-bottom: 12px;
padding: 10px 12px;
width: 100%;
min-width: 0;
min-height: 52px;
margin: 0;
padding: 6px 8px;
flex-direction: column;
align-items: stretch;
border-left-width: 2px;
border-right-width: 1px;
border-top-width: 1px;
border-right-width: 0;
border-top-width: 0;
border-bottom-width: 1px;
border-right-color: var(--kp-border);
border-top-color: var(--kp-border);
border-bottom-color: var(--kp-border);
background-color: var(--kp-bg-solid);
border-bottom-color: var(--kp-border-subtle);
background-color: transparent;
}
.collection-ls-command { color: var(--kp-cyan); margin-bottom: 5px; }
.collection-ls-total { color: var(--kp-muted); margin-bottom: 3px; }
.unit-ls-row { width: 100%; flex-direction: row; align-items: center; min-height: 28px; padding: 4px 8px; }
.unit-ls-header { color: var(--kp-primary-dim); border-bottom-width: 1px; border-bottom-color: var(--kp-border); }
.unit-ls-line { flex-grow: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.unit-loadout-line { min-width: 0; margin: 3px 0 0 12px; color: var(--kp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.unit-ls-column { flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.unit-ls-mode { width: 105px; }
.unit-ls-owner { width: 72px; }
.unit-ls-size { width: 48px; }
.unit-ls-version { width: 54px; }
.unit-ls-languages { width: 130px; }
.unit-ls-name { flex-grow: 1; min-width: 100px; }
.unit-config-path { color: var(--kp-cyan); margin-bottom: 3px; }
.unit-config-block { padding: 8px 10px; margin-bottom: 10px; border-left-width: 2px; border-left-color: var(--kp-border-strong); background-color: var(--kp-bg-deep); }
.unit-config-comment { color: var(--kp-primary-dim); white-space: normal; margin-bottom: 4px; }
.unit-config-section { color: var(--kp-cyan); -unity-font-style: bold; margin-top: 4px; margin-bottom: 5px; }
.unit-config-line { flex-direction: row; align-items: flex-start; min-width: 0; margin-bottom: 3px; }
.unit-config-key { width: 112px; min-width: 112px; color: var(--kp-text); }
.unit-config-separator { width: 24px; min-width: 24px; color: var(--kp-primary-dim); }
.unit-config-value { flex-grow: 1; min-width: 0; color: var(--kp-amber); white-space: normal; }
.unit-identity-section {
padding: 4px 0 16px;
border-bottom-width: 1px;
border-bottom-color: var(--kp-border-subtle);
}
.unit-overview-section-label {
color: var(--kp-cyan);
-unity-font-style: bold;
margin-bottom: 8px;
}
.unit-overview-facts {
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
margin-bottom: 12px;
}
.unit-overview-fact {
min-width: 92px;
margin: 0 24px 6px 0;
}
.unit-overview-fact-wide {
min-width: 240px;
}
.unit-overview-fact-key {
color: var(--kp-primary-dim);
font-size: var(--type-meta);
margin-bottom: 2px;
}
.unit-overview-fact-value {
color: var(--kp-amber);
white-space: normal;
}
.unit-overview-description {
max-width: 860px;
color: var(--kp-text);
white-space: normal;
}
.unit-passive-heading {
flex-direction: row;
align-items: center;
flex-wrap: wrap;
margin-bottom: 8px;
}
.unit-passive-heading .unit-overview-section-label {
margin: 0 12px 0 0;
}
.unit-passive-name {
color: var(--kp-amber);
-unity-font-style: bold;
white-space: normal;
}
.unit-passive-rules {
max-width: 860px;
color: var(--kp-text);
white-space: normal;
}
.unit-passive-flavor {
max-width: 860px;
color: var(--kp-primary-dim);
font-size: var(--type-meta);
margin-top: 10px;
white-space: normal;
}
.unit-overview-top,
@@ -1622,7 +1757,8 @@ Button {
.modal-overlay > .starter-dialog,
.modal-overlay > .root-credit-dialog,
.modal-overlay > .package-equip-dialog,
.modal-overlay > .five-star-selector-dialog {
.modal-overlay > .five-star-selector-dialog,
.modal-overlay > .gacha-pull-history-dialog {
scale: 0.94 0.94;
transition-property: scale;
transition-duration: 160ms;
@@ -1631,7 +1767,8 @@ Button {
.modal-overlay.modal-open > .starter-dialog,
.modal-overlay.modal-open > .root-credit-dialog,
.modal-overlay.modal-open > .package-equip-dialog,
.modal-overlay.modal-open > .five-star-selector-dialog {
.modal-overlay.modal-open > .five-star-selector-dialog,
.modal-overlay.modal-open > .gacha-pull-history-dialog {
scale: 1 1;
}
@@ -1697,6 +1834,47 @@ Button {
background-color: var(--kp-bg-solid);
}
.gacha-pull-history-dialog {
position: relative;
width: 82%;
height: 78%;
padding: 22px;
border-left-width: 1px;
border-right-width: 1px;
border-top-width: 1px;
border-bottom-width: 1px;
border-left-color: var(--kp-primary);
border-right-color: var(--kp-primary);
border-top-color: var(--kp-primary);
border-bottom-color: var(--kp-primary);
background-color: var(--kp-bg-solid);
}
.gacha-pull-history-dialog.is-empty {
height: 145px;
min-height: 145px;
max-height: 145px;
}
.gacha-history-command { color: var(--kp-cyan); margin: 5px 0 8px 0; }
.gacha-history-empty {
padding: 18px 10px;
border-left-width: 2px;
border-left-color: var(--kp-amber);
background-color: var(--kp-bg-deep);
}
.gacha-pull-history-dialog .package-equip-header .gacha-detail-title {
flex-grow: 1;
min-width: 0;
}
.gacha-pull-history-dialog .kv-key {
width: 170px;
min-width: 170px;
}
.package-equip-header {
flex-direction: row;
align-items: center;
@@ -2068,6 +2246,11 @@ Button {
.daily-quest { min-width: 0; padding: 4px 0; border-bottom-width: 1px; border-bottom-color: var(--kp-border-subtle); }
.kernel-ui .daily-quest-dialog .daily-quest .terminal-body { margin: 0 0 2px; }
.kernel-ui .daily-quest-dialog .daily-quest-name { color: var(--kp-cyan); white-space: normal; }
.kernel-ui .daily-quest-dialog .daily-quest-completion-bonus { margin-top: 6px; padding: 8px; border-width: 1px; border-color: var(--kp-amber); }
.kernel-ui .daily-quest-dialog .daily-quest-completion-bonus .daily-quest-name { color: var(--kp-amber); -unity-font-style: bold; }
.kernel-ui .daily-quest-dialog .daily-quest-completion-bonus.daily-quest-claimed { border-color: var(--kp-success); }
.kernel-ui .daily-quest-dialog .daily-quest-completion-bonus.daily-quest-claimed .daily-quest-name,
.kernel-ui .daily-quest-dialog .daily-quest-completion-bonus.daily-quest-claimed .daily-service-meta { color: var(--kp-success); }
.daily-detail-progress-row { flex-direction: row; flex-wrap: wrap; }
.kernel-ui .daily-quest-dialog .daily-detail-progress { color: var(--kp-muted); white-space: nowrap; }
.kernel-ui .daily-quest-dialog .daily-detail-values { min-width: 80px; margin-left: 12px; -unity-text-align: middle-right; -unity-font-style: bold; white-space: nowrap; color: var(--kp-text); }
+18 -18
View File
@@ -35,33 +35,33 @@
<ui:VisualElement class="command-list">
<ui:VisualElement name="CommandStartRun" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="./start_run" class="command-text" />
<ui:Label text="new run" class="command-description" />
<ui:Label text="./start_run" class="command-text syntax-command" />
<ui:Label text="new run" class="command-description syntax-comment" />
</ui:VisualElement>
<ui:VisualElement name="CommandCollection" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="ls ~/collection" class="command-text" />
<ui:Label text="units + cards" class="command-description" />
<ui:Label text="ls ~/collection" class="command-text syntax-command" />
<ui:Label text="units + cards" class="command-description syntax-comment" />
</ui:VisualElement>
<ui:VisualElement name="CommandGacha" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="curl gacha.sh | sh" class="command-text" />
<ui:Label text="summon" class="command-description" />
<ui:Label text="curl gacha.sh | sh" class="command-text syntax-command" />
<ui:Label text="summon" class="command-description syntax-comment" />
</ui:VisualElement>
<ui:VisualElement name="CommandSettings" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="dpkg-reconfigure" class="command-text" />
<ui:Label text="settings" class="command-description" />
<ui:Label text="dpkg-reconfigure" class="command-text syntax-command" />
<ui:Label text="settings" class="command-description syntax-comment" />
</ui:VisualElement>
<ui:VisualElement name="CommandRunArchive" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="history --runs" class="command-text" />
<ui:Label text="run archive" class="command-description" />
<ui:Label text="history --runs" class="command-text syntax-command" />
<ui:Label text="run archive" class="command-description syntax-comment" />
</ui:VisualElement>
<ui:VisualElement name="CommandQuit" class="command-row">
<ui:Label text="&gt;" class="command-cursor" />
<ui:Label text="shutdown -h now" class="command-text" />
<ui:Label text="quit" class="command-description" />
<ui:Label text="shutdown -h now" class="command-text syntax-command" />
<ui:Label text="quit" class="command-description syntax-comment" />
</ui:VisualElement>
</ui:VisualElement>
<ui:Label name="CommandOutput" class="command-output" enable-rich-text="false" />
@@ -162,7 +162,7 @@
<ui:Label class="screen-frame-title" />
</ui:VisualElement>
<ui:ScrollView class="screen-frame-content run-archive-scroll">
<ui:Label text="Re-run your last build or inspect completed runs." class="settings-saved-hint" />
<ui:Label text="# build cache and completed process history" class="settings-config-comment" />
<ui:VisualElement name="RunArchiveActions" class="run-archive-actions" />
</ui:ScrollView>
<ui:VisualElement class="screen-frame-footer">
@@ -182,7 +182,7 @@
<ui:VisualElement class="footer-bar">
<ui:VisualElement class="prompt-row">
<ui:Label text="player@mainframe:~$ " class="prompt-text" />
<ui:Label text="player@mainframe:~$ " class="prompt-text syntax-prompt" />
<ui:TextField name="CommandInput" class="command-input" max-length="120" tooltip="Type a menu command. Tab completes; Up/Down recalls history; help shows controls." />
<ui:Label name="PromptCursorLabel" text="" class="hidden" />
</ui:VisualElement>
@@ -191,8 +191,8 @@
</ui:VisualElement>
<ui:VisualElement name="StarterModal" class="modal-overlay hidden">
<ui:ScrollView class="starter-dialog dialog-scroll">
<ui:Label text="select starter distro" class="starter-title" />
<ui:ScrollView class="starter-dialog dialog-scroll terminal-pane">
<ui:Label text="[ select-starter --distro ]" class="starter-title terminal-pane-titlebar" />
<ui:Label text="Choose your starting distro." class="starter-instruction" />
<ui:Label name="StarterErrorLabel" class="starter-error hidden" />
<ui:VisualElement name="StarterOptions" class="starter-options">
@@ -216,9 +216,9 @@
</ui:ScrollView>
</ui:VisualElement>
<ui:VisualElement name="RootCreditExchangeModal" class="modal-overlay hidden">
<ui:ScrollView class="root-credit-dialog dialog-scroll">
<ui:ScrollView class="root-credit-dialog dialog-scroll terminal-pane">
<ui:Button name="RootCreditExchangeCloseButton" text="X" class="modal-close-button" focusable="false" />
<ui:Label text="exchange Root Credits" class="starter-title" />
<ui:Label text="[ exchange --root-credits ]" class="starter-title terminal-pane-titlebar" />
<ui:Label text="convert Root Credits into Entropy at 1:1. Entropy cannot be converted back." class="starter-instruction" />
<ui:VisualElement class="exchange-summary">
<ui:VisualElement class="kv-row">
+26 -29
View File
@@ -4,40 +4,37 @@
<ui:VisualElement class="screen-frame-header">
<ui:Label class="screen-frame-title" />
</ui:VisualElement>
<ui:ScrollView class="screen-frame-content settings-scroll">
<ui:Label text="[display]" class="settings-heading" />
<ui:Label text="Changes apply immediately and are saved on this device." class="settings-saved-hint" />
<ui:VisualElement class="settings-row">
<ui:VisualElement class="settings-copy">
<ui:Label text="reduced_motion" class="settings-label" />
<ui:Label text="Skip boot/reveal sequences; simplify combat motion." class="settings-description" />
</ui:VisualElement>
<ui:Toggle name="ReducedMotionToggle" text="[ false ]" class="settings-toggle" tooltip="Reduced motion. Space toggles this setting." />
<ui:ScrollView class="screen-frame-content settings-scroll settings-config-file">
<ui:Label text="# /etc/kernel-panic.conf" class="settings-config-path" />
<ui:Label text="# changes apply immediately and persist on this device" class="settings-config-comment" />
<ui:VisualElement class="settings-row settings-config-line">
<ui:Label text="reduced_motion" class="settings-label settings-config-key" />
<ui:Label text="=" class="settings-assignment" />
<ui:Toggle name="ReducedMotionToggle" text="false" class="settings-toggle settings-config-value" tooltip="Reduced motion. Space toggles this setting." />
</ui:VisualElement>
<ui:VisualElement class="settings-row">
<ui:VisualElement class="settings-copy">
<ui:Label text="text_size" class="settings-label" />
<ui:Label text="Standard or large text across menus, cards, combat, and results." class="settings-description" />
</ui:VisualElement>
<ui:Button name="TextSizeButton" text="[ standard ]" class="settings-choice" tooltip="Text size. Enter or Space switches between standard and large." />
<ui:Label text="# skip boot/reveal sequences; simplify combat motion" class="settings-description" />
<ui:VisualElement class="settings-row settings-config-line">
<ui:Label text="text_size" class="settings-label settings-config-key" />
<ui:Label text="=" class="settings-assignment" />
<ui:Button name="TextSizeButton" text="standard" class="settings-choice settings-config-value" tooltip="Text size. Enter or Space switches between standard and large." />
</ui:VisualElement>
<ui:VisualElement class="settings-row">
<ui:VisualElement class="settings-copy">
<ui:Label text="layout_density" class="settings-label" />
<ui:Label text="Compact keeps the current spacing. Comfortable adds room between details and list entries." class="settings-description" />
</ui:VisualElement>
<ui:Button name="DensityButton" text="[ compact ]" class="settings-choice" tooltip="Layout density. Enter or Space switches between compact and comfortable." />
<ui:Label text="# standard or large text across every terminal" class="settings-description" />
<ui:VisualElement class="settings-row settings-config-line">
<ui:Label text="layout_density" class="settings-label settings-config-key" />
<ui:Label text="=" class="settings-assignment" />
<ui:Button name="DensityButton" text="compact" class="settings-choice settings-config-value" tooltip="Layout density. Enter or Space switches between compact and comfortable." />
</ui:VisualElement>
<ui:Label text="[input]" class="settings-heading" />
<ui:Label text="Tab / Shift+Tab focus controls&#10;Enter / Space activate focused control&#10;Esc back / cancel&#10;Menu: / focuses prompt; Tab completes; Up/Down recalls history.&#10;Collection: Left/Right switches tabs; Up/Down selects entries.&#10;Combat: E ends your turn; Tab + Enter selects cards and targets.&#10;Hints: hover to scroll with the mouse wheel, or focus the item and use PgUp / PgDn." class="settings-help" />
<ui:Label text="[audio]" class="settings-heading" />
<ui:VisualElement class="settings-row">
<ui:VisualElement class="settings-copy">
<ui:Label text="combat_volume" class="settings-label" />
<ui:Label text="Terminal cues for dispatch, queued effects, hits, revival and victory. Set to muted for silence." class="settings-description" />
<ui:Label text="# compact or comfortable spacing" class="settings-description" />
<ui:VisualElement class="settings-row settings-config-line settings-volume-line">
<ui:Label text="combat_volume" class="settings-label settings-config-key" />
<ui:Label text="=" class="settings-assignment" />
<ui:VisualElement class="settings-slider-control settings-config-value">
<ui:SliderInt name="SoundVolumeSlider" low-value="0" high-value="100" value="75" class="settings-volume-slider" />
<ui:Label name="SoundVolumeValue" text="[########--] 75%" class="settings-slider-value" />
</ui:VisualElement>
<ui:Button name="SoundVolumeButton" text="[ 75% ]" class="settings-choice" tooltip="Cycle combat volume: muted, 25%, 50%, 75%, 100%." />
</ui:VisualElement>
<ui:Label text="# dispatch, queued effects, hits, revival and victory" class="settings-description" />
<ui:Label text="&#10;# key bindings (`bind -P`)&#10;# tab / shift-tab focus-next / focus-prev&#10;# enter / space execute&#10;# escape cancel&#10;# / focus-prompt&#10;# up / down history&#10;# e dispatch-turn&#10;# pgup / pgdn scroll-inspect" class="settings-help settings-config-help" />
</ui:ScrollView>
<ui:VisualElement class="screen-frame-footer">
<ui:Label class="screen-frame-hint" />