Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
898dedde94 | ||
|
|
f9ab1c26a0 | ||
|
|
804f68699d | ||
|
|
d0be689faa | ||
|
|
c91586b4a1 | ||
|
|
7abd1226cb | ||
|
|
3587c7bd64 | ||
|
|
ea0f80664f | ||
|
|
bbfc35f79c | ||
|
|
077c08bb5f | ||
|
|
48c14864a4 | ||
|
|
3c2ead0be1 | ||
|
|
04eba25286 | ||
|
|
7e6a338240 |
No files matched your search
@@ -2,6 +2,56 @@
|
|||||||
|
|
||||||
All notable alpha milestones for Ratdoku.
|
All notable alpha milestones for Ratdoku.
|
||||||
|
|
||||||
|
## v0.6.1-alpha — Back Button
|
||||||
|
|
||||||
|
- Android's hardware back button now follows the same path as the in-app back arrow instead of closing the game.
|
||||||
|
- Back closes overlays in order: quit confirmation, settings confirmation, settings sheet, Guest Book detail, win overlay, then screen navigation.
|
||||||
|
- On Home, back opens a themed "Leave Ratdoku?" confirmation before quitting.
|
||||||
|
- Added headless QA that injects `ui_cancel` at each layer.
|
||||||
|
- Android debug APK rebuilt at version `0.6.1` (version code 13).
|
||||||
|
|
||||||
|
## v0.6.0-alpha — New Looks & Streaks
|
||||||
|
|
||||||
|
- Profile now has tabbed **Avatar** and **Frame** pickers with a large preview, selection highlighting, and Confirm / Cancel. Guest portraits unlock with their Guest Book entries; Crumb is available from the start.
|
||||||
|
- Chosen avatar appears on Home and in Profile. Frames stack over any avatar.
|
||||||
|
- New **Daily Streak** screen with a big current streak, best-streak pill, Monday–Sunday completion calendar, next-frame goal, and a visual 7-day gift marker.
|
||||||
|
- Save format moves to version 4 with `avatar_id` and daily completion history.
|
||||||
|
- QA updated for avatars, streak history, the new screens, and save migrations.
|
||||||
|
- Android debug APK rebuilt at version `0.6.0` (version code 12).
|
||||||
|
|
||||||
|
## v0.5.3-alpha — Crisp Icons
|
||||||
|
|
||||||
|
- Icon SVGs now import at 120px intrinsic size instead of 24px, so buttons stay sharp on high-density phones.
|
||||||
|
- Round buttons expand the high-res icon and use content margins to keep the original visual icon size.
|
||||||
|
- Added QA that checks every icon texture is at least 96px and that round buttons use expansion and margins.
|
||||||
|
- Android debug APK rebuilt at version `0.5.3` (version code 11).
|
||||||
|
|
||||||
|
## v0.5.2-alpha — Clean Slate
|
||||||
|
|
||||||
|
- Replaced the native reset/restart dialog with a themed in-app confirmation card: cream panel, Fredoka heading, wrapped body, and full-width Cancel / destructive action buttons.
|
||||||
|
- The confirmation panel fits the 360dp screen, and tapping outside cancels.
|
||||||
|
- Disabled the Godot boot splash and set the startup background to the app's cream colour.
|
||||||
|
- Added UI QA checks for both confirmation dialogs and a reset-dialog screenshot.
|
||||||
|
- Android debug APK rebuilt at version `0.5.2` (version code 10).
|
||||||
|
|
||||||
|
## v0.5.1-alpha — QA & Stability
|
||||||
|
|
||||||
|
- Fixed a crash when selecting a profile frame: the frame grid no longer frees the card that is still emitting `pressed`.
|
||||||
|
- Frame, avatar, and Guest Book frame rebuilds now use deferred/queued deletion so signal handlers never free live nodes.
|
||||||
|
- Added QA suites for save migrations, daily streaks, frames, level data, navigation, and input gestures.
|
||||||
|
- Added `tools/qa_all.ps1`: one command runs the class scan, every test suite, screenshots, an optional APK build, and fails on any engine error in the log.
|
||||||
|
- Android debug APK rebuilt at version `0.5.1` (version code 9).
|
||||||
|
|
||||||
|
## v0.5.0-alpha — Daily Rooms & Frames
|
||||||
|
|
||||||
|
- New **Daily room**: one of the 30 verified rooms each day, chosen deterministically from the local date.
|
||||||
|
- Daily streak tracking with current and best streak; replaying the same day never counts twice, and a gap resets the streak.
|
||||||
|
- Daily completion is separate from campaign progress and does not unlock guests. Undo and hints still work.
|
||||||
|
- New **Profile** screen reached from the framed Crumb avatar: rooms completed, streak stats, and a selectable frame grid.
|
||||||
|
- Seven profile frames unlock at 5/10/20/30 rooms and 3/7-day best streaks; unlocks are permanent and selection persists.
|
||||||
|
- Save format moves to version 3 with a one-time migration from older saves.
|
||||||
|
- Android debug APK rebuilt at version `0.5.0` (version code 8).
|
||||||
|
|
||||||
## v0.4.3-alpha — Tap Twice
|
## v0.4.3-alpha — Tap Twice
|
||||||
|
|
||||||
- Double-tap placement is now the default: tap marks X, two quick taps on the same cell check a guest in or out.
|
- Double-tap placement is now the default: tap marks X, two quick taps on the same cell check a guest in or out.
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ The project uses a portrait **360×640 dp canvas**, scaled to a 540×960 desktop
|
|||||||
- **Double-tap** a cell to check a guest in or out. **Double-tap is on by default.**
|
- **Double-tap** a cell to check a guest in or out. **Double-tap is on by default.**
|
||||||
- Prefer holding? Turn off **Double-tap to place** in Settings, then **press and hold** (mobile) or **right-click** (PC) to check a guest in. Right-click keeps working in both modes.
|
- Prefer holding? Turn off **Double-tap to place** in Settings, then **press and hold** (mobile) or **right-click** (PC) to check a guest in. Right-click keeps working in both modes.
|
||||||
- In hold mode, a gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed.
|
- In hold mode, a gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed.
|
||||||
|
- On Android, the system back button acts like the in-app back arrow: it closes overlays first, then navigates back. On Home it asks before quitting.
|
||||||
- **Undo** and **Hint** are at the bottom. **Restart room** and **Back to lobby** live in the in-level settings sheet.
|
- **Undo** and **Hint** are at the bottom. **Restart room** and **Back to lobby** live in the in-level settings sheet.
|
||||||
|
- The **Daily room** changes each day and tracks a streak. Replaying the same day never counts twice. Open **Streak** for the weekly calendar and next goal.
|
||||||
|
- Tap **Crumb** in the top-left to open your Profile, where you can choose an avatar and a frame. Choices apply on Confirm.
|
||||||
- A **gold ring** around a guest means they are already checked in and cannot be moved.
|
- A **gold ring** around a guest means they are already checked in and cannot be moved.
|
||||||
- Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally.
|
- Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally.
|
||||||
- **No guessing is required.** Every room has exactly one solution.
|
- **No guessing is required.** Every room has exactly one solution.
|
||||||
@@ -35,10 +38,12 @@ The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains
|
|||||||
|
|
||||||
## Screens
|
## Screens
|
||||||
|
|
||||||
- **Home** — top hub with Crumb avatar, guest progress, and settings; Continue/Check in; Guest Book; House Rules.
|
- **Home** — top hub with framed Crumb avatar, guest progress, and settings; daily room card; Continue/Check in; Guest Book; House Rules.
|
||||||
- **Game** — top bar, rule strip for the first three rooms, room legend, board, timer, undo/hint, in-level settings, win overlay.
|
- **Game** — top bar, rule strip for the first three rooms, room legend, board, timer, undo/hint, in-level settings, win overlay.
|
||||||
- **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number. Tapping a card opens a detail sheet; swiping anywhere in the gallery scrolls it, including over cards.
|
- **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number. Tapping a card opens a detail sheet; swiping anywhere in the gallery scrolls it, including over cards.
|
||||||
- **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, double-tap placement (on by default), hold time, how to play, restart/back, reset progress.
|
- **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, double-tap placement (on by default), hold time, how to play, restart/back, reset progress. Destructive actions use a themed in-app confirmation card.
|
||||||
|
- **Profile** — framed avatar preview, rooms completed, current and best daily streaks, and tabbed Avatar / Frame pickers with Confirm / Cancel. Guest portraits unlock with their Guest Book entry.
|
||||||
|
- **Daily Streak** — big current streak, best-streak pill, weekly calendar, next-frame goal, and a visual day-7 gift marker.
|
||||||
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
|
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
|
||||||
|
|
||||||
## Unlocks
|
## Unlocks
|
||||||
@@ -143,12 +148,12 @@ build/Ratdoku.apk
|
|||||||
It is a **debug-signed, arm64-v8a** APK:
|
It is a **debug-signed, arm64-v8a** APK:
|
||||||
|
|
||||||
- Package: `com.ratdoku.game`
|
- Package: `com.ratdoku.game`
|
||||||
- Version: `0.4.3` (version code 7)
|
- Version: `0.6.1` (version code 13)
|
||||||
- Min SDK: 24 (Android 7.0)
|
- Min SDK: 24 (Android 7.0)
|
||||||
- Target SDK: 36
|
- Target SDK: 36
|
||||||
- Size: about 41 MB
|
- Size: about 41 MB
|
||||||
- Portrait orientation
|
- Portrait orientation
|
||||||
- Build label: `v0.4.3-alpha · build 2026-12-02`
|
- Build label: `v0.6.1-alpha · build 2026-12-03`
|
||||||
|
|
||||||
To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging:
|
To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging:
|
||||||
|
|
||||||
@@ -185,11 +190,19 @@ If you want a Play Store build, switch `gradle_build/export_format` to AAB, use
|
|||||||
--headless --path . --script res://tools/ui_test.gd
|
--headless --path . --script res://tools/ui_test.gd
|
||||||
```
|
```
|
||||||
|
|
||||||
`ui_test.gd` checks the double-tap default and version 1 migration, settings propagation, hold/double-tap placement, tap-vs-drag guards in the Guest Book, scroll pass-through over cards and rules rows, the close guard, room-1 → Pepper unlock, gallery progress, and the interactive 5×5 tutorial. Both tests reset the save when they finish.
|
`ui_test.gd` checks the double-tap default and save migrations, daily streak math and level selection, avatar and frame selection, settings propagation, hold/double-tap placement, tap-vs-drag guards in the Guest Book, scroll pass-through over cards and rules rows, the close guard, room-1 → Pepper unlock, gallery progress, navigation, and the interactive 5×5 tutorial. Both tests reset the save when they finish.
|
||||||
|
|
||||||
|
Run the whole QA suite (class scan, every test script, log-error scan, optional screenshots, optional APK build) with:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
.\tools\qa_all.ps1 -Screenshots -Build
|
||||||
|
```
|
||||||
|
|
||||||
|
`qa_all.ps1` fails if any suite is missing, a script does not print its PASS marker, or Godot logs any `ERROR` / `SCRIPT ERROR`. The `qa_core.gd`, `qa_ui.gd`, and `qa_input.gd` suites cover save migrations, daily and frame data, navigation and win overlays, and all input gestures.
|
||||||
|
|
||||||
## Versioning and releases
|
## Versioning and releases
|
||||||
|
|
||||||
The current development build is **v0.4.3-alpha** (“Tap Twice”) with the build label on Home and in Settings.
|
The current development build is **v0.6.1-alpha** (“Back Button”) with the build label on Home and in Settings.
|
||||||
|
|
||||||
Gitea repository:
|
Gitea repository:
|
||||||
|
|
||||||
@@ -204,14 +217,20 @@ Alpha releases (all marked prerelease, each with a debug APK and source archive)
|
|||||||
- **v0.4.1-alpha** — Guest Book tap/scroll guards, close guard, double-tap placement
|
- **v0.4.1-alpha** — Guest Book tap/scroll guards, close guard, double-tap placement
|
||||||
- **v0.4.2-alpha** — finger scrolling works over Guest Book cards, House Rules rows, and Settings rows
|
- **v0.4.2-alpha** — finger scrolling works over Guest Book cards, House Rules rows, and Settings rows
|
||||||
- **v0.4.3-alpha** — double-tap placement is the default, with a one-time migration for older saves
|
- **v0.4.3-alpha** — double-tap placement is the default, with a one-time migration for older saves
|
||||||
|
- **v0.5.0-alpha** — daily room with streaks, Profile screen, and selectable profile frames
|
||||||
|
- **v0.5.1-alpha** — profile frame selection crash fix, QA suites, and log-guarded test runner
|
||||||
|
- **v0.5.2-alpha** — themed reset/restart confirmation and no Godot boot splash
|
||||||
|
- **v0.5.3-alpha** — high-resolution UI icons that stay sharp on high-density screens
|
||||||
|
- **v0.6.0-alpha** — selectable guest avatars with tabbed picker and a Daily Streak screen with weekly goal
|
||||||
|
- **v0.6.1-alpha** — Android back button navigates the app instead of closing it
|
||||||
|
|
||||||
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.4.3-alpha
|
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.6.1-alpha
|
||||||
|
|
||||||
The v0.4.3-alpha APK is also at:
|
The v0.6.1-alpha APK is also at:
|
||||||
|
|
||||||
`https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.4.3-alpha/Ratdoku-v0.4.3-alpha.apk`
|
`https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.6.1-alpha/Ratdoku-v0.6.1-alpha.apk`
|
||||||
|
|
||||||
`redesign-360` is the branch with the current 360dp work; it is tagged `v0.4.3-alpha`.
|
`redesign-360` is the branch with the current 360dp work; it is tagged `v0.6.1-alpha`.
|
||||||
|
|
||||||
The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`).
|
The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`).
|
||||||
|
|
||||||
@@ -225,5 +244,7 @@ The version is set in three places: `project.godot` (`config/version`), `scripts
|
|||||||
- Interactive 5×5 tutorial
|
- Interactive 5×5 tutorial
|
||||||
- 25 guest portraits + Crumb
|
- 25 guest portraits + Crumb
|
||||||
- Settings, gallery, rulebook, unlock flow
|
- Settings, gallery, rulebook, unlock flow
|
||||||
|
- Daily room with streaks, Profile screen, selectable avatars and frames (save version 4)
|
||||||
- Installable Android debug APK
|
- Installable Android debug APK
|
||||||
- No audio yet, no profile/daily streak yet, no release keystore/AAB yet
|
- No Godot boot splash; the app opens straight to the cream-themed game
|
||||||
|
- No audio yet, no release keystore/AAB yet
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 264 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 319 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 395 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 402 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 238 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 662 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 316 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 358 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 414 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 373 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 420 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 299 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 588 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 580 B |
@@ -0,0 +1,13 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="120"
|
||||||
|
height="120"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="#e7b45c"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 575 B |
@@ -0,0 +1,13 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="120"
|
||||||
|
height="120"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="#ffffff"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 575 B |
@@ -1,7 +1,7 @@
|
|||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="120"
|
||||||
height="24"
|
height="120"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 311 B |
@@ -32,8 +32,8 @@ architectures/armeabi-v7a=false
|
|||||||
architectures/arm64-v8a=true
|
architectures/arm64-v8a=true
|
||||||
architectures/x86=false
|
architectures/x86=false
|
||||||
architectures/x86_64=false
|
architectures/x86_64=false
|
||||||
version/code=7
|
version/code=13
|
||||||
version/name="0.4.3"
|
version/name="0.6.1"
|
||||||
package/unique_name="com.ratdoku.game"
|
package/unique_name="com.ratdoku.game"
|
||||||
package/name="Ratdoku"
|
package/name="Ratdoku"
|
||||||
package/signed=true
|
package/signed=true
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ config_version=5
|
|||||||
|
|
||||||
config/name="Ratdoku"
|
config/name="Ratdoku"
|
||||||
run/main_scene="res://scenes/Main.tscn"
|
run/main_scene="res://scenes/Main.tscn"
|
||||||
config/version="0.4.3-alpha"
|
config/version="0.6.1-alpha"
|
||||||
config/features=PackedStringArray("4.7", "GL Compatibility")
|
config/features=PackedStringArray("4.7", "GL Compatibility")
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
boot_splash/show_image=false
|
||||||
|
boot_splash/bg_color=Color(0.984314, 0.945098, 0.87451, 1)
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=2 format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/Profile.gd" id="1_profile"]
|
||||||
|
|
||||||
|
[node name="Profile" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_profile")
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=2 format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/Streak.gd" id="1_streak"]
|
||||||
|
|
||||||
|
[node name="Streak" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_streak")
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
class_name Avatars
|
||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
## Selectable profile portraits. Crumb is always available; guest portraits
|
||||||
|
## unlock with the corresponding Guest Book entry.
|
||||||
|
|
||||||
|
static func all() -> Array:
|
||||||
|
var out := [{
|
||||||
|
"id": "crumb",
|
||||||
|
"name": "Crumb",
|
||||||
|
"path": "res://art/crumb_head.png",
|
||||||
|
"room": 0,
|
||||||
|
}]
|
||||||
|
for guest in Guests.all():
|
||||||
|
var id := str(guest.get("id", ""))
|
||||||
|
if id.is_empty():
|
||||||
|
continue
|
||||||
|
out.append({
|
||||||
|
"id": id,
|
||||||
|
"name": str(guest.get("name", id)),
|
||||||
|
"path": Guests.portrait(id, "thumbs"),
|
||||||
|
"room": int(guest.get("unlock_room", 0)),
|
||||||
|
})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
static func by_id(id: String) -> Dictionary:
|
||||||
|
for avatar in all():
|
||||||
|
if str(avatar.get("id", "")) == id:
|
||||||
|
return avatar
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
static func portrait_path(id: String) -> String:
|
||||||
|
var avatar := by_id(id)
|
||||||
|
if avatar.is_empty():
|
||||||
|
return "res://art/crumb_head.png"
|
||||||
|
return str(avatar.get("path", "res://art/crumb_head.png"))
|
||||||
|
|
||||||
|
|
||||||
|
static func is_unlocked(id: String) -> bool:
|
||||||
|
if id == "crumb":
|
||||||
|
return true
|
||||||
|
var avatar := by_id(id)
|
||||||
|
if avatar.is_empty():
|
||||||
|
return false
|
||||||
|
return SaveGame.is_guest_unlocked(id)
|
||||||
|
|
||||||
|
|
||||||
|
static func requirement_text(id: String) -> String:
|
||||||
|
var avatar := by_id(id)
|
||||||
|
if avatar.is_empty():
|
||||||
|
return ""
|
||||||
|
if id == "crumb":
|
||||||
|
return "Always available"
|
||||||
|
return "Meet in Room %d" % int(avatar.get("room", 0))
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c5700f5m3iuxh
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
class_name Daily
|
||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
## Date helpers for the daily room. Everything is keyed by the player's
|
||||||
|
## local calendar date so the same key is used on save and on display.
|
||||||
|
|
||||||
|
static func today_key() -> String:
|
||||||
|
var d := Time.get_date_dict_from_system()
|
||||||
|
return "%04d-%02d-%02d" % [int(d.get("year", 0)), int(d.get("month", 0)), int(d.get("day", 0))]
|
||||||
|
|
||||||
|
|
||||||
|
static func day_number(key: String) -> int:
|
||||||
|
var parts := key.split("-")
|
||||||
|
if parts.size() != 3:
|
||||||
|
return 0
|
||||||
|
var stamp := Time.get_unix_time_from_datetime_dict({
|
||||||
|
"year": int(parts[0]),
|
||||||
|
"month": int(parts[1]),
|
||||||
|
"day": int(parts[2]),
|
||||||
|
"hour": 0,
|
||||||
|
"minute": 0,
|
||||||
|
"second": 0,
|
||||||
|
})
|
||||||
|
return int(floor(float(stamp) / 86400.0))
|
||||||
|
|
||||||
|
|
||||||
|
static func key_from_day_number(day: int) -> String:
|
||||||
|
var d := Time.get_datetime_dict_from_unix_time(day * 86400)
|
||||||
|
return "%04d-%02d-%02d" % [int(d.get("year", 0)), int(d.get("month", 0)), int(d.get("day", 0))]
|
||||||
|
|
||||||
|
|
||||||
|
## Monday-to-Sunday keys for the week containing today.
|
||||||
|
static func week_keys() -> Array:
|
||||||
|
var date := Time.get_date_dict_from_system()
|
||||||
|
var weekday := int(date.get("weekday", 0)) # Godot: 0 = Sunday.
|
||||||
|
var monday_offset := (weekday + 6) % 7
|
||||||
|
var base := day_number(today_key()) - monday_offset
|
||||||
|
var out := []
|
||||||
|
for i in range(7):
|
||||||
|
out.append(key_from_day_number(base + i))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
static func weekday_labels() -> Array:
|
||||||
|
return ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
|
||||||
|
|
||||||
|
|
||||||
|
static func goal_text(streak: int) -> String:
|
||||||
|
if streak >= 7:
|
||||||
|
return "Week complete — your 7-day gift is ready."
|
||||||
|
if streak >= 3:
|
||||||
|
return "%d more day%s until the Night Owl frame" % [7 - streak, "" if 7 - streak == 1 else "s"]
|
||||||
|
return "%d more day%s until the Regular frame" % [3 - streak, "" if 3 - streak == 1 else "s"]
|
||||||
|
|
||||||
|
|
||||||
|
## Stable per-date room choice. With 30 rooms the pool repeats monthly.
|
||||||
|
static func level_index(level_count: int, key: String = "") -> int:
|
||||||
|
if level_count <= 0:
|
||||||
|
return -1
|
||||||
|
var date_key := key if key != "" else today_key()
|
||||||
|
return absi(("ratdoku-daily-" + date_key).hash()) % level_count
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cl1qlq4fvdtij
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
class_name Frames
|
||||||
|
extends RefCounted
|
||||||
|
|
||||||
|
## Profile frame definitions. Unlocks use campaign room count and the best
|
||||||
|
## daily streak, so a frame is never lost when a streak resets.
|
||||||
|
|
||||||
|
const DEFS := [
|
||||||
|
{
|
||||||
|
"id": "plain", "name": "Plain", "rooms": 0, "streak": 0,
|
||||||
|
"border": Palette.WALL, "width": 2, "shadow": Color(0, 0, 0, 0), "shadow_size": 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "paper", "name": "Paper", "rooms": 5, "streak": 0,
|
||||||
|
"border": Palette.MUTED, "width": 3, "shadow": Color(0, 0, 0, 0), "shadow_size": 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "gold", "name": "Gold", "rooms": 10, "streak": 0,
|
||||||
|
"border": Palette.GOLD, "width": 4, "shadow": Palette.GOLD, "shadow_size": 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "bell", "name": "Bellhop", "rooms": 20, "streak": 0,
|
||||||
|
"border": Palette.INK, "width": 3, "shadow": Palette.ORANGE, "shadow_size": 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "star", "name": "Star guest", "rooms": 30, "streak": 0,
|
||||||
|
"border": Palette.GOLD, "width": 4, "shadow": Palette.WHITE, "shadow_size": 7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "regular", "name": "Regular", "rooms": 0, "streak": 3,
|
||||||
|
"border": Palette.ORANGE, "width": 4, "shadow": Palette.ORANGE, "shadow_size": 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "night", "name": "Night owl", "rooms": 0, "streak": 7,
|
||||||
|
"border": Palette.INK, "width": 4, "shadow": Palette.GOLD, "shadow_size": 8,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
static func all() -> Array:
|
||||||
|
return DEFS
|
||||||
|
|
||||||
|
|
||||||
|
static func by_id(id: String) -> Dictionary:
|
||||||
|
for frame in DEFS:
|
||||||
|
if str(frame.get("id", "")) == id:
|
||||||
|
return frame
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
static func is_unlocked(id: String) -> bool:
|
||||||
|
var frame := by_id(id)
|
||||||
|
if frame.is_empty():
|
||||||
|
return false
|
||||||
|
var rooms: int = SaveGame.rooms_completed()
|
||||||
|
var streak: int = SaveGame.best_streak()
|
||||||
|
return rooms >= int(frame.get("rooms", 0)) and streak >= int(frame.get("streak", 0))
|
||||||
|
|
||||||
|
|
||||||
|
static func requirement_text(id: String) -> String:
|
||||||
|
var frame := by_id(id)
|
||||||
|
if frame.is_empty():
|
||||||
|
return ""
|
||||||
|
var rooms := int(frame.get("rooms", 0))
|
||||||
|
var streak := int(frame.get("streak", 0))
|
||||||
|
if rooms > 0 and streak > 0:
|
||||||
|
return "%d rooms · %d-day streak" % [rooms, streak]
|
||||||
|
if rooms > 0:
|
||||||
|
return "Complete %d rooms" % rooms
|
||||||
|
if streak > 0:
|
||||||
|
return "%d-day best streak" % streak
|
||||||
|
return "Always available"
|
||||||
|
|
||||||
|
|
||||||
|
static func style_for(id: String, size: int) -> StyleBoxFlat:
|
||||||
|
var frame := by_id(id)
|
||||||
|
if frame.is_empty():
|
||||||
|
frame = DEFS[0]
|
||||||
|
var radius: int = max(6, int(size * 0.45))
|
||||||
|
var width: int = int(frame.get("width", 2))
|
||||||
|
var style := StyleBoxFlat.new()
|
||||||
|
style.bg_color = Color(0, 0, 0, 0)
|
||||||
|
style.corner_radius_top_left = radius
|
||||||
|
style.corner_radius_top_right = radius
|
||||||
|
style.corner_radius_bottom_left = radius
|
||||||
|
style.corner_radius_bottom_right = radius
|
||||||
|
style.border_width_left = width
|
||||||
|
style.border_width_right = width
|
||||||
|
style.border_width_top = width
|
||||||
|
style.border_width_bottom = width
|
||||||
|
style.border_color = frame.get("border", Palette.WALL)
|
||||||
|
style.shadow_color = frame.get("shadow", Color(0, 0, 0, 0))
|
||||||
|
style.shadow_size = int(frame.get("shadow_size", 0))
|
||||||
|
style.shadow_offset = Vector2(0, 2)
|
||||||
|
style.content_margin_left = width + 2
|
||||||
|
style.content_margin_right = width + 2
|
||||||
|
style.content_margin_top = width + 2
|
||||||
|
style.content_margin_bottom = width + 2
|
||||||
|
return style
|
||||||
|
|
||||||
|
|
||||||
|
## A sized PanelContainer with the frame border. Add the avatar inside it.
|
||||||
|
static func frame_panel(id: String, size: int) -> PanelContainer:
|
||||||
|
var panel := PanelContainer.new()
|
||||||
|
panel.custom_minimum_size = Vector2(size, size)
|
||||||
|
panel.add_theme_stylebox_override("panel", style_for(id, size))
|
||||||
|
return panel
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dsv7pdhabtyyg
|
||||||
@@ -13,6 +13,8 @@ var started_at := 0
|
|||||||
var elapsed_ms := 0
|
var elapsed_ms := 0
|
||||||
var win_shown := false
|
var win_shown := false
|
||||||
var current_level_id := ""
|
var current_level_id := ""
|
||||||
|
var daily_mode := false
|
||||||
|
var daily_key := ""
|
||||||
var ui_paused := false
|
var ui_paused := false
|
||||||
|
|
||||||
var board: Board
|
var board: Board
|
||||||
@@ -25,6 +27,8 @@ var overlay: ColorRect
|
|||||||
var rule_strip: HBoxContainer
|
var rule_strip: HBoxContainer
|
||||||
var legend_row: HBoxContainer
|
var legend_row: HBoxContainer
|
||||||
var legend_chips: Array = []
|
var legend_chips: Array = []
|
||||||
|
var win_title: Label
|
||||||
|
var win_next: Button
|
||||||
var new_guest_box: HBoxContainer
|
var new_guest_box: HBoxContainer
|
||||||
var new_guest_label: Label
|
var new_guest_label: Label
|
||||||
var new_guest_portrait: TextureRect
|
var new_guest_portrait: TextureRect
|
||||||
@@ -184,7 +188,8 @@ func _build_win_overlay() -> void:
|
|||||||
portrait.custom_minimum_size = Vector2(110, 110)
|
portrait.custom_minimum_size = Vector2(110, 110)
|
||||||
portrait_center.add_child(portrait)
|
portrait_center.add_child(portrait)
|
||||||
|
|
||||||
box.add_child(UI.heading("Everyone checked in!", 26))
|
win_title = UI.heading("Everyone checked in!", 26)
|
||||||
|
box.add_child(win_title)
|
||||||
win_detail = UI.label("Room 1 · 00:00", 13, Palette.MUTED)
|
win_detail = UI.label("Room 1 · 00:00", 13, Palette.MUTED)
|
||||||
box.add_child(win_detail)
|
box.add_child(win_detail)
|
||||||
box.add_child(UI.label("Sweet dreams, little guests.", 12, Palette.MUTED))
|
box.add_child(UI.label("Sweet dreams, little guests.", 12, Palette.MUTED))
|
||||||
@@ -210,6 +215,7 @@ func _build_win_overlay() -> void:
|
|||||||
next.add_theme_font_size_override("font_size", 17)
|
next.add_theme_font_size_override("font_size", 17)
|
||||||
box.add_child(next)
|
box.add_child(next)
|
||||||
next.pressed.connect(_on_next)
|
next.pressed.connect(_on_next)
|
||||||
|
win_next = next
|
||||||
|
|
||||||
var book := UI.button("Guest Book", false, 42)
|
var book := UI.button("Guest Book", false, 42)
|
||||||
book.add_theme_font_size_override("font_size", 15)
|
book.add_theme_font_size_override("font_size", 15)
|
||||||
@@ -227,24 +233,26 @@ func _make_win_portrait() -> Control:
|
|||||||
return RatPortrait.new()
|
return RatPortrait.new()
|
||||||
|
|
||||||
|
|
||||||
func start_level(index: int) -> void:
|
func start_level(index: int, daily: bool = false, key: String = "") -> void:
|
||||||
if levels.is_empty():
|
if levels.is_empty():
|
||||||
status_label.text = "No rooms yet."
|
status_label.text = "No rooms yet."
|
||||||
status_label.add_theme_color_override("font_color", Palette.RED)
|
status_label.add_theme_color_override("font_color", Palette.RED)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
daily_mode = daily
|
||||||
|
daily_key = key
|
||||||
level_index = clampi(index, 0, levels.size() - 1)
|
level_index = clampi(index, 0, levels.size() - 1)
|
||||||
var level: Dictionary = levels[level_index]
|
var level: Dictionary = levels[level_index]
|
||||||
current_level_id = str(level.get("id", ""))
|
current_level_id = str(level.get("id", ""))
|
||||||
board.set_level(level)
|
board.set_level(level)
|
||||||
|
|
||||||
level_label.text = "Room %d" % (level_index + 1)
|
level_label.text = "Daily room" if daily_mode else "Room %d" % (level_index + 1)
|
||||||
started_at = Time.get_ticks_msec()
|
started_at = Time.get_ticks_msec()
|
||||||
elapsed_ms = 0
|
elapsed_ms = 0
|
||||||
win_shown = false
|
win_shown = false
|
||||||
overlay.visible = false
|
overlay.visible = false
|
||||||
new_guest_box.visible = false
|
new_guest_box.visible = false
|
||||||
rule_strip.visible = level_index < 3
|
rule_strip.visible = daily_mode or level_index < 3
|
||||||
status_label.text = "Gold rings are already in." if level.get("clues", []).size() > 0 else DEFAULT_STATUS
|
status_label.text = "Gold rings are already in." if level.get("clues", []).size() > 0 else DEFAULT_STATUS
|
||||||
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
||||||
_refresh_legend()
|
_refresh_legend()
|
||||||
@@ -252,9 +260,13 @@ func start_level(index: int) -> void:
|
|||||||
_update_guest_count()
|
_update_guest_count()
|
||||||
|
|
||||||
|
|
||||||
|
func start_daily(index: int, key: String) -> void:
|
||||||
|
start_level(index, true, key)
|
||||||
|
|
||||||
|
|
||||||
func _refresh_legend() -> void:
|
func _refresh_legend() -> void:
|
||||||
for child in legend_row.get_children():
|
for child in legend_row.get_children():
|
||||||
child.free()
|
child.queue_free()
|
||||||
legend_chips.clear()
|
legend_chips.clear()
|
||||||
if board.region_rats.is_empty():
|
if board.region_rats.is_empty():
|
||||||
return
|
return
|
||||||
@@ -334,7 +346,12 @@ func set_ui_paused(value: bool) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func restart_room() -> void:
|
func restart_room() -> void:
|
||||||
start_level(level_index)
|
start_level(level_index, daily_mode, daily_key)
|
||||||
|
|
||||||
|
|
||||||
|
func hide_win() -> void:
|
||||||
|
win_shown = false
|
||||||
|
overlay.visible = false
|
||||||
|
|
||||||
|
|
||||||
func _on_board_changed() -> void:
|
func _on_board_changed() -> void:
|
||||||
@@ -357,17 +374,31 @@ func _on_solved() -> void:
|
|||||||
win_shown = true
|
win_shown = true
|
||||||
status_label.text = "Everyone checked in."
|
status_label.text = "Everyone checked in."
|
||||||
status_label.add_theme_color_override("font_color", Palette.INK)
|
status_label.add_theme_color_override("font_color", Palette.INK)
|
||||||
win_detail.text = "Room %d · %s" % [level_index + 1, _format_time(elapsed_ms)]
|
|
||||||
_update_legend()
|
_update_legend()
|
||||||
|
|
||||||
var unlocked_id := SaveGame.complete_room(current_level_id, level_index + 1)
|
if daily_mode:
|
||||||
if unlocked_id != "":
|
var extended := SaveGame.complete_daily(daily_key)
|
||||||
var guest := Guests.by_id(unlocked_id)
|
var streak := SaveGame.daily_streak()
|
||||||
new_guest_label.text = "New guest: %s the %s" % [str(guest.get("name", "")), str(guest.get("role", ""))]
|
var streak_text := "%d %s" % [streak, "day" if streak == 1 else "days"]
|
||||||
new_guest_portrait.texture = load(Guests.portrait(unlocked_id, "thumbs"))
|
win_title.text = "Daily room complete!"
|
||||||
new_guest_box.visible = true
|
win_detail.text = "%s · %s" % [
|
||||||
else:
|
("Streak: " + streak_text) if extended else ("Replay · " + streak_text),
|
||||||
|
_format_time(elapsed_ms)
|
||||||
|
]
|
||||||
|
win_next.text = "Back to lobby"
|
||||||
new_guest_box.visible = false
|
new_guest_box.visible = false
|
||||||
|
else:
|
||||||
|
win_title.text = "Everyone checked in!"
|
||||||
|
win_detail.text = "Room %d · %s" % [level_index + 1, _format_time(elapsed_ms)]
|
||||||
|
win_next.text = "Next room"
|
||||||
|
var unlocked_id := SaveGame.complete_room(current_level_id, level_index + 1)
|
||||||
|
if unlocked_id != "":
|
||||||
|
var guest := Guests.by_id(unlocked_id)
|
||||||
|
new_guest_label.text = "New guest: %s the %s" % [str(guest.get("name", "")), str(guest.get("role", ""))]
|
||||||
|
new_guest_portrait.texture = load(Guests.portrait(unlocked_id, "thumbs"))
|
||||||
|
new_guest_box.visible = true
|
||||||
|
else:
|
||||||
|
new_guest_box.visible = false
|
||||||
|
|
||||||
await get_tree().create_timer(0.45).timeout
|
await get_tree().create_timer(0.45).timeout
|
||||||
if win_shown:
|
if win_shown:
|
||||||
@@ -392,6 +423,9 @@ func _on_hint() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_next() -> void:
|
func _on_next() -> void:
|
||||||
|
if daily_mode:
|
||||||
|
_on_back()
|
||||||
|
return
|
||||||
if level_index + 1 < levels.size():
|
if level_index + 1 < levels.size():
|
||||||
start_level(level_index + 1)
|
start_level(level_index + 1)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ var detail_meta: Label
|
|||||||
var detail_bio: Label
|
var detail_bio: Label
|
||||||
var detail_snack: Label
|
var detail_snack: Label
|
||||||
var detail_status: Label
|
var detail_status: Label
|
||||||
|
var crumb_frame_holder: CenterContainer
|
||||||
|
var crumb_frame_id := ""
|
||||||
|
|
||||||
var _press_active := false
|
var _press_active := false
|
||||||
var _press_at := 0
|
var _press_at := 0
|
||||||
@@ -90,19 +92,36 @@ func _ready() -> void:
|
|||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
|
func _build_crumb_frame() -> void:
|
||||||
|
if crumb_frame_holder == null:
|
||||||
|
return
|
||||||
|
var selected := SaveGame.selected_frame()
|
||||||
|
if crumb_frame_id == selected and crumb_frame_holder.get_child_count() > 0:
|
||||||
|
return
|
||||||
|
for child in crumb_frame_holder.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
var frame := Frames.frame_panel(selected, 56)
|
||||||
|
var portrait := TextureRect.new()
|
||||||
|
portrait.custom_minimum_size = Vector2(44, 44)
|
||||||
|
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
|
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
|
portrait.texture = load("res://art/crumb_head.png")
|
||||||
|
portrait.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
frame.add_child(portrait)
|
||||||
|
crumb_frame_holder.add_child(frame)
|
||||||
|
crumb_frame_id = selected
|
||||||
|
|
||||||
|
|
||||||
func _make_crumb_card() -> PanelContainer:
|
func _make_crumb_card() -> PanelContainer:
|
||||||
var panel := UI.panel(Palette.PAPER, 14, 8)
|
var panel := UI.panel(Palette.PAPER, 14, 8)
|
||||||
var row := HBoxContainer.new()
|
var row := HBoxContainer.new()
|
||||||
row.add_theme_constant_override("separation", 8)
|
row.add_theme_constant_override("separation", 8)
|
||||||
panel.add_child(row)
|
panel.add_child(row)
|
||||||
|
|
||||||
var portrait := TextureRect.new()
|
crumb_frame_holder = CenterContainer.new()
|
||||||
portrait.custom_minimum_size = Vector2(50, 50)
|
crumb_frame_holder.custom_minimum_size = Vector2(56, 56)
|
||||||
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
row.add_child(crumb_frame_holder)
|
||||||
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
_build_crumb_frame()
|
||||||
if ResourceLoader.exists("res://art/crumb_head.png"):
|
|
||||||
portrait.texture = load("res://art/crumb_head.png")
|
|
||||||
row.add_child(portrait)
|
|
||||||
|
|
||||||
var text := VBoxContainer.new()
|
var text := VBoxContainer.new()
|
||||||
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
@@ -124,8 +143,9 @@ func _make_crumb_card() -> PanelContainer:
|
|||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
if grid == null:
|
if grid == null:
|
||||||
return
|
return
|
||||||
|
_build_crumb_frame()
|
||||||
for child in grid.get_children():
|
for child in grid.get_children():
|
||||||
child.free()
|
child.queue_free()
|
||||||
|
|
||||||
var guests := Guests.all()
|
var guests := Guests.all()
|
||||||
var unlocked := SaveGame.unlocked_count(guests)
|
var unlocked := SaveGame.unlocked_count(guests)
|
||||||
|
|||||||
@@ -4,10 +4,18 @@ signal play_pressed
|
|||||||
signal guest_book_pressed
|
signal guest_book_pressed
|
||||||
signal settings_pressed
|
signal settings_pressed
|
||||||
signal rules_pressed
|
signal rules_pressed
|
||||||
|
signal daily_pressed
|
||||||
|
signal profile_pressed
|
||||||
|
signal streak_pressed
|
||||||
|
|
||||||
var progress_pill: Button
|
var progress_pill: Button
|
||||||
var primary: Button
|
var primary: Button
|
||||||
var hint_label: Label
|
var hint_label: Label
|
||||||
|
var daily_button: Button
|
||||||
|
var streak_button: Button
|
||||||
|
var avatar_holder: CenterContainer
|
||||||
|
var avatar_frame_id := ""
|
||||||
|
var avatar_portrait_id := ""
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -27,20 +35,11 @@ func _ready() -> void:
|
|||||||
hub.add_theme_constant_override("separation", 0)
|
hub.add_theme_constant_override("separation", 0)
|
||||||
column.add_child(hub)
|
column.add_child(hub)
|
||||||
|
|
||||||
var avatar := Button.new()
|
|
||||||
avatar.custom_minimum_size = Vector2(52, 52)
|
|
||||||
avatar.flat = true
|
|
||||||
avatar.icon = load("res://art/crumb_head.png")
|
|
||||||
avatar.expand_icon = true
|
|
||||||
avatar.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
||||||
avatar.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
||||||
avatar.tooltip_text = "Guest Book"
|
|
||||||
avatar.pressed.connect(func() -> void: guest_book_pressed.emit())
|
|
||||||
|
|
||||||
var left := CenterContainer.new()
|
var left := CenterContainer.new()
|
||||||
left.custom_minimum_size = Vector2(52, 52)
|
left.custom_minimum_size = Vector2(56, 56)
|
||||||
left.add_child(avatar)
|
avatar_holder = left
|
||||||
hub.add_child(left)
|
hub.add_child(left)
|
||||||
|
_build_avatar()
|
||||||
|
|
||||||
var center := CenterContainer.new()
|
var center := CenterContainer.new()
|
||||||
center.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
center.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
@@ -65,21 +64,34 @@ func _ready() -> void:
|
|||||||
column.add_child(UI.heading("Ratdoku", 46))
|
column.add_child(UI.heading("Ratdoku", 46))
|
||||||
column.add_child(UI.label("A cozy rat hotel puzzle", 15, Palette.MUTED))
|
column.add_child(UI.label("A cozy rat hotel puzzle", 15, Palette.MUTED))
|
||||||
|
|
||||||
|
daily_button = UI.button("Daily room", false, 40)
|
||||||
|
daily_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
daily_button.add_theme_font_size_override("font_size", 13)
|
||||||
|
daily_button.pressed.connect(func() -> void: daily_pressed.emit())
|
||||||
|
streak_button = UI.button("Streak ›", false, 40)
|
||||||
|
streak_button.custom_minimum_size = Vector2(96, 40)
|
||||||
|
streak_button.add_theme_font_size_override("font_size", 12)
|
||||||
|
streak_button.pressed.connect(func() -> void: streak_pressed.emit())
|
||||||
|
var daily_row := HBoxContainer.new()
|
||||||
|
daily_row.add_theme_constant_override("separation", 6)
|
||||||
|
daily_row.add_child(daily_button)
|
||||||
|
daily_row.add_child(streak_button)
|
||||||
|
column.add_child(daily_row)
|
||||||
|
|
||||||
var top_space := Control.new()
|
var top_space := Control.new()
|
||||||
top_space.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
top_space.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||||
top_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
top_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
column.add_child(top_space)
|
column.add_child(top_space)
|
||||||
|
|
||||||
var card := UI.panel(Palette.CREAM, 26, 12)
|
var card := UI.panel(Palette.CREAM, 26, 12)
|
||||||
card.custom_minimum_size = Vector2(224, 224)
|
card.custom_minimum_size = Vector2(160, 160)
|
||||||
card.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
card.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
||||||
var mascot := _make_mascot()
|
var mascot := _make_mascot()
|
||||||
mascot.custom_minimum_size = Vector2(200, 200)
|
mascot.custom_minimum_size = Vector2(138, 138)
|
||||||
card.add_child(mascot)
|
card.add_child(mascot)
|
||||||
column.add_child(card)
|
column.add_child(card)
|
||||||
|
|
||||||
column.add_child(UI.label("Crumb, innkeeper", 12, Palette.MUTED))
|
column.add_child(UI.label("Crumb, innkeeper", 12, Palette.MUTED))
|
||||||
column.add_child(UI.label("Every guest gets a room of their own.", 15))
|
|
||||||
hint_label = UI.label(UI.place_hint(), 11, Palette.MUTED)
|
hint_label = UI.label(UI.place_hint(), 11, Palette.MUTED)
|
||||||
column.add_child(hint_label)
|
column.add_child(hint_label)
|
||||||
|
|
||||||
@@ -121,6 +133,8 @@ func _ready() -> void:
|
|||||||
|
|
||||||
func refresh() -> void:
|
func refresh() -> void:
|
||||||
hint_label.text = UI.place_hint()
|
hint_label.text = UI.place_hint()
|
||||||
|
daily_button.text = _daily_text()
|
||||||
|
_refresh_avatar()
|
||||||
var guests := Guests.all()
|
var guests := Guests.all()
|
||||||
var unlocked := SaveGame.unlocked_count(guests)
|
var unlocked := SaveGame.unlocked_count(guests)
|
||||||
progress_pill.text = "%d / %d guests" % [unlocked, guests.size()]
|
progress_pill.text = "%d / %d guests" % [unlocked, guests.size()]
|
||||||
@@ -134,6 +148,43 @@ func refresh() -> void:
|
|||||||
primary.text = "Continue Room %d" % (last + 1)
|
primary.text = "Continue Room %d" % (last + 1)
|
||||||
|
|
||||||
|
|
||||||
|
func _daily_text() -> String:
|
||||||
|
var streak := SaveGame.daily_streak()
|
||||||
|
if SaveGame.daily_completed_today():
|
||||||
|
return "Daily done · %d-day streak" % streak
|
||||||
|
if streak > 0:
|
||||||
|
return "Daily room · %d-day streak" % streak
|
||||||
|
return "Daily room · start a streak"
|
||||||
|
|
||||||
|
|
||||||
|
func _build_avatar() -> void:
|
||||||
|
var frame := Frames.frame_panel(SaveGame.selected_frame(), 56)
|
||||||
|
var avatar := Button.new()
|
||||||
|
avatar.custom_minimum_size = Vector2(44, 44)
|
||||||
|
avatar.flat = true
|
||||||
|
avatar.icon = load(Avatars.portrait_path(SaveGame.selected_avatar()))
|
||||||
|
avatar.expand_icon = true
|
||||||
|
avatar.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
|
avatar.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
|
avatar.tooltip_text = "Profile"
|
||||||
|
avatar.pressed.connect(func() -> void: profile_pressed.emit())
|
||||||
|
frame.add_child(avatar)
|
||||||
|
avatar_holder.add_child(frame)
|
||||||
|
avatar_frame_id = SaveGame.selected_frame()
|
||||||
|
avatar_portrait_id = SaveGame.selected_avatar()
|
||||||
|
|
||||||
|
|
||||||
|
func _refresh_avatar() -> void:
|
||||||
|
if (
|
||||||
|
avatar_frame_id == SaveGame.selected_frame()
|
||||||
|
and avatar_portrait_id == SaveGame.selected_avatar()
|
||||||
|
):
|
||||||
|
return
|
||||||
|
for child in avatar_holder.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
_build_avatar()
|
||||||
|
|
||||||
|
|
||||||
func _make_mascot() -> Control:
|
func _make_mascot() -> Control:
|
||||||
if ResourceLoader.exists("res://art/crumb.png"):
|
if ResourceLoader.exists("res://art/crumb.png"):
|
||||||
var texture_rect := TextureRect.new()
|
var texture_rect := TextureRect.new()
|
||||||
|
|||||||
@@ -4,13 +4,19 @@ const HomeScene = preload("res://scenes/Home.tscn")
|
|||||||
const GameScene = preload("res://scenes/Game.tscn")
|
const GameScene = preload("res://scenes/Game.tscn")
|
||||||
const GuestBookScene = preload("res://scenes/GuestBook.tscn")
|
const GuestBookScene = preload("res://scenes/GuestBook.tscn")
|
||||||
const RulebookScene = preload("res://scenes/Rulebook.tscn")
|
const RulebookScene = preload("res://scenes/Rulebook.tscn")
|
||||||
|
const ProfileScene = preload("res://scenes/Profile.tscn")
|
||||||
|
const StreakScene = preload("res://scenes/Streak.tscn")
|
||||||
const SettingsSheetScene = preload("res://scenes/SettingsSheet.tscn")
|
const SettingsSheetScene = preload("res://scenes/SettingsSheet.tscn")
|
||||||
|
|
||||||
var home
|
var home
|
||||||
var game
|
var game
|
||||||
var guest_book
|
var guest_book
|
||||||
var rulebook
|
var rulebook
|
||||||
|
var profile
|
||||||
|
var streak
|
||||||
var settings_sheet
|
var settings_sheet
|
||||||
|
var quit_layer: ColorRect
|
||||||
|
var quit_button: Button
|
||||||
var screens := {}
|
var screens := {}
|
||||||
var current := "home"
|
var current := "home"
|
||||||
var nav_stack: Array[String] = []
|
var nav_stack: Array[String] = []
|
||||||
@@ -29,6 +35,9 @@ func _ready() -> void:
|
|||||||
home.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
|
home.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
|
||||||
home.settings_pressed.connect(func() -> void: open_settings("home"))
|
home.settings_pressed.connect(func() -> void: open_settings("home"))
|
||||||
home.rules_pressed.connect(func() -> void: show_screen("rules"))
|
home.rules_pressed.connect(func() -> void: show_screen("rules"))
|
||||||
|
home.daily_pressed.connect(_on_daily)
|
||||||
|
home.profile_pressed.connect(func() -> void: show_screen("profile"))
|
||||||
|
home.streak_pressed.connect(func() -> void: show_screen("streak"))
|
||||||
|
|
||||||
game = GameScene.instantiate()
|
game = GameScene.instantiate()
|
||||||
_add_screen(game)
|
_add_screen(game)
|
||||||
@@ -44,6 +53,15 @@ func _ready() -> void:
|
|||||||
_add_screen(rulebook)
|
_add_screen(rulebook)
|
||||||
rulebook.back_pressed.connect(go_back)
|
rulebook.back_pressed.connect(go_back)
|
||||||
|
|
||||||
|
profile = ProfileScene.instantiate()
|
||||||
|
_add_screen(profile)
|
||||||
|
profile.back_pressed.connect(go_back)
|
||||||
|
profile.streak_pressed.connect(func() -> void: show_screen("streak"))
|
||||||
|
|
||||||
|
streak = StreakScene.instantiate()
|
||||||
|
_add_screen(streak)
|
||||||
|
streak.back_pressed.connect(go_back)
|
||||||
|
|
||||||
settings_sheet = SettingsSheetScene.instantiate()
|
settings_sheet = SettingsSheetScene.instantiate()
|
||||||
add_child(settings_sheet)
|
add_child(settings_sheet)
|
||||||
settings_sheet.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
settings_sheet.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
@@ -53,11 +71,15 @@ func _ready() -> void:
|
|||||||
settings_sheet.lobby_requested.connect(_on_lobby_requested)
|
settings_sheet.lobby_requested.connect(_on_lobby_requested)
|
||||||
settings_sheet.rules_requested.connect(_on_rules_requested)
|
settings_sheet.rules_requested.connect(_on_rules_requested)
|
||||||
|
|
||||||
|
_build_quit_confirm()
|
||||||
|
|
||||||
screens = {
|
screens = {
|
||||||
"home": home,
|
"home": home,
|
||||||
"game": game,
|
"game": game,
|
||||||
"guest_book": guest_book,
|
"guest_book": guest_book,
|
||||||
"rules": rulebook,
|
"rules": rulebook,
|
||||||
|
"profile": profile,
|
||||||
|
"streak": streak,
|
||||||
}
|
}
|
||||||
|
|
||||||
show_screen("home", false)
|
show_screen("home", false)
|
||||||
@@ -135,3 +157,128 @@ func _on_play() -> void:
|
|||||||
var start_index: int = clampi(int(SaveGame.data.get("last_room", 0)), 0, max_index)
|
var start_index: int = clampi(int(SaveGame.data.get("last_room", 0)), 0, max_index)
|
||||||
show_screen("game")
|
show_screen("game")
|
||||||
game.start_level(start_index)
|
game.start_level(start_index)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_daily() -> void:
|
||||||
|
var key := Daily.today_key()
|
||||||
|
var index := Daily.level_index(game.levels.size(), key)
|
||||||
|
show_screen("game")
|
||||||
|
game.start_daily(index, key)
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
if _handle_back():
|
||||||
|
accept_event()
|
||||||
|
|
||||||
|
|
||||||
|
func _notification(what: int) -> void:
|
||||||
|
if what == NOTIFICATION_WM_GO_BACK_REQUEST:
|
||||||
|
_handle_back()
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_back() -> bool:
|
||||||
|
if quit_layer != null and quit_layer.visible:
|
||||||
|
_hide_quit_confirm()
|
||||||
|
return true
|
||||||
|
if settings_sheet != null and settings_sheet.visible:
|
||||||
|
if settings_sheet.confirm_layer != null and settings_sheet.confirm_layer.visible:
|
||||||
|
settings_sheet._hide_confirm()
|
||||||
|
else:
|
||||||
|
close_settings()
|
||||||
|
return true
|
||||||
|
if guest_book != null and guest_book.visible and guest_book.detail_layer.visible:
|
||||||
|
guest_book._detail_opened_at -= DETAIL_GUARD_BYPASS_MS
|
||||||
|
guest_book._try_close_detail()
|
||||||
|
return true
|
||||||
|
if current == "game" and game != null and game.overlay.visible:
|
||||||
|
game.hide_win()
|
||||||
|
return true
|
||||||
|
if current == "home":
|
||||||
|
_show_quit_confirm()
|
||||||
|
return true
|
||||||
|
go_back()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
const DETAIL_GUARD_BYPASS_MS := 300
|
||||||
|
|
||||||
|
|
||||||
|
func _build_quit_confirm() -> void:
|
||||||
|
quit_layer = ColorRect.new()
|
||||||
|
quit_layer.color = Color(0.18, 0.12, 0.08, 0.62)
|
||||||
|
quit_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
quit_layer.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
quit_layer.gui_input.connect(func(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
_hide_quit_confirm()
|
||||||
|
)
|
||||||
|
quit_layer.visible = false
|
||||||
|
add_child(quit_layer)
|
||||||
|
|
||||||
|
var center := CenterContainer.new()
|
||||||
|
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
quit_layer.add_child(center)
|
||||||
|
|
||||||
|
var panel := UI.panel(Palette.CREAM, 24, 16)
|
||||||
|
var max_width: int = max(240, int(get_viewport_rect().size.x) - 32)
|
||||||
|
panel.custom_minimum_size = Vector2(min(320, max_width), 0)
|
||||||
|
panel.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
center.add_child(panel)
|
||||||
|
|
||||||
|
var box := VBoxContainer.new()
|
||||||
|
box.add_theme_constant_override("separation", 10)
|
||||||
|
panel.add_child(box)
|
||||||
|
box.add_child(UI.heading("Leave Ratdoku?", 20))
|
||||||
|
var body := UI.label("Thanks for playing. Come back tomorrow for a new daily room.", 13, Palette.MUTED)
|
||||||
|
body.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
box.add_child(body)
|
||||||
|
|
||||||
|
var actions := HBoxContainer.new()
|
||||||
|
actions.add_theme_constant_override("separation", 8)
|
||||||
|
box.add_child(actions)
|
||||||
|
var cancel := UI.button("Cancel", false, 46)
|
||||||
|
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
cancel.pressed.connect(_hide_quit_confirm)
|
||||||
|
actions.add_child(cancel)
|
||||||
|
quit_button = UI.button("Quit", false, 46)
|
||||||
|
quit_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
_apply_red_style(quit_button)
|
||||||
|
quit_button.pressed.connect(func() -> void: get_tree().quit())
|
||||||
|
actions.add_child(quit_button)
|
||||||
|
|
||||||
|
|
||||||
|
func _show_quit_confirm() -> void:
|
||||||
|
quit_layer.visible = true
|
||||||
|
quit_layer.move_to_front()
|
||||||
|
|
||||||
|
|
||||||
|
func _hide_quit_confirm() -> void:
|
||||||
|
quit_layer.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _apply_red_style(button: Button) -> void:
|
||||||
|
var color := Palette.RED
|
||||||
|
button.add_theme_stylebox_override("normal", _red_box(color))
|
||||||
|
button.add_theme_stylebox_override("hover", _red_box(color.lightened(0.07)))
|
||||||
|
button.add_theme_stylebox_override("pressed", _red_box(color.darkened(0.10)))
|
||||||
|
button.add_theme_stylebox_override("focus", _red_box(color))
|
||||||
|
button.add_theme_color_override("font_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_hover_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_pressed_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_focus_color", Palette.WHITE)
|
||||||
|
|
||||||
|
|
||||||
|
func _red_box(color: Color) -> StyleBoxFlat:
|
||||||
|
var style := StyleBoxFlat.new()
|
||||||
|
style.bg_color = color
|
||||||
|
style.corner_radius_top_left = 26
|
||||||
|
style.corner_radius_top_right = 26
|
||||||
|
style.corner_radius_bottom_left = 26
|
||||||
|
style.corner_radius_bottom_right = 26
|
||||||
|
style.content_margin_left = 16
|
||||||
|
style.content_margin_right = 16
|
||||||
|
style.content_margin_top = 10
|
||||||
|
style.content_margin_bottom = 10
|
||||||
|
return style
|
||||||
@@ -0,0 +1,287 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_pressed
|
||||||
|
signal streak_pressed
|
||||||
|
|
||||||
|
var portrait_holder: CenterContainer
|
||||||
|
var name_label: Label
|
||||||
|
var role_label: Label
|
||||||
|
var rooms_label: Label
|
||||||
|
var streak_label: Label
|
||||||
|
var best_label: Label
|
||||||
|
var frame_grid: GridContainer
|
||||||
|
var status_label: Label
|
||||||
|
var avatar_tab: Button
|
||||||
|
var frame_tab: Button
|
||||||
|
var current_tab := "avatar"
|
||||||
|
var pending_avatar := "crumb"
|
||||||
|
var pending_frame := "plain"
|
||||||
|
var portrait_key := ""
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var margin := MarginContainer.new()
|
||||||
|
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
margin.add_theme_constant_override("margin_left", 12)
|
||||||
|
margin.add_theme_constant_override("margin_right", 12)
|
||||||
|
margin.add_theme_constant_override("margin_top", UI.safe_top())
|
||||||
|
margin.add_theme_constant_override("margin_bottom", UI.safe_bottom())
|
||||||
|
add_child(margin)
|
||||||
|
|
||||||
|
var column := VBoxContainer.new()
|
||||||
|
column.add_theme_constant_override("separation", 6)
|
||||||
|
margin.add_child(column)
|
||||||
|
|
||||||
|
var top := HBoxContainer.new()
|
||||||
|
top.add_theme_constant_override("separation", 6)
|
||||||
|
column.add_child(top)
|
||||||
|
|
||||||
|
var back := UI.round_button("res://assets/icons/arrow-left.svg", 40)
|
||||||
|
back.pressed.connect(func() -> void: back_pressed.emit())
|
||||||
|
top.add_child(back)
|
||||||
|
|
||||||
|
var title := UI.label("Profile", 22)
|
||||||
|
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
top.add_child(title)
|
||||||
|
|
||||||
|
var scroll := ScrollContainer.new()
|
||||||
|
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||||
|
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||||
|
column.add_child(scroll)
|
||||||
|
|
||||||
|
var content := VBoxContainer.new()
|
||||||
|
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
content.add_theme_constant_override("separation", 8)
|
||||||
|
scroll.add_child(content)
|
||||||
|
|
||||||
|
portrait_holder = CenterContainer.new()
|
||||||
|
content.add_child(portrait_holder)
|
||||||
|
|
||||||
|
name_label = UI.label("Crumb", 20, Palette.INK, true)
|
||||||
|
content.add_child(name_label)
|
||||||
|
role_label = UI.label("Innkeeper · always in", 11, Palette.MUTED)
|
||||||
|
content.add_child(role_label)
|
||||||
|
|
||||||
|
var stats := HBoxContainer.new()
|
||||||
|
stats.add_theme_constant_override("separation", 6)
|
||||||
|
content.add_child(stats)
|
||||||
|
rooms_label = _stat_card(stats, "Rooms", "0 / 30")
|
||||||
|
streak_label = _stat_card(stats, "Streak", "0")
|
||||||
|
best_label = _stat_card(stats, "Best", "0")
|
||||||
|
|
||||||
|
var view_streak := UI.button("View daily streak ›", false, 40)
|
||||||
|
view_streak.add_theme_font_size_override("font_size", 14)
|
||||||
|
view_streak.pressed.connect(func() -> void: streak_pressed.emit())
|
||||||
|
content.add_child(view_streak)
|
||||||
|
|
||||||
|
var tabs := HBoxContainer.new()
|
||||||
|
tabs.add_theme_constant_override("separation", 6)
|
||||||
|
content.add_child(tabs)
|
||||||
|
avatar_tab = UI.button("Avatar", false, 38)
|
||||||
|
avatar_tab.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
avatar_tab.pressed.connect(func() -> void: _set_tab("avatar"))
|
||||||
|
tabs.add_child(avatar_tab)
|
||||||
|
frame_tab = UI.button("Frame", false, 38)
|
||||||
|
frame_tab.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
frame_tab.pressed.connect(func() -> void: _set_tab("frame"))
|
||||||
|
tabs.add_child(frame_tab)
|
||||||
|
|
||||||
|
frame_grid = GridContainer.new()
|
||||||
|
frame_grid.columns = 2
|
||||||
|
frame_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
frame_grid.add_theme_constant_override("h_separation", 6)
|
||||||
|
frame_grid.add_theme_constant_override("v_separation", 6)
|
||||||
|
content.add_child(frame_grid)
|
||||||
|
|
||||||
|
status_label = UI.label("Pick a look, then confirm.", 11, Palette.MUTED)
|
||||||
|
status_label.custom_minimum_size = Vector2(0, 22)
|
||||||
|
content.add_child(status_label)
|
||||||
|
|
||||||
|
var actions := HBoxContainer.new()
|
||||||
|
actions.add_theme_constant_override("separation", 8)
|
||||||
|
content.add_child(actions)
|
||||||
|
var cancel := UI.button("Cancel", false, 46)
|
||||||
|
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
cancel.pressed.connect(_on_cancel)
|
||||||
|
actions.add_child(cancel)
|
||||||
|
var confirm := UI.button("Confirm", true, 46)
|
||||||
|
confirm.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
confirm.pressed.connect(_on_confirm)
|
||||||
|
actions.add_child(confirm)
|
||||||
|
|
||||||
|
UI.pass_scroll_input(content)
|
||||||
|
SaveGame.progress_changed.connect(refresh)
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
|
func _stat_card(parent: HBoxContainer, title: String, value: String) -> Label:
|
||||||
|
var panel := UI.panel(Palette.PAPER, 12, 6)
|
||||||
|
panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
var box := VBoxContainer.new()
|
||||||
|
box.add_theme_constant_override("separation", 0)
|
||||||
|
panel.add_child(box)
|
||||||
|
box.add_child(UI.label(title, 10, Palette.MUTED))
|
||||||
|
var number := UI.label(value, 16)
|
||||||
|
box.add_child(number)
|
||||||
|
parent.add_child(panel)
|
||||||
|
return number
|
||||||
|
|
||||||
|
|
||||||
|
func refresh() -> void:
|
||||||
|
pending_avatar = SaveGame.selected_avatar()
|
||||||
|
pending_frame = SaveGame.selected_frame()
|
||||||
|
rooms_label.text = "%d / 30" % SaveGame.rooms_completed()
|
||||||
|
streak_label.text = str(SaveGame.daily_streak())
|
||||||
|
best_label.text = str(SaveGame.best_streak())
|
||||||
|
var avatar: Dictionary = Avatars.by_id(pending_avatar)
|
||||||
|
name_label.text = str(avatar.get("name", "Crumb"))
|
||||||
|
role_label.text = "Innkeeper · always in" if pending_avatar == "crumb" else "Guest · Hotel Ratdoku"
|
||||||
|
status_label.text = "Pick a look, then confirm."
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
||||||
|
_update_tab_styles()
|
||||||
|
_build_portrait()
|
||||||
|
_build_grid()
|
||||||
|
|
||||||
|
|
||||||
|
func _set_tab(tab: String) -> void:
|
||||||
|
if current_tab == tab:
|
||||||
|
return
|
||||||
|
current_tab = tab
|
||||||
|
_update_tab_styles()
|
||||||
|
_build_grid()
|
||||||
|
|
||||||
|
|
||||||
|
func _update_tab_styles() -> void:
|
||||||
|
avatar_tab.add_theme_stylebox_override("normal", _card_style(Palette.GOLD if current_tab == "avatar" else Palette.PAPER))
|
||||||
|
frame_tab.add_theme_stylebox_override("normal", _card_style(Palette.GOLD if current_tab == "frame" else Palette.PAPER))
|
||||||
|
|
||||||
|
|
||||||
|
func _build_portrait() -> void:
|
||||||
|
var key: String = pending_avatar + "|" + pending_frame
|
||||||
|
if portrait_key == key and portrait_holder.get_child_count() > 0:
|
||||||
|
return
|
||||||
|
for child in portrait_holder.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
var frame := Frames.frame_panel(pending_frame, 118)
|
||||||
|
var head := TextureRect.new()
|
||||||
|
head.texture = load(Avatars.portrait_path(pending_avatar))
|
||||||
|
head.custom_minimum_size = Vector2(96, 96)
|
||||||
|
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
|
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
|
head.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
frame.add_child(head)
|
||||||
|
portrait_holder.add_child(frame)
|
||||||
|
portrait_key = key
|
||||||
|
|
||||||
|
|
||||||
|
func _build_grid() -> void:
|
||||||
|
for child in frame_grid.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
var entries: Array = Avatars.all() if current_tab == "avatar" else Frames.all()
|
||||||
|
var selected := pending_avatar if current_tab == "avatar" else pending_frame
|
||||||
|
for entry in entries:
|
||||||
|
var id := str(entry.get("id", ""))
|
||||||
|
var unlocked := Avatars.is_unlocked(id) if current_tab == "avatar" else Frames.is_unlocked(id)
|
||||||
|
var card := Button.new()
|
||||||
|
card.custom_minimum_size = Vector2(148, 92)
|
||||||
|
card.flat = true
|
||||||
|
card.add_theme_stylebox_override("normal", _card_style(Palette.PAPER))
|
||||||
|
card.add_theme_stylebox_override("hover", _card_style(Palette.PAPER_DARK))
|
||||||
|
card.add_theme_stylebox_override("pressed", _card_style(Palette.GOLD))
|
||||||
|
card.pressed.connect(_on_card_pressed.bind(id, unlocked, current_tab))
|
||||||
|
|
||||||
|
var row := HBoxContainer.new()
|
||||||
|
row.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
row.add_theme_constant_override("separation", 6)
|
||||||
|
row.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
card.add_child(row)
|
||||||
|
|
||||||
|
var badge := Frames.frame_panel(pending_frame if current_tab == "avatar" else id, 46)
|
||||||
|
badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
var head := TextureRect.new()
|
||||||
|
head.texture = load(Avatars.portrait_path(id) if current_tab == "avatar" else "res://art/crumb_head.png")
|
||||||
|
head.custom_minimum_size = Vector2(30, 30)
|
||||||
|
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
|
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
|
head.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
badge.add_child(head)
|
||||||
|
row.add_child(badge)
|
||||||
|
|
||||||
|
var text := VBoxContainer.new()
|
||||||
|
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
text.add_theme_constant_override("separation", 0)
|
||||||
|
text.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
row.add_child(text)
|
||||||
|
|
||||||
|
var name := UI.label(str(entry.get("name", "")), 12)
|
||||||
|
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
text.add_child(name)
|
||||||
|
|
||||||
|
var detail := ""
|
||||||
|
if id == selected:
|
||||||
|
detail = "Selected"
|
||||||
|
elif unlocked:
|
||||||
|
detail = "Unlocked"
|
||||||
|
else:
|
||||||
|
detail = Avatars.requirement_text(id) if current_tab == "avatar" else Frames.requirement_text(id)
|
||||||
|
var sub := UI.label(detail, 9, Palette.GOLD if id == selected else (Palette.MUTED if unlocked else Palette.RED))
|
||||||
|
sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
text.add_child(sub)
|
||||||
|
|
||||||
|
if not unlocked:
|
||||||
|
card.modulate = Color(1, 1, 1, 0.55)
|
||||||
|
frame_grid.add_child(card)
|
||||||
|
|
||||||
|
UI.pass_scroll_input(frame_grid)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_card_pressed(id: String, unlocked: bool, tab: String) -> void:
|
||||||
|
if not unlocked:
|
||||||
|
var requirement := Avatars.requirement_text(id) if tab == "avatar" else Frames.requirement_text(id)
|
||||||
|
status_label.text = "Locked: %s." % requirement
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.RED)
|
||||||
|
return
|
||||||
|
call_deferred("_select_card", id, tab)
|
||||||
|
|
||||||
|
|
||||||
|
func _select_card(id: String, tab: String) -> void:
|
||||||
|
if tab == "avatar":
|
||||||
|
pending_avatar = id
|
||||||
|
else:
|
||||||
|
pending_frame = id
|
||||||
|
_build_portrait()
|
||||||
|
_build_grid()
|
||||||
|
status_label.text = "Preview only — press Confirm to save."
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_cancel() -> void:
|
||||||
|
pending_avatar = SaveGame.selected_avatar()
|
||||||
|
pending_frame = SaveGame.selected_frame()
|
||||||
|
_build_portrait()
|
||||||
|
_build_grid()
|
||||||
|
status_label.text = "Changes discarded."
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_confirm() -> void:
|
||||||
|
SaveGame.apply_profile(pending_avatar, pending_frame)
|
||||||
|
status_label.text = "Profile updated."
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.MUTED)
|
||||||
|
|
||||||
|
|
||||||
|
func _card_style(color: Color) -> StyleBoxFlat:
|
||||||
|
var style := StyleBoxFlat.new()
|
||||||
|
style.bg_color = color
|
||||||
|
style.corner_radius_top_left = 12
|
||||||
|
style.corner_radius_top_right = 12
|
||||||
|
style.corner_radius_bottom_left = 12
|
||||||
|
style.corner_radius_bottom_right = 12
|
||||||
|
style.content_margin_left = 6
|
||||||
|
style.content_margin_right = 6
|
||||||
|
style.content_margin_top = 6
|
||||||
|
style.content_margin_bottom = 6
|
||||||
|
return style
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://w44h7f4ea2ao
|
||||||
@@ -23,19 +23,31 @@ func _ready() -> void:
|
|||||||
load_game()
|
load_game()
|
||||||
|
|
||||||
|
|
||||||
|
func _default_daily() -> Dictionary:
|
||||||
|
return {
|
||||||
|
"last_completed": "",
|
||||||
|
"streak": 0,
|
||||||
|
"best_streak": 0,
|
||||||
|
"history": [],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func _default_data() -> Dictionary:
|
func _default_data() -> Dictionary:
|
||||||
return {
|
return {
|
||||||
"version": 2,
|
"version": 4,
|
||||||
"completed_rooms": [],
|
"completed_rooms": [],
|
||||||
"unlocked_guests": [],
|
"unlocked_guests": [],
|
||||||
"settings": DEFAULTS.duplicate(true),
|
"settings": DEFAULTS.duplicate(true),
|
||||||
"last_room": 0,
|
"last_room": 0,
|
||||||
|
"daily": _default_daily(),
|
||||||
|
"profile_frame": "plain",
|
||||||
|
"avatar_id": "crumb",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func load_game() -> void:
|
func load_game() -> void:
|
||||||
data = _default_data()
|
data = _default_data()
|
||||||
var stored_version := 2
|
var stored_version := 4
|
||||||
|
|
||||||
if FileAccess.file_exists(PATH):
|
if FileAccess.file_exists(PATH):
|
||||||
var file := FileAccess.open(PATH, FileAccess.READ)
|
var file := FileAccess.open(PATH, FileAccess.READ)
|
||||||
@@ -53,19 +65,40 @@ func load_game() -> void:
|
|||||||
if not data["settings"].has(key):
|
if not data["settings"].has(key):
|
||||||
data["settings"][key] = DEFAULTS[key]
|
data["settings"][key] = DEFAULTS[key]
|
||||||
|
|
||||||
# Version 2 makes double-tap the default. Older saves were written while
|
var daily_defaults := _default_daily()
|
||||||
# hold was the default, so switch them once; the toggle still persists
|
if typeof(data.get("daily")) != TYPE_DICTIONARY:
|
||||||
# after that.
|
data["daily"] = daily_defaults
|
||||||
|
else:
|
||||||
|
for key in daily_defaults:
|
||||||
|
if not data["daily"].has(key):
|
||||||
|
data["daily"][key] = daily_defaults[key]
|
||||||
|
if typeof(data.get("profile_frame")) != TYPE_STRING or str(data["profile_frame"]).is_empty():
|
||||||
|
data["profile_frame"] = "plain"
|
||||||
|
if typeof(data.get("avatar_id")) != TYPE_STRING or str(data["avatar_id"]).is_empty():
|
||||||
|
data["avatar_id"] = "crumb"
|
||||||
|
if typeof(data["daily"].get("history")) != TYPE_ARRAY:
|
||||||
|
data["daily"]["history"] = []
|
||||||
|
|
||||||
|
var migrated := false
|
||||||
|
# Version 2 made double-tap the default; version 3 added daily streaks
|
||||||
|
# and profile frames; version 4 added avatars and streak history.
|
||||||
if stored_version < 2:
|
if stored_version < 2:
|
||||||
data["settings"]["double_tap_place"] = true
|
data["settings"]["double_tap_place"] = true
|
||||||
data["version"] = 2
|
migrated = true
|
||||||
save_game()
|
if stored_version < 3:
|
||||||
|
migrated = true
|
||||||
|
if stored_version < 4:
|
||||||
|
migrated = true
|
||||||
|
|
||||||
if typeof(data.get("completed_rooms")) != TYPE_ARRAY:
|
if typeof(data.get("completed_rooms")) != TYPE_ARRAY:
|
||||||
data["completed_rooms"] = []
|
data["completed_rooms"] = []
|
||||||
if typeof(data.get("unlocked_guests")) != TYPE_ARRAY:
|
if typeof(data.get("unlocked_guests")) != TYPE_ARRAY:
|
||||||
data["unlocked_guests"] = []
|
data["unlocked_guests"] = []
|
||||||
|
|
||||||
|
if migrated:
|
||||||
|
data["version"] = 4
|
||||||
|
save_game()
|
||||||
|
|
||||||
|
|
||||||
func save_game() -> void:
|
func save_game() -> void:
|
||||||
var file := FileAccess.open(PATH, FileAccess.WRITE)
|
var file := FileAccess.open(PATH, FileAccess.WRITE)
|
||||||
@@ -128,3 +161,88 @@ func unlocked_count(guests: Array) -> int:
|
|||||||
if is_guest_unlocked(str(guest["id"])):
|
if is_guest_unlocked(str(guest["id"])):
|
||||||
total += 1
|
total += 1
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
|
||||||
|
func rooms_completed() -> int:
|
||||||
|
return (data.get("completed_rooms") as Array).size()
|
||||||
|
|
||||||
|
|
||||||
|
func daily_data() -> Dictionary:
|
||||||
|
if typeof(data.get("daily")) != TYPE_DICTIONARY:
|
||||||
|
data["daily"] = _default_daily()
|
||||||
|
return data["daily"]
|
||||||
|
|
||||||
|
|
||||||
|
func daily_streak() -> int:
|
||||||
|
var daily := daily_data()
|
||||||
|
var last := Daily.day_number(str(daily.get("last_completed", "")))
|
||||||
|
var today := Daily.day_number(Daily.today_key())
|
||||||
|
if last == today or last == today - 1:
|
||||||
|
return int(daily.get("streak", 0))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
func best_streak() -> int:
|
||||||
|
return int(daily_data().get("best_streak", 0))
|
||||||
|
|
||||||
|
|
||||||
|
func daily_completed_today() -> bool:
|
||||||
|
return str(daily_data().get("last_completed", "")) == Daily.today_key()
|
||||||
|
|
||||||
|
|
||||||
|
func complete_daily(key: String) -> bool:
|
||||||
|
# Only today's room counts, and only once per local day.
|
||||||
|
if key.is_empty() or key != Daily.today_key():
|
||||||
|
return false
|
||||||
|
var daily := daily_data()
|
||||||
|
if str(daily.get("last_completed", "")) == key:
|
||||||
|
return false
|
||||||
|
|
||||||
|
var today := Daily.day_number(key)
|
||||||
|
var last := Daily.day_number(str(daily.get("last_completed", "")))
|
||||||
|
var streak := int(daily.get("streak", 0)) + 1 if last == today - 1 else 1
|
||||||
|
daily["streak"] = streak
|
||||||
|
daily["last_completed"] = key
|
||||||
|
daily["best_streak"] = max(int(daily.get("best_streak", 0)), streak)
|
||||||
|
var history: Array = daily.get("history", [])
|
||||||
|
if not history.has(key):
|
||||||
|
history.append(key)
|
||||||
|
while history.size() > 60:
|
||||||
|
history.pop_front()
|
||||||
|
daily["history"] = history
|
||||||
|
data["daily"] = daily
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func daily_history() -> Array:
|
||||||
|
var history: Array = daily_data().get("history", [])
|
||||||
|
return history.duplicate()
|
||||||
|
|
||||||
|
|
||||||
|
func selected_frame() -> String:
|
||||||
|
return str(data.get("profile_frame", "plain"))
|
||||||
|
|
||||||
|
|
||||||
|
func selected_avatar() -> String:
|
||||||
|
return str(data.get("avatar_id", "crumb"))
|
||||||
|
|
||||||
|
|
||||||
|
func select_frame(id: String) -> void:
|
||||||
|
data["profile_frame"] = id
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func select_avatar(id: String) -> void:
|
||||||
|
data["avatar_id"] = id
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func apply_profile(avatar_id: String, frame_id: String) -> void:
|
||||||
|
data["avatar_id"] = avatar_id
|
||||||
|
data["profile_frame"] = frame_id
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
@@ -13,10 +13,14 @@ var hold_panel: PanelContainer
|
|||||||
var game_actions: HBoxContainer
|
var game_actions: HBoxContainer
|
||||||
var reset_row: Control
|
var reset_row: Control
|
||||||
var resume_button: Button
|
var resume_button: Button
|
||||||
var restart_dialog: ConfirmationDialog
|
|
||||||
var reset_dialog: ConfirmationDialog
|
|
||||||
var reset_status: Label
|
var reset_status: Label
|
||||||
|
|
||||||
|
var confirm_layer: ColorRect
|
||||||
|
var confirm_title: Label
|
||||||
|
var confirm_body: Label
|
||||||
|
var confirm_button: Button
|
||||||
|
var confirm_callback := Callable()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
@@ -128,17 +132,80 @@ func _ready() -> void:
|
|||||||
|
|
||||||
column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
|
column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
|
||||||
|
|
||||||
restart_dialog = ConfirmationDialog.new()
|
_build_confirm()
|
||||||
restart_dialog.title = "Restart room?"
|
|
||||||
restart_dialog.dialog_text = "This clears the current board and timer."
|
|
||||||
restart_dialog.confirmed.connect(func() -> void: restart_requested.emit())
|
|
||||||
add_child(restart_dialog)
|
|
||||||
|
|
||||||
reset_dialog = ConfirmationDialog.new()
|
|
||||||
reset_dialog.title = "Reset progress?"
|
func _build_confirm() -> void:
|
||||||
reset_dialog.dialog_text = "This clears completed rooms and unlocked guests. Settings stay."
|
confirm_layer = ColorRect.new()
|
||||||
reset_dialog.confirmed.connect(_on_reset_confirmed)
|
confirm_layer.color = Color(0.18, 0.12, 0.08, 0.62)
|
||||||
add_child(reset_dialog)
|
confirm_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
confirm_layer.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
confirm_layer.gui_input.connect(_on_confirm_scrim_input)
|
||||||
|
confirm_layer.visible = false
|
||||||
|
add_child(confirm_layer)
|
||||||
|
|
||||||
|
var center := CenterContainer.new()
|
||||||
|
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
confirm_layer.add_child(center)
|
||||||
|
|
||||||
|
var panel := UI.panel(Palette.CREAM, 24, 16)
|
||||||
|
var max_width: int = max(240, int(get_viewport_rect().size.x) - 32)
|
||||||
|
panel.custom_minimum_size = Vector2(min(320, max_width), 0)
|
||||||
|
panel.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
center.add_child(panel)
|
||||||
|
|
||||||
|
var box := VBoxContainer.new()
|
||||||
|
box.add_theme_constant_override("separation", 10)
|
||||||
|
panel.add_child(box)
|
||||||
|
|
||||||
|
confirm_title = UI.heading("Reset progress?", 20)
|
||||||
|
confirm_title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
box.add_child(confirm_title)
|
||||||
|
|
||||||
|
confirm_body = UI.label("", 13, Palette.MUTED)
|
||||||
|
confirm_body.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
box.add_child(confirm_body)
|
||||||
|
|
||||||
|
var actions := HBoxContainer.new()
|
||||||
|
actions.add_theme_constant_override("separation", 8)
|
||||||
|
box.add_child(actions)
|
||||||
|
|
||||||
|
var cancel := UI.button("Cancel", false, 46)
|
||||||
|
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
cancel.pressed.connect(_hide_confirm)
|
||||||
|
actions.add_child(cancel)
|
||||||
|
|
||||||
|
confirm_button = UI.button("Reset", false, 46)
|
||||||
|
confirm_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
_apply_red_style(confirm_button)
|
||||||
|
confirm_button.pressed.connect(_on_confirm_pressed)
|
||||||
|
actions.add_child(confirm_button)
|
||||||
|
|
||||||
|
|
||||||
|
func _apply_red_style(button: Button) -> void:
|
||||||
|
button.add_theme_stylebox_override("normal", _red_box(Palette.RED))
|
||||||
|
button.add_theme_stylebox_override("hover", _red_box(Palette.RED.lightened(0.07)))
|
||||||
|
button.add_theme_stylebox_override("pressed", _red_box(Palette.RED.darkened(0.10)))
|
||||||
|
button.add_theme_stylebox_override("focus", _red_box(Palette.RED))
|
||||||
|
button.add_theme_color_override("font_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_hover_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_pressed_color", Palette.WHITE)
|
||||||
|
button.add_theme_color_override("font_focus_color", Palette.WHITE)
|
||||||
|
|
||||||
|
|
||||||
|
func _red_box(color: Color) -> StyleBoxFlat:
|
||||||
|
var style := StyleBoxFlat.new()
|
||||||
|
style.bg_color = color
|
||||||
|
style.corner_radius_top_left = 26
|
||||||
|
style.corner_radius_top_right = 26
|
||||||
|
style.corner_radius_bottom_left = 26
|
||||||
|
style.corner_radius_bottom_right = 26
|
||||||
|
style.content_margin_left = 16
|
||||||
|
style.content_margin_right = 16
|
||||||
|
style.content_margin_top = 10
|
||||||
|
style.content_margin_bottom = 10
|
||||||
|
return style
|
||||||
|
|
||||||
|
|
||||||
func open_sheet(mode: String) -> void:
|
func open_sheet(mode: String) -> void:
|
||||||
@@ -302,7 +369,12 @@ func _close() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_restart() -> void:
|
func _on_restart() -> void:
|
||||||
restart_dialog.popup_centered()
|
_show_confirm(
|
||||||
|
"Restart room?",
|
||||||
|
"This clears the current board and timer.",
|
||||||
|
"Restart",
|
||||||
|
func() -> void: restart_requested.emit()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func _on_lobby() -> void:
|
func _on_lobby() -> void:
|
||||||
@@ -311,7 +383,38 @@ func _on_lobby() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_reset() -> void:
|
func _on_reset() -> void:
|
||||||
reset_dialog.popup_centered()
|
_show_confirm(
|
||||||
|
"Reset progress?",
|
||||||
|
"This clears completed rooms and unlocked guests. Settings stay.",
|
||||||
|
"Reset",
|
||||||
|
_on_reset_confirmed
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _show_confirm(title: String, body: String, action: String, callback: Callable) -> void:
|
||||||
|
confirm_title.text = title
|
||||||
|
confirm_body.text = body
|
||||||
|
confirm_button.text = action
|
||||||
|
confirm_callback = callback
|
||||||
|
confirm_layer.visible = true
|
||||||
|
confirm_layer.move_to_front()
|
||||||
|
|
||||||
|
|
||||||
|
func _hide_confirm() -> void:
|
||||||
|
confirm_layer.visible = false
|
||||||
|
confirm_callback = Callable()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_confirm_scrim_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
_hide_confirm()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_confirm_pressed() -> void:
|
||||||
|
var callback := confirm_callback
|
||||||
|
_hide_confirm()
|
||||||
|
if callback.is_valid():
|
||||||
|
callback.call()
|
||||||
|
|
||||||
|
|
||||||
func _on_reset_confirmed() -> void:
|
func _on_reset_confirmed() -> void:
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_pressed
|
||||||
|
|
||||||
|
var current_label: Label
|
||||||
|
var best_label: Label
|
||||||
|
var goal_label: Label
|
||||||
|
var week_row: HBoxContainer
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var margin := MarginContainer.new()
|
||||||
|
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
margin.add_theme_constant_override("margin_left", 12)
|
||||||
|
margin.add_theme_constant_override("margin_right", 12)
|
||||||
|
margin.add_theme_constant_override("margin_top", UI.safe_top())
|
||||||
|
margin.add_theme_constant_override("margin_bottom", UI.safe_bottom())
|
||||||
|
add_child(margin)
|
||||||
|
|
||||||
|
var column := VBoxContainer.new()
|
||||||
|
column.add_theme_constant_override("separation", 6)
|
||||||
|
margin.add_child(column)
|
||||||
|
|
||||||
|
var top := HBoxContainer.new()
|
||||||
|
top.add_theme_constant_override("separation", 6)
|
||||||
|
column.add_child(top)
|
||||||
|
var back := UI.round_button("res://assets/icons/arrow-left.svg", 40)
|
||||||
|
back.pressed.connect(func() -> void: back_pressed.emit())
|
||||||
|
top.add_child(back)
|
||||||
|
var title := UI.label("Daily Streak", 22)
|
||||||
|
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
|
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
top.add_child(title)
|
||||||
|
|
||||||
|
var scroll := ScrollContainer.new()
|
||||||
|
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||||
|
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||||
|
column.add_child(scroll)
|
||||||
|
|
||||||
|
var content := VBoxContainer.new()
|
||||||
|
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
content.add_theme_constant_override("separation", 8)
|
||||||
|
scroll.add_child(content)
|
||||||
|
|
||||||
|
var emblem := CenterContainer.new()
|
||||||
|
content.add_child(emblem)
|
||||||
|
var star := UI.icon("res://assets/icons/star_gold.svg", 96, Palette.WHITE)
|
||||||
|
emblem.add_child(star)
|
||||||
|
|
||||||
|
current_label = UI.label("0", 52, Palette.ORANGE, true)
|
||||||
|
content.add_child(current_label)
|
||||||
|
content.add_child(UI.heading("Current Streak", 20, Palette.ORANGE))
|
||||||
|
|
||||||
|
var best_panel := UI.panel(Palette.WHITE, 22, 8)
|
||||||
|
best_panel.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
||||||
|
best_label = UI.label("Best streak: 0", 12, Palette.MUTED)
|
||||||
|
best_label.autowrap_mode = TextServer.AUTOWRAP_OFF
|
||||||
|
best_label.custom_minimum_size = Vector2(160, 0)
|
||||||
|
best_panel.add_child(best_label)
|
||||||
|
content.add_child(best_panel)
|
||||||
|
|
||||||
|
goal_label = UI.label("", 12, Palette.INK)
|
||||||
|
content.add_child(goal_label)
|
||||||
|
|
||||||
|
content.add_child(UI.heading("This week", 18))
|
||||||
|
week_row = HBoxContainer.new()
|
||||||
|
week_row.add_theme_constant_override("separation", 4)
|
||||||
|
week_row.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
content.add_child(week_row)
|
||||||
|
|
||||||
|
var gift := CenterContainer.new()
|
||||||
|
content.add_child(gift)
|
||||||
|
var gift_row := HBoxContainer.new()
|
||||||
|
gift_row.custom_minimum_size = Vector2(150, 0)
|
||||||
|
gift_row.add_theme_constant_override("separation", 6)
|
||||||
|
gift.add_child(gift_row)
|
||||||
|
gift_row.add_child(UI.icon("res://assets/icons/star_gold.svg", 22, Palette.WHITE))
|
||||||
|
var gift_text := UI.label("7-day gift", 12, Palette.MUTED)
|
||||||
|
gift_text.autowrap_mode = TextServer.AUTOWRAP_OFF
|
||||||
|
gift_text.custom_minimum_size = Vector2(110, 0)
|
||||||
|
gift_row.add_child(gift_text)
|
||||||
|
|
||||||
|
UI.pass_scroll_input(content)
|
||||||
|
SaveGame.progress_changed.connect(refresh)
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
|
func refresh() -> void:
|
||||||
|
var streak := SaveGame.daily_streak()
|
||||||
|
current_label.text = str(streak)
|
||||||
|
best_label.text = "Best streak: %d" % SaveGame.best_streak()
|
||||||
|
goal_label.text = Daily.goal_text(streak)
|
||||||
|
_build_week()
|
||||||
|
|
||||||
|
|
||||||
|
func _build_week() -> void:
|
||||||
|
for child in week_row.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
var keys: Array = Daily.week_keys()
|
||||||
|
var labels: Array = Daily.weekday_labels()
|
||||||
|
var history: Array = SaveGame.daily_history()
|
||||||
|
var today := Daily.today_key()
|
||||||
|
for i in range(7):
|
||||||
|
var key := str(keys[i])
|
||||||
|
var done := history.has(key)
|
||||||
|
var is_today := key == today
|
||||||
|
var chip := VBoxContainer.new()
|
||||||
|
chip.add_theme_constant_override("separation", 2)
|
||||||
|
chip.add_child(UI.label(str(labels[i]), 9, Palette.MUTED))
|
||||||
|
var circle := PanelContainer.new()
|
||||||
|
circle.custom_minimum_size = Vector2(42, 42)
|
||||||
|
var style := StyleBoxFlat.new()
|
||||||
|
style.bg_color = Palette.GOLD if done else Palette.PAPER
|
||||||
|
style.corner_radius_top_left = 21
|
||||||
|
style.corner_radius_top_right = 21
|
||||||
|
style.corner_radius_bottom_left = 21
|
||||||
|
style.corner_radius_bottom_right = 21
|
||||||
|
style.border_width_left = 3 if is_today else 1
|
||||||
|
style.border_width_right = 3 if is_today else 1
|
||||||
|
style.border_width_top = 3 if is_today else 1
|
||||||
|
style.border_width_bottom = 3 if is_today else 1
|
||||||
|
style.border_color = Palette.ORANGE if is_today else Palette.PAPER_DARK
|
||||||
|
circle.add_theme_stylebox_override("panel", style)
|
||||||
|
if done:
|
||||||
|
var center := CenterContainer.new()
|
||||||
|
circle.add_child(center)
|
||||||
|
center.add_child(UI.icon("res://assets/icons/star_white.svg", 20, Palette.WHITE))
|
||||||
|
chip.add_child(circle)
|
||||||
|
week_row.add_child(chip)
|
||||||
|
|
||||||
|
UI.pass_scroll_input(week_row)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dqlbnhq0n653j
|
||||||
@@ -86,7 +86,7 @@ static func round_button(icon_path: String, size: int = 48) -> Button:
|
|||||||
var b := Button.new()
|
var b := Button.new()
|
||||||
b.custom_minimum_size = Vector2(size, size)
|
b.custom_minimum_size = Vector2(size, size)
|
||||||
b.icon = load(icon_path)
|
b.icon = load(icon_path)
|
||||||
b.expand_icon = false
|
b.expand_icon = true
|
||||||
b.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
b.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
b.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
b.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
b.add_theme_stylebox_override("normal", _round_style(Palette.PAPER))
|
b.add_theme_stylebox_override("normal", _round_style(Palette.PAPER))
|
||||||
@@ -186,6 +186,12 @@ static func _round_style(color: Color) -> StyleBoxFlat:
|
|||||||
s.corner_radius_top_right = 26
|
s.corner_radius_top_right = 26
|
||||||
s.corner_radius_bottom_left = 26
|
s.corner_radius_bottom_left = 26
|
||||||
s.corner_radius_bottom_right = 26
|
s.corner_radius_bottom_right = 26
|
||||||
|
# Keep high-resolution icons near their original visual size inside the
|
||||||
|
# round button instead of letting expand_icon fill the whole control.
|
||||||
|
s.content_margin_left = 10
|
||||||
|
s.content_margin_right = 10
|
||||||
|
s.content_margin_top = 10
|
||||||
|
s.content_margin_bottom = 10
|
||||||
s.shadow_color = Color(0.29, 0.20, 0.14, 0.12)
|
s.shadow_color = Color(0.29, 0.20, 0.14, 0.12)
|
||||||
s.shadow_size = 4
|
s.shadow_size = 4
|
||||||
s.shadow_offset = Vector2(0, 2)
|
s.shadow_offset = Vector2(0, 2)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class_name Version
|
class_name Version
|
||||||
extends RefCounted
|
extends RefCounted
|
||||||
|
|
||||||
const NUMBER := "0.4.3-alpha"
|
const NUMBER := "0.6.1-alpha"
|
||||||
const CODENAME := "Tap Twice"
|
const CODENAME := "Back Button"
|
||||||
const BUILD_DATE := "2026-12-02"
|
const BUILD_DATE := "2026-12-03"
|
||||||
const BUILD_LABEL := "v0.4.3-alpha · build 2026-12-02"
|
const BUILD_LABEL := "v0.6.1-alpha · build 2026-12-03"
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
param(
|
||||||
|
[switch]$Build,
|
||||||
|
[switch]$Screenshots
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$project = Split-Path $PSScriptRoot -Parent
|
||||||
|
$godot = "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe"
|
||||||
|
if (-not (Test-Path $godot)) {
|
||||||
|
throw "Godot executable not found."
|
||||||
|
}
|
||||||
|
|
||||||
|
$tempRoot = "C:\Users\enter\AppData\Local\Temp\opencode"
|
||||||
|
New-Item -ItemType Directory -Force -Path $tempRoot | Out-Null
|
||||||
|
$logFile = Join-Path $tempRoot "ratdoku-qa.log"
|
||||||
|
Remove-Item $logFile -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
$failures = @()
|
||||||
|
$checks = @()
|
||||||
|
|
||||||
|
function Write-Section([string]$text) {
|
||||||
|
Write-Host "`n=== $text ==="
|
||||||
|
Add-Content -Path $logFile -Value "=== $text ==="
|
||||||
|
}
|
||||||
|
|
||||||
|
function Quote-Args([string[]]$items) {
|
||||||
|
return ($items | ForEach-Object {
|
||||||
|
if ($_ -match '\s') { '"' + $_ + '"' } else { $_ }
|
||||||
|
}) -join " "
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-Godot([string[]]$arguments, [string]$name, [string]$marker) {
|
||||||
|
$outFile = Join-Path $tempRoot "qa-$name.out"
|
||||||
|
$errFile = Join-Path $tempRoot "qa-$name.err"
|
||||||
|
Remove-Item $outFile, $errFile -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
$process = Start-Process -FilePath $godot -ArgumentList (Quote-Args $arguments) `
|
||||||
|
-Wait -PassThru -RedirectStandardOutput $outFile -RedirectStandardError $errFile
|
||||||
|
|
||||||
|
$text = ""
|
||||||
|
if (Test-Path $outFile) { $text += (Get-Content $outFile -Raw) }
|
||||||
|
if (Test-Path $errFile) { $text += "`n" + (Get-Content $errFile -Raw) }
|
||||||
|
Add-Content -Path $logFile -Value $text
|
||||||
|
|
||||||
|
$hasMarker = $text -match [regex]::Escape($marker)
|
||||||
|
$hasError = $text -match 'ERROR:|SCRIPT ERROR:|Parse Error|FAIL:|Assertion failed'
|
||||||
|
if ($process.ExitCode -ne 0 -or -not $hasMarker -or $hasError) {
|
||||||
|
$script:failures += $name
|
||||||
|
Write-Host "FAIL $name (exit=$($process.ExitCode) marker=$hasMarker error=$hasError)"
|
||||||
|
if (-not $hasMarker) { Write-Host " missing marker: $marker" }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "PASS $name"
|
||||||
|
$script:checks += $name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Section "Godot project scan"
|
||||||
|
Invoke-Godot @("--headless", "--path", $project, "--editor", "--quit") "class-scan" "Godot Engine"
|
||||||
|
|
||||||
|
$tests = @(
|
||||||
|
@{ File = "tools/smoke_test.gd"; Marker = "SMOKE TEST: PASS"; Name = "smoke" },
|
||||||
|
@{ File = "tools/ui_test.gd"; Marker = "UI TEST: PASS"; Name = "ui" },
|
||||||
|
@{ File = "tools/qa_core.gd"; Marker = "QA CORE: PASS"; Name = "qa-core" },
|
||||||
|
@{ File = "tools/qa_ui.gd"; Marker = "QA UI: PASS"; Name = "qa-ui" },
|
||||||
|
@{ File = "tools/qa_input.gd"; Marker = "QA INPUT: PASS"; Name = "qa-input" }
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($test in $tests) {
|
||||||
|
$path = Join-Path $project $test.File
|
||||||
|
if (-not (Test-Path $path)) {
|
||||||
|
$script:failures += $test.Name
|
||||||
|
Write-Host "FAIL $($test.Name) (script missing: $($test.File))"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
Write-Section $test.Name
|
||||||
|
Invoke-Godot @(
|
||||||
|
"--headless", "--path", $project,
|
||||||
|
"--script", "res://$($test.File)", "--quit-after", "12000"
|
||||||
|
) $test.Name $test.Marker
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Screenshots) {
|
||||||
|
Write-Section "screenshots"
|
||||||
|
Invoke-Godot @("--path", $project, "--script", "res://tools/screenshot.gd", "--quit-after", "12000") "screenshots" "Saved"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Build) {
|
||||||
|
Write-Section "android build"
|
||||||
|
$buildScript = Join-Path $PSScriptRoot "build_android.ps1"
|
||||||
|
$buildOut = Join-Path $tempRoot "qa-build.out"
|
||||||
|
$buildErr = Join-Path $tempRoot "qa-build.err"
|
||||||
|
Remove-Item $buildOut, $buildErr -Force -ErrorAction SilentlyContinue
|
||||||
|
$buildProc = Start-Process -FilePath "powershell.exe" `
|
||||||
|
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$buildScript`"" `
|
||||||
|
-Wait -PassThru -RedirectStandardOutput $buildOut -RedirectStandardError $buildErr
|
||||||
|
$buildOutput = ""
|
||||||
|
if (Test-Path $buildOut) { $buildOutput += (Get-Content $buildOut -Raw) }
|
||||||
|
if (Test-Path $buildErr) { $buildOutput += "`n" + (Get-Content $buildErr -Raw) }
|
||||||
|
Add-Content -Path $logFile -Value $buildOutput
|
||||||
|
$apk = Join-Path $project "build/Ratdoku.apk"
|
||||||
|
if ($buildProc.ExitCode -ne 0 -or $buildOutput -notmatch 'DONE' -or -not (Test-Path $apk)) {
|
||||||
|
$script:failures += "android-build"
|
||||||
|
Write-Host "FAIL android-build"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "PASS android-build"
|
||||||
|
$script:checks += "android-build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Section "summary"
|
||||||
|
Write-Host "Passed: $($checks.Count)"
|
||||||
|
Write-Host "Failed: $($failures.Count)"
|
||||||
|
if ($failures.Count -gt 0) {
|
||||||
|
Write-Host ("Failed suites: " + ($failures -join ", "))
|
||||||
|
}
|
||||||
|
Write-Host "Full log: $logFile"
|
||||||
|
|
||||||
|
if ($failures.Count -gt 0) { exit 1 }
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,583 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
## Headless core QA: save migration, daily logic, frames, and game data.
|
||||||
|
## <godot> --headless --path . --script res://tools/qa_core.gd --quit-after 1200
|
||||||
|
##
|
||||||
|
## This suite only ever replaces the game's own save file (SaveGame.PATH).
|
||||||
|
## It leaves every other file alone and restores a clean save before it exits.
|
||||||
|
|
||||||
|
var failures := 0
|
||||||
|
var frames = null
|
||||||
|
var avatars = null
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if not condition:
|
||||||
|
failures += 1
|
||||||
|
print("FAIL: ", message)
|
||||||
|
|
||||||
|
|
||||||
|
func _note(message: String) -> void:
|
||||||
|
print("QA CORE: ", message)
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
var save = root.get_node_or_null("SaveGame")
|
||||||
|
_check(save != null, "SaveGame autoload missing")
|
||||||
|
if save == null:
|
||||||
|
_finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Resolve Frames at runtime: a static reference compiles it before the
|
||||||
|
# SaveGame autoload is registered when launched with --script.
|
||||||
|
frames = load("res://scripts/Frames.gd")
|
||||||
|
_check(frames != null, "Frames script missing")
|
||||||
|
avatars = load("res://scripts/Avatars.gd")
|
||||||
|
_check(avatars != null, "Avatars script missing")
|
||||||
|
if frames == null or avatars == null:
|
||||||
|
_finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
_test_save_migrations(save)
|
||||||
|
_test_daily(save)
|
||||||
|
_test_frames(save)
|
||||||
|
_test_avatars_and_streak(save)
|
||||||
|
_test_game_data(save)
|
||||||
|
_test_icons()
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
_finish()
|
||||||
|
|
||||||
|
|
||||||
|
func _test_avatars_and_streak(save) -> void:
|
||||||
|
_note("5. avatars and streak view")
|
||||||
|
var list: Array = avatars.all()
|
||||||
|
_check(list.size() == 26, "Crumb plus 25 guests should be selectable")
|
||||||
|
_check(avatars.is_unlocked("crumb"), "Crumb should always be available")
|
||||||
|
_check(avatars.by_id("does-not-exist").is_empty(), "unknown avatar should resolve to nothing")
|
||||||
|
var locked_id := ""
|
||||||
|
for entry in list:
|
||||||
|
var id := str(entry.get("id", ""))
|
||||||
|
if id != "crumb" and not avatars.is_unlocked(id):
|
||||||
|
locked_id = id
|
||||||
|
break
|
||||||
|
_check(locked_id != "", "a guest avatar should be locked with no progress")
|
||||||
|
_check(not avatars.requirement_text(locked_id).is_empty(), "locked avatar should show a requirement")
|
||||||
|
|
||||||
|
save.reset_progress()
|
||||||
|
save.select_avatar("crumb")
|
||||||
|
save.load_game()
|
||||||
|
_check(save.selected_avatar() == "crumb", "avatar selection should persist")
|
||||||
|
|
||||||
|
save.apply_profile("crumb", "gold")
|
||||||
|
save.load_game()
|
||||||
|
_check(save.selected_avatar() == "crumb" and save.selected_frame() == "gold", "profile should save both choices at once")
|
||||||
|
|
||||||
|
var keys: Array = Daily.week_keys()
|
||||||
|
_check(keys.size() == 7, "the streak week should have seven days")
|
||||||
|
_check(Daily.weekday_labels().size() == 7, "the streak week should have seven labels")
|
||||||
|
_check(Daily.goal_text(0).find("Regular") >= 0, "early streak goal should point to Regular")
|
||||||
|
_check(Daily.goal_text(4).find("Night Owl") >= 0, "mid streak goal should point to Night Owl")
|
||||||
|
_check(Daily.goal_text(7).find("gift") >= 0, "completed week should show the gift goal")
|
||||||
|
|
||||||
|
var today := Daily.today_key()
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
save.complete_daily(today)
|
||||||
|
_check(save.daily_history().has(today), "completing a daily should record history")
|
||||||
|
save.complete_daily(today)
|
||||||
|
_check(save.daily_history().size() == 1, "replaying a day should not duplicate history")
|
||||||
|
_reset_to_clean(save)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_icons() -> void:
|
||||||
|
_note("6. icon assets")
|
||||||
|
# Load at runtime so UI.gd does not compile before the autoload exists.
|
||||||
|
var ui_script = load("res://scripts/UI.gd")
|
||||||
|
_check(ui_script != null, "UI script missing")
|
||||||
|
if ui_script == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
var dir := DirAccess.open("res://assets/icons")
|
||||||
|
_check(dir != null, "icons directory missing")
|
||||||
|
if dir == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
var count := 0
|
||||||
|
for file in dir.get_files():
|
||||||
|
if not file.ends_with(".svg"):
|
||||||
|
continue
|
||||||
|
count += 1
|
||||||
|
var texture = load("res://assets/icons/" + file)
|
||||||
|
_check(texture != null, "icon failed to load: %s" % file)
|
||||||
|
if texture != null:
|
||||||
|
var size: Vector2 = texture.get_size()
|
||||||
|
_check(size.x >= 96 and size.y >= 96, "icon too small: %s (%dx%d)" % [file, size.x, size.y])
|
||||||
|
_check(count >= 10, "expected the full icon set")
|
||||||
|
|
||||||
|
var button = ui_script.round_button("res://assets/icons/arrow-left.svg", 44)
|
||||||
|
_check(button.expand_icon, "round buttons should expand high-res icons")
|
||||||
|
var style := button.get_theme_stylebox("normal") as StyleBoxFlat
|
||||||
|
_check(style != null and style.content_margin_left >= 8, "round buttons should use margins to keep icon size")
|
||||||
|
var small_icon = ui_script.icon("res://assets/icons/settings.svg", 18)
|
||||||
|
_check(small_icon.texture.get_size().x >= 96, "UI.icon should use high-res textures")
|
||||||
|
button.free()
|
||||||
|
small_icon.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if failures == 0:
|
||||||
|
print("QA CORE: PASS")
|
||||||
|
quit(0)
|
||||||
|
else:
|
||||||
|
print("QA CORE: FAIL (%d)" % failures)
|
||||||
|
quit(1)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Helpers
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _write_save(save, dict: Dictionary) -> void:
|
||||||
|
var file := FileAccess.open(save.PATH, FileAccess.WRITE)
|
||||||
|
if file == null:
|
||||||
|
_check(false, "could not open save path for writing: %s" % save.PATH)
|
||||||
|
return
|
||||||
|
file.store_string(JSON.stringify(dict, "\t"))
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
|
func _remove_save(save) -> void:
|
||||||
|
if FileAccess.file_exists(save.PATH):
|
||||||
|
var err := DirAccess.remove_absolute(ProjectSettings.globalize_path(save.PATH))
|
||||||
|
if err != OK:
|
||||||
|
_check(false, "could not remove test save file")
|
||||||
|
|
||||||
|
|
||||||
|
func _reset_to_clean(save) -> void:
|
||||||
|
save.data = save._default_data()
|
||||||
|
save.save_game()
|
||||||
|
save.load_game()
|
||||||
|
|
||||||
|
|
||||||
|
func _same_value(a, b) -> bool:
|
||||||
|
if typeof(a) == TYPE_INT or typeof(a) == TYPE_FLOAT:
|
||||||
|
if typeof(b) == TYPE_INT or typeof(b) == TYPE_FLOAT:
|
||||||
|
return absf(float(a) - float(b)) < 0.0001
|
||||||
|
return false
|
||||||
|
if typeof(a) == TYPE_BOOL or typeof(b) == TYPE_BOOL:
|
||||||
|
return typeof(a) == TYPE_BOOL and typeof(b) == TYPE_BOOL and bool(a) == bool(b)
|
||||||
|
return str(a) == str(b)
|
||||||
|
|
||||||
|
|
||||||
|
func _is_default_daily(save, daily: Dictionary) -> bool:
|
||||||
|
var defaults: Dictionary = save._default_daily()
|
||||||
|
return (
|
||||||
|
str(daily.get("last_completed", "")) == str(defaults["last_completed"])
|
||||||
|
and _same_value(daily.get("streak", -1), defaults["streak"])
|
||||||
|
and _same_value(daily.get("best_streak", -1), defaults["best_streak"])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 1. Save migration matrix
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_save_migrations(save) -> void:
|
||||||
|
_note("1. save migration matrix")
|
||||||
|
|
||||||
|
# (a) No save file at all -> fresh version-4 defaults.
|
||||||
|
_remove_save(save)
|
||||||
|
save.load_game()
|
||||||
|
_check(int(save.data.get("version", 0)) == 4, "fresh save should be version 4")
|
||||||
|
_check(bool(save.get_setting("double_tap_place")), "fresh save should default to double-tap")
|
||||||
|
_check(_is_default_daily(save, save.daily_data()), "fresh save should have default daily stats")
|
||||||
|
_check(save.selected_frame() == "plain", "fresh save should select the plain frame")
|
||||||
|
_check((save.data.get("completed_rooms") as Array).is_empty(), "fresh save should have no rooms")
|
||||||
|
_check((save.data.get("unlocked_guests") as Array).is_empty(), "fresh save should have no guests")
|
||||||
|
|
||||||
|
# (b) Version 1 with hold-to-place and no daily/frame keys -> migrate to v3.
|
||||||
|
var v1: Dictionary = save._default_data()
|
||||||
|
v1["version"] = 1
|
||||||
|
v1["settings"]["double_tap_place"] = false
|
||||||
|
v1.erase("daily")
|
||||||
|
v1.erase("profile_frame")
|
||||||
|
_write_save(save, v1)
|
||||||
|
save.load_game()
|
||||||
|
_check(int(save.data.get("version", 0)) == 4, "version 1 should migrate to version 4")
|
||||||
|
_check(bool(save.get_setting("double_tap_place")), "version 1 should migrate to double-tap")
|
||||||
|
_check(_is_default_daily(save, save.daily_data()), "version 1 missing daily should become defaults")
|
||||||
|
_check(save.selected_frame() == "plain", "version 1 missing frame should become plain")
|
||||||
|
|
||||||
|
# (c) Version 2 with hold-to-place -> stay on hold, gain v3 daily/frame data.
|
||||||
|
var v2: Dictionary = save._default_data()
|
||||||
|
v2["version"] = 2
|
||||||
|
v2["settings"]["double_tap_place"] = false
|
||||||
|
v2.erase("daily")
|
||||||
|
v2.erase("profile_frame")
|
||||||
|
_write_save(save, v2)
|
||||||
|
save.load_game()
|
||||||
|
_check(int(save.data.get("version", 0)) == 4, "version 2 should migrate to version 4")
|
||||||
|
_check(not bool(save.get_setting("double_tap_place")), "version 2 double_tap=false should stay false")
|
||||||
|
_check(_is_default_daily(save, save.daily_data()), "version 2 missing daily should become defaults")
|
||||||
|
_check(save.selected_frame() == "plain", "version 2 missing frame should become plain")
|
||||||
|
|
||||||
|
# (d) Valid JSON with the wrong top-level shape -> no crash, defaults restored.
|
||||||
|
var broken := FileAccess.open(save.PATH, FileAccess.WRITE)
|
||||||
|
if broken != null:
|
||||||
|
broken.store_string("[]")
|
||||||
|
broken.close()
|
||||||
|
else:
|
||||||
|
_check(false, "could not write wrong-shape save")
|
||||||
|
save.load_game()
|
||||||
|
_check(int(save.data.get("version", 0)) == 4, "wrong-shape save should restore version 4 defaults")
|
||||||
|
_check(bool(save.get_setting("double_tap_place")), "wrong-shape save should restore double-tap default")
|
||||||
|
_check(_is_default_daily(save, save.daily_data()), "wrong-shape save should restore daily defaults")
|
||||||
|
_check(save.selected_frame() == "plain", "wrong-shape save should restore plain frame")
|
||||||
|
_check((save.data.get("completed_rooms") as Array).is_empty(), "malformed JSON should have no rooms")
|
||||||
|
|
||||||
|
# (e) Missing individual setting keys are filled from DEFAULTS.
|
||||||
|
var partial: Dictionary = save._default_data()
|
||||||
|
partial["version"] = 4
|
||||||
|
partial["settings"] = {}
|
||||||
|
_write_save(save, partial)
|
||||||
|
save.load_game()
|
||||||
|
for key in save.DEFAULTS:
|
||||||
|
_check(save.data["settings"].has(key), "missing setting '%s' should be filled" % key)
|
||||||
|
_check(
|
||||||
|
_same_value(save.get_setting(key), save.DEFAULTS[key]),
|
||||||
|
"filled setting '%s' should match DEFAULTS" % key
|
||||||
|
)
|
||||||
|
|
||||||
|
# A version-4 save's explicit false must not be overwritten by a default.
|
||||||
|
var explicit_false: Dictionary = save._default_data()
|
||||||
|
explicit_false["version"] = 4
|
||||||
|
explicit_false["settings"]["double_tap_place"] = false
|
||||||
|
_write_save(save, explicit_false)
|
||||||
|
save.load_game()
|
||||||
|
_check(not bool(save.get_setting("double_tap_place")), "an explicit false should not be overwritten")
|
||||||
|
_check(bool(save.get_setting("patterns")), "unlisted settings should still be filled from DEFAULTS")
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 2. Daily logic
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_daily(save) -> void:
|
||||||
|
_note("2. daily logic")
|
||||||
|
|
||||||
|
var today: String = Daily.today_key()
|
||||||
|
_check(today.length() == 10, "today key should be YYYY-MM-DD (10 chars)")
|
||||||
|
_check(today.substr(4, 1) == "-" and today.substr(7, 1) == "-", "today key separators should be dashes")
|
||||||
|
_check(
|
||||||
|
today.substr(0, 4).is_valid_int()
|
||||||
|
and today.substr(5, 2).is_valid_int()
|
||||||
|
and today.substr(8, 2).is_valid_int(),
|
||||||
|
"today key date parts should be numeric"
|
||||||
|
)
|
||||||
|
var now: Dictionary = Time.get_date_dict_from_system()
|
||||||
|
_check(
|
||||||
|
today == "%04d-%02d-%02d" % [int(now["year"]), int(now["month"]), int(now["day"])],
|
||||||
|
"today key should match the system's local date"
|
||||||
|
)
|
||||||
|
_check(Daily.day_number("") == 0, "an empty key should map to day 0")
|
||||||
|
_check(Daily.day_number("bad-key") == 0, "a malformed key should map to day 0")
|
||||||
|
|
||||||
|
# Round trip between date keys and day numbers.
|
||||||
|
var base: int = Daily.day_number(today)
|
||||||
|
_note(
|
||||||
|
"day_number(%s)=%d, key_from_day_number=%s"
|
||||||
|
% [today, base, Daily.key_from_day_number(base)]
|
||||||
|
)
|
||||||
|
_check(Daily.key_from_day_number(base) == today, "key_from_day_number(day_number(today)) should be today")
|
||||||
|
for delta in [1, 7, 30, 100, 400]:
|
||||||
|
var key: String = Daily.key_from_day_number(base + delta)
|
||||||
|
_check(
|
||||||
|
Daily.day_number(key) == base + delta,
|
||||||
|
"day_number(key_from_day_number(%d)) should round trip" % delta
|
||||||
|
)
|
||||||
|
|
||||||
|
# Level selection: stable, in range, and valid on 30 consecutive dates.
|
||||||
|
_check(Daily.level_index(0, today) == -1, "level_index should be -1 with no levels")
|
||||||
|
_check(Daily.level_index(-5, today) == -1, "level_index should be -1 with a negative level count")
|
||||||
|
var idx: int = Daily.level_index(30, today)
|
||||||
|
_check(idx >= 0 and idx < 30, "level_index(30) should be in range")
|
||||||
|
_check(idx == Daily.level_index(30, today), "level_index should be stable for the same date")
|
||||||
|
var all_valid := true
|
||||||
|
var distinct := {}
|
||||||
|
for d in range(30):
|
||||||
|
var key: String = Daily.key_from_day_number(base + d)
|
||||||
|
var i: int = Daily.level_index(30, key)
|
||||||
|
if i < 0 or i >= 30:
|
||||||
|
all_valid = false
|
||||||
|
distinct[i] = true
|
||||||
|
_check(all_valid, "30 consecutive dates should all produce valid daily indices")
|
||||||
|
_note("distinct daily levels across 30 consecutive days: %d" % distinct.size())
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
|
||||||
|
# Consecutive days extend the streak and mark today complete.
|
||||||
|
var yesterday: String = Daily.key_from_day_number(Daily.day_number(today) - 1)
|
||||||
|
var daily: Dictionary = save._default_daily()
|
||||||
|
daily["last_completed"] = yesterday
|
||||||
|
daily["streak"] = 2
|
||||||
|
daily["best_streak"] = 2
|
||||||
|
save.data["daily"] = daily
|
||||||
|
var rooms_before: Array = (save.data["completed_rooms"] as Array).duplicate()
|
||||||
|
var guests_before: Array = (save.data["unlocked_guests"] as Array).duplicate()
|
||||||
|
_check(Daily.day_number(yesterday) == Daily.day_number(today) - 1, "yesterday key should be one day before today")
|
||||||
|
_check(save.complete_daily(today), "completing today's daily should count")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 3, "consecutive daily should extend the streak to 3")
|
||||||
|
_check(save.daily_streak() == 3, "daily_streak should report a live streak of 3")
|
||||||
|
_check(save.best_streak() == 3, "best_streak should rise to 3")
|
||||||
|
_check(save.daily_completed_today(), "daily_completed_today should be true")
|
||||||
|
_check((save.data["completed_rooms"] as Array) == rooms_before, "daily must not change completed_rooms")
|
||||||
|
_check((save.data["unlocked_guests"] as Array) == guests_before, "daily must not change unlocked_guests")
|
||||||
|
|
||||||
|
# Same-day replay and wrong dates do nothing.
|
||||||
|
_check(not save.complete_daily(today), "same-day replay should return false")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 3, "same-day replay should not change the streak")
|
||||||
|
_check(not save.complete_daily(yesterday), "an older date should not count")
|
||||||
|
_check(not save.complete_daily(""), "an empty key should not count")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 3, "rejected dates should not change the streak")
|
||||||
|
|
||||||
|
# A gap resets the current streak but keeps the best.
|
||||||
|
_reset_to_clean(save)
|
||||||
|
var older: String = Daily.key_from_day_number(Daily.day_number(today) - 3)
|
||||||
|
daily = save._default_daily()
|
||||||
|
daily["last_completed"] = older
|
||||||
|
daily["streak"] = 9
|
||||||
|
daily["best_streak"] = 9
|
||||||
|
save.data["daily"] = daily
|
||||||
|
_check(save.complete_daily(today), "a daily after a gap should still count")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 1, "a gap should reset the streak to 1")
|
||||||
|
_check(save.best_streak() == 9, "best_streak should survive a gap")
|
||||||
|
|
||||||
|
# Best streak persists; a stale streak is reported as dead.
|
||||||
|
var best: int = save.best_streak()
|
||||||
|
save.data["daily"]["streak"] = 0
|
||||||
|
save.save_game()
|
||||||
|
save.load_game()
|
||||||
|
_check(save.best_streak() == best, "best_streak should persist through save/load")
|
||||||
|
_check(save.daily_streak() == 0, "a zero streak should be reported as 0")
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
_check(not save.daily_completed_today(), "a fresh daily state should not be complete today")
|
||||||
|
_check(save.daily_streak() == 0, "a fresh daily state should have no live streak")
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 3. Frames
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_frames(save) -> void:
|
||||||
|
_note("3. frames")
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
_check(frames.all().size() == 7, "there should be seven profile frames")
|
||||||
|
_check(frames.is_unlocked("plain"), "plain frame should always be unlocked")
|
||||||
|
_check(not frames.requirement_text("plain").is_empty(), "plain frame should have requirement text")
|
||||||
|
|
||||||
|
var locked_at_zero: Array = ["paper", "gold", "bell", "star", "regular", "night"]
|
||||||
|
for id in locked_at_zero:
|
||||||
|
_check(not frames.is_unlocked(str(id)), "%s should be locked with no progress" % id)
|
||||||
|
_check(not frames.requirement_text(str(id)).is_empty(), "%s should show a requirement while locked" % id)
|
||||||
|
_check(frames.by_id("does-not-exist").is_empty(), "unknown frame id should resolve to nothing")
|
||||||
|
_check(not frames.is_unlocked("does-not-exist"), "unknown frame should never be unlocked")
|
||||||
|
_check(frames.requirement_text("does-not-exist").is_empty(), "unknown frame should have empty requirement text")
|
||||||
|
|
||||||
|
var room_thresholds := {"paper": 5, "gold": 10, "bell": 20, "star": 30}
|
||||||
|
for id in room_thresholds:
|
||||||
|
var need: int = int(room_thresholds[id])
|
||||||
|
save.data["completed_rooms"] = []
|
||||||
|
for i in range(need - 1):
|
||||||
|
save.data["completed_rooms"].append("room-probe-%d" % i)
|
||||||
|
_check(not frames.is_unlocked(str(id)), "%s should be locked at %d rooms" % [id, need - 1])
|
||||||
|
save.data["completed_rooms"].append("room-probe-last")
|
||||||
|
_check(frames.is_unlocked(str(id)), "%s should unlock at %d rooms" % [id, need])
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
var streak_thresholds := {"regular": 3, "night": 7}
|
||||||
|
for id in streak_thresholds:
|
||||||
|
var need: int = int(streak_thresholds[id])
|
||||||
|
save.data["daily"]["best_streak"] = need - 1
|
||||||
|
_check(not frames.is_unlocked(str(id)), "%s should be locked at a %d-day best streak" % [id, need - 1])
|
||||||
|
save.data["daily"]["best_streak"] = need
|
||||||
|
_check(frames.is_unlocked(str(id)), "%s should unlock at a %d-day best streak" % [id, need])
|
||||||
|
|
||||||
|
# Selecting a locked frame must not make it unlocked.
|
||||||
|
_reset_to_clean(save)
|
||||||
|
save.select_frame("star")
|
||||||
|
save.save_game()
|
||||||
|
save.load_game()
|
||||||
|
_check(save.selected_frame() == "star", "selection itself should persist")
|
||||||
|
_check(not frames.is_unlocked("star"), "selecting a locked frame must not unlock it")
|
||||||
|
|
||||||
|
# A legitimately unlocked selection survives save/load.
|
||||||
|
_reset_to_clean(save)
|
||||||
|
for i in range(5):
|
||||||
|
save.data["completed_rooms"].append("room-%02d" % i)
|
||||||
|
save.select_frame("paper")
|
||||||
|
save.save_game()
|
||||||
|
save.load_game()
|
||||||
|
_check(frames.is_unlocked("paper"), "five-room unlock should survive save/load")
|
||||||
|
_check(save.selected_frame() == "paper", "frame selection should persist through save/load")
|
||||||
|
|
||||||
|
# Document reset_progress()'s actual behaviour instead of guessing.
|
||||||
|
_reset_to_clean(save)
|
||||||
|
save.data["completed_rooms"] = ["room-a", "room-b", "room-c"]
|
||||||
|
save.data["unlocked_guests"] = ["pepper", "miso"]
|
||||||
|
save.data["last_room"] = 3
|
||||||
|
save.data["daily"]["best_streak"] = 5
|
||||||
|
save.data["daily"]["streak"] = 2
|
||||||
|
save.data["daily"]["last_completed"] = Daily.today_key()
|
||||||
|
save.select_frame("regular")
|
||||||
|
save.reset_progress()
|
||||||
|
_note(
|
||||||
|
"reset_progress -> rooms=%d guests=%d last_room=%d best_streak=%d streak=%d last_completed=%s frame=%s"
|
||||||
|
% [
|
||||||
|
save.rooms_completed(),
|
||||||
|
(save.data["unlocked_guests"] as Array).size(),
|
||||||
|
int(save.data["last_room"]),
|
||||||
|
save.best_streak(),
|
||||||
|
int(save.daily_data().get("streak", -1)),
|
||||||
|
str(save.daily_data().get("last_completed", "")),
|
||||||
|
save.selected_frame()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
_check(save.rooms_completed() == 0, "reset_progress should clear completed_rooms")
|
||||||
|
_check((save.data["unlocked_guests"] as Array).is_empty(), "reset_progress should clear unlocked_guests")
|
||||||
|
_check(int(save.data["last_room"]) == 0, "reset_progress should clear last_room")
|
||||||
|
_check(save.best_streak() == 5, "reset_progress should leave best_streak alone")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 2, "reset_progress should leave the daily streak alone")
|
||||||
|
_check(
|
||||||
|
str(save.daily_data().get("last_completed", "")) == Daily.today_key(),
|
||||||
|
"reset_progress should leave last_completed alone"
|
||||||
|
)
|
||||||
|
_check(save.selected_frame() == "regular", "reset_progress should leave the selected frame alone")
|
||||||
|
|
||||||
|
_reset_to_clean(save)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 4. Level and guest data
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_game_data(save) -> void:
|
||||||
|
_note("4. level/guest data")
|
||||||
|
|
||||||
|
var levels: Array = Levels.load_all()
|
||||||
|
_check(levels.size() == 30, "there should be 30 levels")
|
||||||
|
if levels.is_empty():
|
||||||
|
return
|
||||||
|
|
||||||
|
var board := Board.new()
|
||||||
|
root.add_child(board)
|
||||||
|
|
||||||
|
var bad_shape := 0
|
||||||
|
var bad_solution := 0
|
||||||
|
var bad_clues := 0
|
||||||
|
var bad_regions := 0
|
||||||
|
var bad_rats := 0
|
||||||
|
var bad_region_rats := 0
|
||||||
|
var valid_guests: Dictionary = {}
|
||||||
|
for guest in Guests.all():
|
||||||
|
valid_guests[str(guest.get("id", ""))] = true
|
||||||
|
|
||||||
|
for level_variant in levels:
|
||||||
|
if typeof(level_variant) != TYPE_DICTIONARY:
|
||||||
|
bad_shape += 1
|
||||||
|
continue
|
||||||
|
var level: Dictionary = level_variant
|
||||||
|
var n: int = int(level.get("n", 0))
|
||||||
|
var regions: Array = level.get("regions", [])
|
||||||
|
var solution: Array = level.get("solution", [])
|
||||||
|
var clues: Array = level.get("clues", [])
|
||||||
|
var label: String = str(level.get("id", "?"))
|
||||||
|
|
||||||
|
if n != 8:
|
||||||
|
bad_shape += 1
|
||||||
|
if regions.size() != n:
|
||||||
|
bad_regions += 1
|
||||||
|
else:
|
||||||
|
for row in regions:
|
||||||
|
if (row as Array).size() != n:
|
||||||
|
bad_regions += 1
|
||||||
|
var region_ids := {}
|
||||||
|
for row in regions:
|
||||||
|
for value in row:
|
||||||
|
region_ids[int(value)] = true
|
||||||
|
if region_ids.size() != n:
|
||||||
|
bad_regions += 1
|
||||||
|
|
||||||
|
if solution.size() != n:
|
||||||
|
bad_solution += 1
|
||||||
|
else:
|
||||||
|
var cells := []
|
||||||
|
for r in n:
|
||||||
|
var row := []
|
||||||
|
for c in n:
|
||||||
|
row.append(Rules.EMPTY)
|
||||||
|
cells.append(row)
|
||||||
|
for r in n:
|
||||||
|
var c: int = int(solution[r])
|
||||||
|
if c >= 0 and c < n:
|
||||||
|
cells[r][c] = Rules.RAT
|
||||||
|
if not Rules.is_valid(cells, regions):
|
||||||
|
bad_solution += 1
|
||||||
|
if Rules.count_rats(cells) != n:
|
||||||
|
bad_solution += 1
|
||||||
|
|
||||||
|
if clues.size() != 3:
|
||||||
|
bad_clues += 1
|
||||||
|
else:
|
||||||
|
for clue in clues:
|
||||||
|
var cr: int = int(clue[0])
|
||||||
|
var cc: int = int(clue[1])
|
||||||
|
if cr < 0 or cr >= n or cc < 0 or cc >= n or int(solution[cr]) != cc:
|
||||||
|
bad_clues += 1
|
||||||
|
|
||||||
|
board.set_level(level)
|
||||||
|
if board.region_rats.size() != 8:
|
||||||
|
bad_region_rats += 1
|
||||||
|
var seen := {}
|
||||||
|
for id_variant in board.region_rats:
|
||||||
|
var id: String = str(id_variant)
|
||||||
|
if seen.has(id) or not valid_guests.has(id):
|
||||||
|
bad_region_rats += 1
|
||||||
|
seen[id] = true
|
||||||
|
if seen.size() != 8:
|
||||||
|
bad_region_rats += 1
|
||||||
|
if board.fixed.size() != 3:
|
||||||
|
bad_rats += 1
|
||||||
|
|
||||||
|
_check(bad_shape == 0, "every level should have n=8 (%d bad)" % bad_shape)
|
||||||
|
_check(bad_regions == 0, "every level should have an 8x8 region grid with 8 regions (%d bad)" % bad_regions)
|
||||||
|
_check(bad_solution == 0, "every solution should be a legal board under Rules (%d bad)" % bad_solution)
|
||||||
|
_check(bad_clues == 0, "every level should have 3 clues matching its solution (%d bad)" % bad_clues)
|
||||||
|
_check(bad_region_rats == 0, "every level should carry 8 unique guest ids in Board.region_rats (%d bad)" % bad_region_rats)
|
||||||
|
_check(bad_rats == 0, "every level should fix 3 clue rats on its board (%d bad)" % bad_rats)
|
||||||
|
|
||||||
|
board.free()
|
||||||
|
|
||||||
|
var guests: Array = Guests.all()
|
||||||
|
_check(guests.size() == 25, "guest manifest should contain 25 guests")
|
||||||
|
var guest_ids := {}
|
||||||
|
var duplicate_guests := 0
|
||||||
|
for guest in guests:
|
||||||
|
var id: String = str(guest.get("id", ""))
|
||||||
|
if guest_ids.has(id) or id.is_empty():
|
||||||
|
duplicate_guests += 1
|
||||||
|
guest_ids[id] = true
|
||||||
|
_check(FileAccess.file_exists(Guests.portrait(id, "thumbs")), "missing thumb portrait for '%s'" % id)
|
||||||
|
_check(FileAccess.file_exists(Guests.portrait(id, "full")), "missing card portrait for '%s'" % id)
|
||||||
|
_check(duplicate_guests == 0, "guest ids should be non-empty and unique (%d bad)" % duplicate_guests)
|
||||||
|
|
||||||
|
_check(FileAccess.file_exists("res://art/crumb_head.png"), "Crumb head art should exist")
|
||||||
|
_check(FileAccess.file_exists("res://art/crumb.png"), "Crumb art should exist")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dsjew0n3nwi1
|
||||||
@@ -0,0 +1,428 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
## Headless input QA: board placement modes, Guest Book tap/scroll gestures,
|
||||||
|
## and scroll pass-through on the scrolling screens.
|
||||||
|
## <godot> --headless --path <project> --script res://tools/qa_input.gd --quit-after 1800
|
||||||
|
|
||||||
|
var failures := 0
|
||||||
|
var finished := false
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if not condition:
|
||||||
|
failures += 1
|
||||||
|
print("FAIL: ", message)
|
||||||
|
|
||||||
|
|
||||||
|
func _finish() -> void:
|
||||||
|
if finished:
|
||||||
|
return
|
||||||
|
finished = true
|
||||||
|
print("QA INPUT: ", "PASS" if failures == 0 else "FAIL (%d)" % failures)
|
||||||
|
quit(0 if failures == 0 else 1)
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
# Failsafe: never leave the command line hanging.
|
||||||
|
var watchdog := Timer.new()
|
||||||
|
watchdog.wait_time = 20.0
|
||||||
|
watchdog.one_shot = true
|
||||||
|
watchdog.timeout.connect(func() -> void:
|
||||||
|
if not finished:
|
||||||
|
_check(false, "QA timed out")
|
||||||
|
_finish()
|
||||||
|
)
|
||||||
|
root.add_child(watchdog)
|
||||||
|
watchdog.start()
|
||||||
|
|
||||||
|
var save = root.get_node_or_null("SaveGame")
|
||||||
|
_check(save != null, "SaveGame autoload missing")
|
||||||
|
if save == null:
|
||||||
|
_finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Snapshot so the user's settings are exactly as we found them.
|
||||||
|
var original_settings: Dictionary = save.data["settings"].duplicate(true)
|
||||||
|
|
||||||
|
_test_board_modes(save)
|
||||||
|
|
||||||
|
var err := change_scene_to_file("res://scenes/Main.tscn")
|
||||||
|
if err != OK:
|
||||||
|
_check(false, "could not load Main (%d)" % err)
|
||||||
|
_restore_settings(save, original_settings)
|
||||||
|
_finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
var main = current_scene
|
||||||
|
_check(main != null, "Main scene missing")
|
||||||
|
if main == null:
|
||||||
|
_restore_settings(save, original_settings)
|
||||||
|
_finish()
|
||||||
|
return
|
||||||
|
|
||||||
|
await _test_scroll_pass_through(main)
|
||||||
|
await _test_guest_book_input(main)
|
||||||
|
|
||||||
|
_restore_settings(save, original_settings)
|
||||||
|
_finish()
|
||||||
|
|
||||||
|
|
||||||
|
func _restore_settings(save, original: Dictionary) -> void:
|
||||||
|
for key in original:
|
||||||
|
save.set_setting(key, original[key])
|
||||||
|
save.save_game()
|
||||||
|
|
||||||
|
|
||||||
|
# --- Board -------------------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_board_modes(save) -> void:
|
||||||
|
var levels: Array = Levels.load_all()
|
||||||
|
_check(levels.size() > 0, "no levels available")
|
||||||
|
if levels.is_empty():
|
||||||
|
return
|
||||||
|
var level: Dictionary = levels[0]
|
||||||
|
|
||||||
|
var board := Board.new()
|
||||||
|
root.add_child(board)
|
||||||
|
board.size = Vector2(640, 640)
|
||||||
|
board.set_level(level)
|
||||||
|
board._update_layout()
|
||||||
|
_reset_press(board)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- hold mode
|
||||||
|
save.set_setting("hold_seconds", 0.35)
|
||||||
|
save.set_setting("double_tap_place", false)
|
||||||
|
_check(not board.double_tap_place, "hold mode setting did not reach Board")
|
||||||
|
|
||||||
|
# Quick press + release marks an X.
|
||||||
|
var tap_cell := _find_empty(board)
|
||||||
|
_check(tap_cell.x >= 0, "no empty cell for hold-mode tap")
|
||||||
|
if tap_cell.x >= 0:
|
||||||
|
_mouse_button(board, tap_cell, true)
|
||||||
|
_mouse_button(board, tap_cell, false)
|
||||||
|
_check(int(board.cells[tap_cell.x][tap_cell.y]) == Board.X,
|
||||||
|
"hold mode: press + release should mark X")
|
||||||
|
|
||||||
|
# A press held past the threshold checks a guest in, and releasing keeps it.
|
||||||
|
var hold_cell := _find_empty(board)
|
||||||
|
_check(hold_cell.x >= 0, "no empty cell for hold")
|
||||||
|
if hold_cell.x >= 0:
|
||||||
|
_mouse_button(board, hold_cell, true)
|
||||||
|
board._process(board.hold_seconds + 0.05)
|
||||||
|
_check(int(board.cells[hold_cell.x][hold_cell.y]) == Board.RAT,
|
||||||
|
"hold past the threshold should place a rat")
|
||||||
|
_check(board.hold_fired, "hold_fired should be set after the threshold")
|
||||||
|
_mouse_button(board, hold_cell, false)
|
||||||
|
_check(int(board.cells[hold_cell.x][hold_cell.y]) == Board.RAT,
|
||||||
|
"releasing after a hold should keep the rat")
|
||||||
|
_check(board.press_cell == Vector2i(-1, -1), "release should clear press_cell")
|
||||||
|
_check(not board.hold_fired, "release should clear hold_fired")
|
||||||
|
|
||||||
|
# Right-click checks a guest in, then out.
|
||||||
|
var right_cell := _find_empty(board)
|
||||||
|
_check(right_cell.x >= 0, "no empty cell for right-click")
|
||||||
|
if right_cell.x >= 0:
|
||||||
|
_right_click(board, right_cell)
|
||||||
|
_check(int(board.cells[right_cell.x][right_cell.y]) == Board.RAT,
|
||||||
|
"right-click should check a guest in")
|
||||||
|
_right_click(board, right_cell)
|
||||||
|
_check(int(board.cells[right_cell.x][right_cell.y]) == Board.EMPTY,
|
||||||
|
"right-click should check a guest out")
|
||||||
|
|
||||||
|
# Fixed clues cannot be changed by any input path.
|
||||||
|
if board.fixed.is_empty():
|
||||||
|
_check(false, "test level has no fixed clues")
|
||||||
|
else:
|
||||||
|
var fixed_cell: Vector2i = board.fixed.keys()[0]
|
||||||
|
_check(int(board.cells[fixed_cell.x][fixed_cell.y]) == Board.RAT,
|
||||||
|
"fixed clue should start as a rat")
|
||||||
|
board._toggle_rat(fixed_cell)
|
||||||
|
_check(int(board.cells[fixed_cell.x][fixed_cell.y]) == Board.RAT,
|
||||||
|
"right-click must not remove a fixed clue")
|
||||||
|
board._tap(fixed_cell)
|
||||||
|
_check(int(board.cells[fixed_cell.x][fixed_cell.y]) == Board.RAT,
|
||||||
|
"tap must not clear a fixed clue")
|
||||||
|
_reset_press(board)
|
||||||
|
_mouse_button(board, fixed_cell, true)
|
||||||
|
_mouse_button(board, fixed_cell, false)
|
||||||
|
_check(int(board.cells[fixed_cell.x][fixed_cell.y]) == Board.RAT,
|
||||||
|
"press + release must not change a fixed clue")
|
||||||
|
|
||||||
|
# Undo and restart discard a tap waiting for its partner.
|
||||||
|
var undo_cell := _find_empty(board)
|
||||||
|
_check(undo_cell.x >= 0, "no empty cell for pending-undo test")
|
||||||
|
_check(not board.history.is_empty(), "board history should be non-empty before undo")
|
||||||
|
board.pending_tap_cell = undo_cell
|
||||||
|
board.pending_tap_at = Time.get_ticks_msec()
|
||||||
|
board.undo()
|
||||||
|
_check(board.pending_tap_cell == Vector2i(-1, -1), "undo should clear a pending tap")
|
||||||
|
|
||||||
|
var restart_cell := _find_empty(board)
|
||||||
|
_check(restart_cell.x >= 0, "no empty cell for pending-restart test")
|
||||||
|
board.pending_tap_cell = restart_cell
|
||||||
|
board.pending_tap_at = Time.get_ticks_msec()
|
||||||
|
board.restart()
|
||||||
|
_check(board.pending_tap_cell == Vector2i(-1, -1), "restart should clear a pending tap")
|
||||||
|
|
||||||
|
# --------------------------------------------------------- double-tap mode
|
||||||
|
save.set_setting("double_tap_place", true)
|
||||||
|
_check(board.double_tap_place, "double-tap setting did not reach Board")
|
||||||
|
board.set_level(level)
|
||||||
|
board._update_layout()
|
||||||
|
_reset_press(board)
|
||||||
|
|
||||||
|
# One tap leaves the cell untouched until the window expires.
|
||||||
|
var first := _find_empty(board)
|
||||||
|
_check(first.x >= 0, "no empty cell for first tap")
|
||||||
|
if first.x >= 0:
|
||||||
|
board._handle_tap(first)
|
||||||
|
_check(int(board.cells[first.x][first.y]) == Board.EMPTY,
|
||||||
|
"first tap should leave the cell empty")
|
||||||
|
_check(board.pending_tap_cell == first, "first tap should be pending")
|
||||||
|
board.pending_tap_at -= Board.DOUBLE_TAP_MS + 1
|
||||||
|
board._process(0.0)
|
||||||
|
_check(int(board.cells[first.x][first.y]) == Board.X,
|
||||||
|
"a lone tap should mark X after the double-tap window")
|
||||||
|
|
||||||
|
# Two quick taps check a guest in, then out again.
|
||||||
|
var pair := _find_empty(board)
|
||||||
|
_check(pair.x >= 0, "no empty cell for double tap")
|
||||||
|
if pair.x >= 0:
|
||||||
|
board._handle_tap(pair)
|
||||||
|
board._handle_tap(pair)
|
||||||
|
_check(int(board.cells[pair.x][pair.y]) == Board.RAT,
|
||||||
|
"two quick taps should check a guest in")
|
||||||
|
board._handle_tap(pair)
|
||||||
|
board._handle_tap(pair)
|
||||||
|
_check(int(board.cells[pair.x][pair.y]) == Board.EMPTY,
|
||||||
|
"two quick taps on a rat should check them out")
|
||||||
|
|
||||||
|
# Holding does nothing while double-tap mode is on.
|
||||||
|
var held := _find_empty(board)
|
||||||
|
_check(held.x >= 0, "no empty cell for hold-in-double-tap test")
|
||||||
|
if held.x >= 0:
|
||||||
|
_reset_press(board)
|
||||||
|
_mouse_button(board, held, true)
|
||||||
|
board._process(board.hold_seconds + 1.0)
|
||||||
|
_check(int(board.cells[held.x][held.y]) == Board.EMPTY,
|
||||||
|
"hold should not place a rat in double-tap mode")
|
||||||
|
_check(not board.hold_fired, "hold_fired must stay clear in double-tap mode")
|
||||||
|
_mouse_button(board, held, false)
|
||||||
|
board.pending_tap_cell = Vector2i(-1, -1)
|
||||||
|
|
||||||
|
# Right-click still works in double-tap mode.
|
||||||
|
var right2 := _find_empty(board)
|
||||||
|
_check(right2.x >= 0, "no empty cell for double-tap right-click")
|
||||||
|
if right2.x >= 0:
|
||||||
|
_right_click(board, right2)
|
||||||
|
_check(int(board.cells[right2.x][right2.y]) == Board.RAT,
|
||||||
|
"right-click should check in during double-tap mode")
|
||||||
|
_right_click(board, right2)
|
||||||
|
_check(int(board.cells[right2.x][right2.y]) == Board.EMPTY,
|
||||||
|
"right-click should check out during double-tap mode")
|
||||||
|
|
||||||
|
# Switching modes flushes a pending tap (and a half-finished hold).
|
||||||
|
var flush := _find_empty(board)
|
||||||
|
_check(flush.x >= 0, "no empty cell for mode-switch test")
|
||||||
|
if flush.x >= 0:
|
||||||
|
board._handle_tap(flush)
|
||||||
|
_check(board.pending_tap_cell == flush, "pending tap should be set up")
|
||||||
|
save.set_setting("double_tap_place", false)
|
||||||
|
_check(not board.double_tap_place, "switch to hold mode did not reach Board")
|
||||||
|
_check(board.pending_tap_cell == Vector2i(-1, -1),
|
||||||
|
"switching out of double-tap should flush the pending tap")
|
||||||
|
_check(int(board.cells[flush.x][flush.y]) == Board.X,
|
||||||
|
"flushed pending tap should mark X")
|
||||||
|
|
||||||
|
board.press_cell = flush
|
||||||
|
board.hold_fired = true
|
||||||
|
save.set_setting("double_tap_place", true)
|
||||||
|
_check(board.double_tap_place, "switch back to double-tap did not reach Board")
|
||||||
|
_check(board.press_cell == Vector2i(-1, -1),
|
||||||
|
"switching to double-tap should clear a held press")
|
||||||
|
_check(not board.hold_fired, "switching to double-tap should clear hold_fired")
|
||||||
|
|
||||||
|
board.free()
|
||||||
|
|
||||||
|
|
||||||
|
func _find_empty(board: Board) -> Vector2i:
|
||||||
|
for r in board.n:
|
||||||
|
for c in board.n:
|
||||||
|
if (
|
||||||
|
int(board.cells[r][c]) == Board.EMPTY
|
||||||
|
and not board.fixed.has(Vector2i(r, c))
|
||||||
|
and not board.auto_x[r][c]
|
||||||
|
):
|
||||||
|
return Vector2i(r, c)
|
||||||
|
return Vector2i(-1, -1)
|
||||||
|
|
||||||
|
|
||||||
|
func _reset_press(board: Board) -> void:
|
||||||
|
board.press_cell = Vector2i(-1, -1)
|
||||||
|
board.press_elapsed = 0.0
|
||||||
|
board.hold_fired = false
|
||||||
|
board.pending_tap_cell = Vector2i(-1, -1)
|
||||||
|
|
||||||
|
|
||||||
|
func _mouse_button(board: Board, cell: Vector2i, pressed: bool) -> void:
|
||||||
|
var event := InputEventMouseButton.new()
|
||||||
|
event.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
event.pressed = pressed
|
||||||
|
event.position = board._cell_rect(cell.x, cell.y).get_center()
|
||||||
|
board._gui_input(event)
|
||||||
|
|
||||||
|
|
||||||
|
func _right_click(board: Board, cell: Vector2i) -> void:
|
||||||
|
var event := InputEventMouseButton.new()
|
||||||
|
event.button_index = MOUSE_BUTTON_RIGHT
|
||||||
|
event.pressed = true
|
||||||
|
event.position = board._cell_rect(cell.x, cell.y).get_center()
|
||||||
|
board._gui_input(event)
|
||||||
|
|
||||||
|
|
||||||
|
# --- Scroll pass-through ------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_scroll_pass_through(main) -> void:
|
||||||
|
main.open_settings("home")
|
||||||
|
await process_frame
|
||||||
|
var sheet = main.settings_sheet
|
||||||
|
_check(sheet != null, "settings sheet missing")
|
||||||
|
if sheet != null:
|
||||||
|
for key in ["patterns", "show_timer", "reduce_motion", "double_tap_place"]:
|
||||||
|
if sheet.toggles.has(key):
|
||||||
|
_check(sheet.toggles[key].mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"settings row '%s' should pass swipes" % key)
|
||||||
|
main.close_settings()
|
||||||
|
|
||||||
|
main.show_screen("guest_book")
|
||||||
|
await process_frame
|
||||||
|
var book = main.guest_book
|
||||||
|
_check(book != null, "Guest Book missing")
|
||||||
|
if book != null:
|
||||||
|
_check(book.grid.mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"guest grid should pass swipes")
|
||||||
|
for card in book.grid.get_children():
|
||||||
|
_check(card.mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"guest cards should pass swipes")
|
||||||
|
|
||||||
|
main.show_screen("rules")
|
||||||
|
await process_frame
|
||||||
|
var rulebook = main.rulebook
|
||||||
|
_check(rulebook != null, "Rulebook missing")
|
||||||
|
if rulebook != null:
|
||||||
|
var scrolls = rulebook.find_children("*", "ScrollContainer", true, false)
|
||||||
|
_check(scrolls.size() > 0, "rules ScrollContainer missing")
|
||||||
|
if scrolls.size() > 0:
|
||||||
|
var content = scrolls[0].get_child(0)
|
||||||
|
_check(content.mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"rules content should pass swipes")
|
||||||
|
var tutorial = rulebook.tutorial_board
|
||||||
|
_check(tutorial != null, "tutorial board missing")
|
||||||
|
if tutorial != null:
|
||||||
|
_check(tutorial.mouse_filter == Control.MOUSE_FILTER_STOP,
|
||||||
|
"tutorial board should keep its own input")
|
||||||
|
|
||||||
|
|
||||||
|
# --- Guest Book input ---------------------------------------------------------
|
||||||
|
|
||||||
|
func _test_guest_book_input(main) -> void:
|
||||||
|
main.show_screen("guest_book")
|
||||||
|
await process_frame
|
||||||
|
var book = main.guest_book
|
||||||
|
_check(book != null, "Guest Book missing")
|
||||||
|
if book == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
var guests: Array = Guests.all()
|
||||||
|
_check(guests.size() > 0, "no guests to test")
|
||||||
|
if guests.is_empty():
|
||||||
|
return
|
||||||
|
var guest: Dictionary = guests[0]
|
||||||
|
|
||||||
|
book.scroll.scroll_vertical = 0
|
||||||
|
book._press_scroll = 0
|
||||||
|
book._suppress_until = 0
|
||||||
|
book._dragged = false
|
||||||
|
book.detail_layer.visible = false
|
||||||
|
|
||||||
|
# A short, stationary press + release opens the card.
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), false)
|
||||||
|
_check(book.detail_layer.visible, "stationary press/release should open detail")
|
||||||
|
|
||||||
|
book.detail_layer.visible = false
|
||||||
|
book._suppress_until = 0
|
||||||
|
book._dragged = false
|
||||||
|
book.scroll.scroll_vertical = 0
|
||||||
|
|
||||||
|
# Movement beyond 12dp makes it a scroll, not a tap.
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
var motion := InputEventMouseMotion.new()
|
||||||
|
motion.global_position = Vector2(170, 300)
|
||||||
|
book._on_card_input(motion, guest, false)
|
||||||
|
_card_mouse(book, guest, Vector2(170, 300), false)
|
||||||
|
_check(not book.detail_layer.visible, "a >12dp drag should not open detail")
|
||||||
|
|
||||||
|
book._suppress_until = 0
|
||||||
|
book._dragged = false
|
||||||
|
book.scroll.scroll_vertical = 0
|
||||||
|
|
||||||
|
# A press whose scroll offset changes is a scroll, not a tap.
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
book.scroll.scroll_vertical = 60
|
||||||
|
if absi(book.scroll.scroll_vertical - book._press_scroll) <= 1:
|
||||||
|
# The headless layout may clamp scrolling; emulate the changed offset.
|
||||||
|
book._press_scroll = book.scroll.scroll_vertical - 60
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), false)
|
||||||
|
_check(not book.detail_layer.visible, "a scrolled press should not open detail")
|
||||||
|
|
||||||
|
book.scroll.scroll_vertical = 0
|
||||||
|
book._press_scroll = 0
|
||||||
|
book._suppress_until = 0
|
||||||
|
book._dragged = false
|
||||||
|
|
||||||
|
# A tap right after a fling is suppressed.
|
||||||
|
book._suppress_until = Time.get_ticks_msec() + 1000
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), false)
|
||||||
|
_check(not book.detail_layer.visible, "post-drag suppression should block a tap")
|
||||||
|
|
||||||
|
book._suppress_until = 0
|
||||||
|
book._dragged = false
|
||||||
|
|
||||||
|
# The opening tap must not immediately close the sheet.
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), false)
|
||||||
|
_check(book.detail_layer.visible, "a clean tap should open detail")
|
||||||
|
book._try_close_detail()
|
||||||
|
_check(book.detail_layer.visible, "close should be guarded right after opening")
|
||||||
|
book._detail_opened_at -= 300
|
||||||
|
book._try_close_detail()
|
||||||
|
_check(not book.detail_layer.visible, "close should work after the guard")
|
||||||
|
|
||||||
|
# A later release on the scrim closes the sheet.
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), true)
|
||||||
|
_card_mouse(book, guest, Vector2(100, 300), false)
|
||||||
|
_check(book.detail_layer.visible, "a clean tap should reopen detail")
|
||||||
|
book._detail_opened_at -= 300
|
||||||
|
var up := InputEventMouseButton.new()
|
||||||
|
up.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
up.pressed = false
|
||||||
|
up.global_position = Vector2(20, 20)
|
||||||
|
book.detail_layer.emit_signal("gui_input", up)
|
||||||
|
_check(not book.detail_layer.visible, "a later scrim release should close detail")
|
||||||
|
|
||||||
|
|
||||||
|
func _card_mouse(book, guest: Dictionary, pos: Vector2, pressed: bool) -> void:
|
||||||
|
var event := InputEventMouseButton.new()
|
||||||
|
event.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
event.pressed = pressed
|
||||||
|
event.global_position = pos
|
||||||
|
book._on_card_input(event, guest, false)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://b017p64qwfkhk
|
||||||
@@ -0,0 +1,415 @@
|
|||||||
|
extends SceneTree
|
||||||
|
|
||||||
|
## Headless UI QA sweep: screens, settings, profile frames, daily/campaign
|
||||||
|
## win flows and the Guest Book detail guard.
|
||||||
|
## <godot> --headless --path . --script res://tools/qa_ui.gd --quit-after 1800
|
||||||
|
|
||||||
|
var failures := 0
|
||||||
|
var frames
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
call_deferred("_run")
|
||||||
|
|
||||||
|
|
||||||
|
func _check(condition: bool, message: String) -> void:
|
||||||
|
if not condition:
|
||||||
|
failures += 1
|
||||||
|
print("FAIL: ", message)
|
||||||
|
|
||||||
|
|
||||||
|
func _run() -> void:
|
||||||
|
var err := change_scene_to_file("res://scenes/Main.tscn")
|
||||||
|
if err != OK:
|
||||||
|
print("FAIL: could not load Main")
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
var main = current_scene
|
||||||
|
var save = root.get_node_or_null("SaveGame")
|
||||||
|
_check(save != null, "SaveGame autoload missing")
|
||||||
|
if save == null:
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Resolve Frames at runtime: a static reference would compile it before
|
||||||
|
# autoloads are registered when this script is launched with --script.
|
||||||
|
frames = load("res://scripts/Frames.gd")
|
||||||
|
_check(frames != null, "Frames script missing")
|
||||||
|
|
||||||
|
_test_screen_cycle(main)
|
||||||
|
await _test_settings(main, save)
|
||||||
|
await _test_profile(main, save)
|
||||||
|
await _test_daily(main, save)
|
||||||
|
await _test_campaign(main, save)
|
||||||
|
await _test_guest_book(main)
|
||||||
|
await _test_back(main)
|
||||||
|
_restore_defaults(save)
|
||||||
|
|
||||||
|
print("QA UI: ", "PASS" if failures == 0 else "FAIL (%d)" % failures)
|
||||||
|
quit(0 if failures == 0 else 1)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_screen_cycle(main) -> void:
|
||||||
|
var expected: Array[String] = ["home", "game", "guest_book", "rules", "profile", "streak"]
|
||||||
|
_check(main.screens.size() == expected.size(), "Main should expose all six screens")
|
||||||
|
for name in expected:
|
||||||
|
_check(main.screens.has(name) and main.screens[name] != null, "screen missing: %s" % name)
|
||||||
|
_check(
|
||||||
|
main.home != null and main.game != null and main.guest_book != null
|
||||||
|
and main.rulebook != null and main.profile != null and main.streak != null,
|
||||||
|
"named screen references should all exist"
|
||||||
|
)
|
||||||
|
_check(main.settings_sheet != null, "settings sheet missing")
|
||||||
|
|
||||||
|
var keys: Array = main.screens.keys()
|
||||||
|
for name in expected:
|
||||||
|
main.show_screen(name, false)
|
||||||
|
for key in keys:
|
||||||
|
_check(
|
||||||
|
bool(main.screens[key].visible) == (key == name),
|
||||||
|
"only %s should be visible after show_screen(%s)" % [key, name]
|
||||||
|
)
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_settings(main, save) -> void:
|
||||||
|
main.show_screen("home", false)
|
||||||
|
main.open_settings("home")
|
||||||
|
await process_frame
|
||||||
|
_check(main.settings_sheet.visible, "settings sheet should open from home")
|
||||||
|
_check(main.settings_sheet.resume_button.text == "Close", "home settings should use Close")
|
||||||
|
_check(not main.settings_sheet.game_actions.visible, "home settings should hide game actions")
|
||||||
|
|
||||||
|
var toggles: Dictionary = main.settings_sheet.toggles
|
||||||
|
_check(toggles.has("patterns") and toggles.has("double_tap_place"), "settings toggles missing")
|
||||||
|
_check(toggles["patterns"].mouse_filter == Control.MOUSE_FILTER_PASS, "settings rows should pass swipes")
|
||||||
|
|
||||||
|
# Changes made through SaveGame must be reflected after an explicit refresh.
|
||||||
|
save.set_setting("patterns", false)
|
||||||
|
save.set_setting("double_tap_place", false)
|
||||||
|
main.settings_sheet.refresh()
|
||||||
|
_check(not toggles["patterns"].button_pressed, "sheet should refresh patterns from SaveGame")
|
||||||
|
_check(not toggles["double_tap_place"].button_pressed, "sheet should refresh double-tap from SaveGame")
|
||||||
|
_check(main.settings_sheet.hold_slider.editable, "hold slider should be editable with double-tap off")
|
||||||
|
|
||||||
|
# The sheet's own toggles must write back to SaveGame.
|
||||||
|
toggles["patterns"].button_pressed = true
|
||||||
|
_check(bool(save.get_setting("patterns")), "patterns toggle should update SaveGame")
|
||||||
|
toggles["double_tap_place"].button_pressed = true
|
||||||
|
_check(bool(save.get_setting("double_tap_place")), "double-tap toggle should update SaveGame")
|
||||||
|
_check(not main.settings_sheet.hold_slider.editable, "hold slider should be disabled with double-tap on")
|
||||||
|
|
||||||
|
# Themed confirmation replaces the native popup on reset.
|
||||||
|
var sheet = main.settings_sheet
|
||||||
|
sheet._on_reset()
|
||||||
|
await process_frame
|
||||||
|
_check(sheet.confirm_layer.visible, "reset confirmation should be visible")
|
||||||
|
_check(sheet.confirm_title.text == "Reset progress?", "reset confirmation title")
|
||||||
|
_check(sheet.confirm_button.text == "Reset", "reset confirmation action text")
|
||||||
|
var panel: Control = sheet.confirm_layer.get_child(0).get_child(0)
|
||||||
|
var viewport_width: int = int(ProjectSettings.get_setting("display/window/size/viewport_width"))
|
||||||
|
_check(panel.custom_minimum_size.x <= viewport_width - 16, "confirmation panel should fit the screen")
|
||||||
|
var outside := InputEventMouseButton.new()
|
||||||
|
outside.button_index = MOUSE_BUTTON_LEFT
|
||||||
|
outside.pressed = true
|
||||||
|
sheet._on_confirm_scrim_input(outside)
|
||||||
|
_check(not sheet.confirm_layer.visible, "tapping outside should dismiss confirmation")
|
||||||
|
|
||||||
|
save.data["completed_rooms"].append("room-confirm")
|
||||||
|
sheet._on_reset()
|
||||||
|
await process_frame
|
||||||
|
sheet.confirm_button.pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check((save.data.get("completed_rooms") as Array).is_empty(), "confirming reset should clear progress")
|
||||||
|
main.close_settings()
|
||||||
|
await process_frame
|
||||||
|
_check(not main.settings_sheet.visible, "settings sheet should close from home")
|
||||||
|
|
||||||
|
main.show_screen("game", false)
|
||||||
|
main.open_settings("game")
|
||||||
|
await process_frame
|
||||||
|
_check(main.settings_sheet.visible, "settings sheet should open from game")
|
||||||
|
_check(main.settings_sheet.resume_button.text == "Resume", "game settings should use Resume")
|
||||||
|
_check(main.settings_sheet.game_actions.visible, "game settings should show Restart/Lobby")
|
||||||
|
_check(main.game.ui_paused, "game should pause while settings are open")
|
||||||
|
main.settings_sheet._on_restart()
|
||||||
|
await process_frame
|
||||||
|
_check(main.settings_sheet.confirm_layer.visible, "restart confirmation should be visible")
|
||||||
|
_check(main.settings_sheet.confirm_title.text == "Restart room?", "restart confirmation title")
|
||||||
|
_check(main.settings_sheet.confirm_button.text == "Restart", "restart confirmation action text")
|
||||||
|
main.settings_sheet._hide_confirm()
|
||||||
|
main.close_settings()
|
||||||
|
await process_frame
|
||||||
|
_check(not main.settings_sheet.visible, "settings sheet should close from game")
|
||||||
|
_check(not main.game.ui_paused, "game should resume after closing settings")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_back(main) -> void:
|
||||||
|
var back_event := InputEventAction.new()
|
||||||
|
back_event.action = "ui_cancel"
|
||||||
|
back_event.pressed = true
|
||||||
|
|
||||||
|
main.show_screen("home", false)
|
||||||
|
await process_frame
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(main.quit_layer.visible, "Android back on Home should open quit confirmation")
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(not main.quit_layer.visible, "second back should dismiss quit confirmation")
|
||||||
|
|
||||||
|
main.open_settings("home")
|
||||||
|
await process_frame
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(not main.settings_sheet.visible, "back should close the settings sheet")
|
||||||
|
|
||||||
|
main.open_settings("home")
|
||||||
|
await process_frame
|
||||||
|
main.settings_sheet._on_reset()
|
||||||
|
await process_frame
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(
|
||||||
|
not main.settings_sheet.confirm_layer.visible and main.settings_sheet.visible,
|
||||||
|
"back should dismiss a confirmation before closing settings"
|
||||||
|
)
|
||||||
|
main.close_settings()
|
||||||
|
|
||||||
|
main.show_screen("guest_book", false)
|
||||||
|
await process_frame
|
||||||
|
main.guest_book._show_detail(Guests.by_id("miso"))
|
||||||
|
await process_frame
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(not main.guest_book.detail_layer.visible, "back should close the guest detail")
|
||||||
|
|
||||||
|
main.show_screen("game", false)
|
||||||
|
main.game.start_level(0)
|
||||||
|
await process_frame
|
||||||
|
main.game.overlay.visible = true
|
||||||
|
main.game.win_shown = true
|
||||||
|
main._input(back_event)
|
||||||
|
await process_frame
|
||||||
|
_check(not main.game.overlay.visible, "back should close the win overlay first")
|
||||||
|
_check(not main.game.win_shown, "win state should clear when the overlay closes")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_profile(main, save) -> void:
|
||||||
|
# Five campaign rooms and a three-day streak unlock Paper and Regular.
|
||||||
|
save.reset_progress()
|
||||||
|
var stats: Dictionary = save.daily_data().duplicate(true)
|
||||||
|
stats["best_streak"] = 3
|
||||||
|
save.data["daily"] = stats
|
||||||
|
save.select_frame("plain")
|
||||||
|
for i in range(5):
|
||||||
|
save.data["completed_rooms"].append("qa-frame-%02d" % i)
|
||||||
|
save.save_game()
|
||||||
|
save.progress_changed.emit()
|
||||||
|
|
||||||
|
main.show_screen("profile", false)
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
var profile = main.profile
|
||||||
|
_check(profile != null, "Profile screen missing")
|
||||||
|
if profile == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
profile._set_tab("frame")
|
||||||
|
await process_frame
|
||||||
|
var expected: int = frames.all().size()
|
||||||
|
_check(profile.frame_grid.get_child_count() == expected, "Profile should show every frame")
|
||||||
|
for i in range(profile.frame_grid.get_child_count()):
|
||||||
|
_check(
|
||||||
|
profile.frame_grid.get_child(i).mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"frame card %d should pass swipes" % i
|
||||||
|
)
|
||||||
|
_check(profile.rooms_label.text == "5 / 30", "profile room count should reflect save data")
|
||||||
|
_check(profile.best_label.text == "3", "profile best streak should reflect save data")
|
||||||
|
|
||||||
|
var regular_index := -1
|
||||||
|
var night_index := -1
|
||||||
|
for i in range(frames.all().size()):
|
||||||
|
var id := str(frames.all()[i].get("id", ""))
|
||||||
|
if id == "regular":
|
||||||
|
regular_index = i
|
||||||
|
if id == "night":
|
||||||
|
night_index = i
|
||||||
|
_check(regular_index >= 0 and night_index >= 0, "Regular and Night owl frames should exist")
|
||||||
|
_check(frames.is_unlocked("regular"), "a three-day best streak should unlock Regular")
|
||||||
|
_check(not frames.is_unlocked("night"), "Night owl should still be locked")
|
||||||
|
if regular_index < 0 or night_index < 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Regression: rebuilding the card grid while `pressed` is on the stack
|
||||||
|
# frees the emitting node under Godot. Watch the card from inside the
|
||||||
|
# signal, before the deferred frame change has a chance to run.
|
||||||
|
var card = profile.frame_grid.get_child(regular_index)
|
||||||
|
var probe := {"valid": false, "inside": false, "count": -1}
|
||||||
|
var watcher := func() -> void:
|
||||||
|
var valid := is_instance_valid(card)
|
||||||
|
probe["valid"] = valid
|
||||||
|
probe["inside"] = valid and card.is_inside_tree()
|
||||||
|
probe["count"] = profile.frame_grid.get_child_count()
|
||||||
|
|
||||||
|
card.pressed.connect(watcher)
|
||||||
|
var count_before: int = profile.frame_grid.get_child_count()
|
||||||
|
card.pressed.emit()
|
||||||
|
_check(bool(probe["valid"]) and bool(probe["inside"]), "frame card must stay alive while pressed emits")
|
||||||
|
_check(int(probe["count"]) == count_before, "frame grid must stay stable while pressed emits")
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
_check(profile.pending_frame == "regular", "frame card should update the preview")
|
||||||
|
profile._on_confirm()
|
||||||
|
await process_frame
|
||||||
|
_check(save.selected_frame() == "regular", "Confirm should apply the frame")
|
||||||
|
_check(profile.status_label.text.find("Profile updated") >= 0, "confirmation should be reported")
|
||||||
|
_check(profile.frame_grid.get_child_count() == count_before, "frame grid should stay stable after selection")
|
||||||
|
|
||||||
|
profile.pending_frame = "plain"
|
||||||
|
profile._build_portrait()
|
||||||
|
profile._build_grid()
|
||||||
|
profile._on_cancel()
|
||||||
|
await process_frame
|
||||||
|
_check(save.selected_frame() == "regular", "Cancel should not write to the save")
|
||||||
|
|
||||||
|
var locked_card = profile.frame_grid.get_child(night_index)
|
||||||
|
locked_card.pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check(
|
||||||
|
profile.status_label.text.find(frames.requirement_text("night")) >= 0,
|
||||||
|
"locked frame should show its requirement"
|
||||||
|
)
|
||||||
|
_check(profile.pending_frame == "regular", "locked frame must not change the preview")
|
||||||
|
|
||||||
|
profile._set_tab("avatar")
|
||||||
|
await process_frame
|
||||||
|
_check(profile.frame_grid.get_child_count() > 10, "avatar tab should list portraits")
|
||||||
|
for i in range(profile.frame_grid.get_child_count()):
|
||||||
|
_check(
|
||||||
|
profile.frame_grid.get_child(i).mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"avatar card %d should pass swipes" % i
|
||||||
|
)
|
||||||
|
|
||||||
|
profile.streak_pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check(main.current == "streak", "Profile should open the streak screen")
|
||||||
|
_check(main.streak.week_row.get_child_count() == 7, "streak screen should show a seven-day week")
|
||||||
|
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
|
||||||
|
main.show_screen("profile", false)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_daily(main, save) -> void:
|
||||||
|
main.show_screen("home", false)
|
||||||
|
var today := Daily.today_key()
|
||||||
|
var yesterday := Daily.key_from_day_number(Daily.day_number(today) - 1)
|
||||||
|
var daily: Dictionary = save._default_daily()
|
||||||
|
daily["last_completed"] = yesterday
|
||||||
|
daily["streak"] = 2
|
||||||
|
daily["best_streak"] = 3
|
||||||
|
save.data["daily"] = daily
|
||||||
|
save.save_game()
|
||||||
|
var streak_before: int = save.daily_streak()
|
||||||
|
var rooms_before: Array = (save.data["completed_rooms"] as Array).duplicate()
|
||||||
|
|
||||||
|
main._on_daily()
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
_check(main.game.daily_mode, "daily button should start daily mode")
|
||||||
|
_check(main.game.level_label.text == "Daily room", "daily mode should label the room")
|
||||||
|
_check(main.game.daily_key == today, "daily mode should carry today's key")
|
||||||
|
|
||||||
|
await _solve_board(main.game, "daily room")
|
||||||
|
_check(main.game.overlay.visible, "daily win overlay should appear after the timer")
|
||||||
|
_check(main.game.win_title.text == "Daily room complete!", "daily win title should be correct")
|
||||||
|
_check(main.game.win_next.text == "Back to lobby", "daily win button should say Back to lobby")
|
||||||
|
_check(save.daily_streak() == streak_before + 1, "daily streak should increment exactly once")
|
||||||
|
_check(save.daily_completed_today(), "today should be marked complete")
|
||||||
|
_check((save.data["completed_rooms"] as Array) == rooms_before, "daily must not touch completed rooms")
|
||||||
|
|
||||||
|
main.game.win_next.pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
_check(main.current == "home", "Back to lobby should return to home")
|
||||||
|
_check(main.home.visible, "home should be visible after the daily win")
|
||||||
|
|
||||||
|
|
||||||
|
func _test_campaign(main, save) -> void:
|
||||||
|
main.show_screen("game", false)
|
||||||
|
main.game.start_level(0)
|
||||||
|
await process_frame
|
||||||
|
var room_id := str(main.game.current_level_id)
|
||||||
|
var guest: Dictionary = Guests.for_room(1)
|
||||||
|
var guest_id := str(guest.get("id", ""))
|
||||||
|
|
||||||
|
await _solve_board(main.game, "campaign room 1")
|
||||||
|
_check(main.game.overlay.visible, "campaign win overlay should appear")
|
||||||
|
_check(main.game.win_title.text == "Everyone checked in!", "campaign win title should be correct")
|
||||||
|
_check(main.game.win_next.text == "Next room", "campaign win button should say Next room")
|
||||||
|
_check((save.data["completed_rooms"] as Array).has(room_id), "campaign room should be recorded")
|
||||||
|
_check(guest_id != "" and save.is_guest_unlocked(guest_id), "room 1 should unlock a guest")
|
||||||
|
|
||||||
|
main.game.win_next.pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check(not main.game.daily_mode, "next room should not be daily mode")
|
||||||
|
_check(main.game.level_index == 1, "next room should be room 2")
|
||||||
|
_check(main.game.level_label.text == "Room 2", "room 2 should be labelled correctly")
|
||||||
|
_check(not main.game.overlay.visible, "overlay should hide when room 2 starts")
|
||||||
|
|
||||||
|
|
||||||
|
func _test_guest_book(main) -> void:
|
||||||
|
main.show_screen("guest_book", false)
|
||||||
|
await process_frame
|
||||||
|
var book = main.guest_book
|
||||||
|
_check(book != null, "Guest Book missing")
|
||||||
|
if book == null:
|
||||||
|
return
|
||||||
|
var guest: Dictionary = Guests.all()[0]
|
||||||
|
book._show_detail(guest)
|
||||||
|
_check(book.detail_layer.visible, "guest detail should open")
|
||||||
|
_check(book.detail_name.text == str(guest.get("name", "")), "guest detail should name the guest")
|
||||||
|
book._try_close_detail()
|
||||||
|
_check(book.detail_layer.visible, "close should be guarded right after opening")
|
||||||
|
book._detail_opened_at -= 300
|
||||||
|
book._try_close_detail()
|
||||||
|
_check(not book.detail_layer.visible, "close should work after the guard")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
|
|
||||||
|
func _solve_board(game, label: String) -> void:
|
||||||
|
var board = game.board
|
||||||
|
var solved := false
|
||||||
|
for i in range(12):
|
||||||
|
if Rules.is_valid(board.cells, board.regions) or game.win_shown:
|
||||||
|
solved = true
|
||||||
|
break
|
||||||
|
board.hint()
|
||||||
|
await process_frame
|
||||||
|
if not solved:
|
||||||
|
solved = Rules.is_valid(board.cells, board.regions) or game.win_shown
|
||||||
|
_check(solved, "%s should solve within 12 hints" % label)
|
||||||
|
await create_timer(0.6).timeout
|
||||||
|
await process_frame
|
||||||
|
|
||||||
|
|
||||||
|
func _restore_defaults(save) -> void:
|
||||||
|
save.reset_progress()
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
save.data["last_room"] = 0
|
||||||
|
save.select_frame("plain")
|
||||||
|
save.set_setting("patterns", true)
|
||||||
|
save.set_setting("show_timer", true)
|
||||||
|
save.set_setting("reduce_motion", false)
|
||||||
|
save.set_setting("hold_seconds", 0.35)
|
||||||
|
save.set_setting("double_tap_place", true)
|
||||||
|
save.save_game()
|
||||||
|
_check(save.rooms_completed() == 0, "save progress should be restored")
|
||||||
|
_check(save.daily_data() == save._default_daily(), "save daily should be restored")
|
||||||
|
_check(save.selected_frame() == "plain", "save frame should be restored")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dm888jqtkwin7
|
||||||
@@ -24,9 +24,21 @@ func _run() -> void:
|
|||||||
var main = current_scene
|
var main = current_scene
|
||||||
_reset_save()
|
_reset_save()
|
||||||
|
|
||||||
|
main.show_screen("profile")
|
||||||
|
await _settle()
|
||||||
|
_save("res://screenshots/profile.png")
|
||||||
|
main.profile.streak_pressed.emit()
|
||||||
|
await _settle()
|
||||||
|
_save("res://screenshots/streak.png")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
main.open_settings("home")
|
main.open_settings("home")
|
||||||
await _settle()
|
await _settle()
|
||||||
_save("res://screenshots/settings.png")
|
_save("res://screenshots/settings.png")
|
||||||
|
main.settings_sheet._on_reset()
|
||||||
|
await _settle()
|
||||||
|
_save("res://screenshots/reset_confirm.png")
|
||||||
|
main.settings_sheet._hide_confirm()
|
||||||
main.close_settings()
|
main.close_settings()
|
||||||
|
|
||||||
main.show_screen("guest_book")
|
main.show_screen("guest_book")
|
||||||
@@ -48,6 +60,20 @@ func _run() -> void:
|
|||||||
await _settle()
|
await _settle()
|
||||||
_save("res://screenshots/rules_tutorial.png")
|
_save("res://screenshots/rules_tutorial.png")
|
||||||
|
|
||||||
|
main.show_screen("home")
|
||||||
|
main._on_daily()
|
||||||
|
await _settle()
|
||||||
|
_save("res://screenshots/daily.png")
|
||||||
|
for i in range(12):
|
||||||
|
if main.game.win_shown:
|
||||||
|
break
|
||||||
|
main.game.board.hint()
|
||||||
|
await process_frame
|
||||||
|
await create_timer(0.8).timeout
|
||||||
|
await RenderingServer.frame_post_draw
|
||||||
|
_save("res://screenshots/daily_win.png")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
main.show_screen("game")
|
main.show_screen("game")
|
||||||
main.game.start_level(0)
|
main.game.start_level(0)
|
||||||
await _settle()
|
await _settle()
|
||||||
@@ -76,6 +102,9 @@ func _reset_save() -> void:
|
|||||||
var save = root.get_node_or_null("SaveGame")
|
var save = root.get_node_or_null("SaveGame")
|
||||||
if save != null:
|
if save != null:
|
||||||
save.reset_progress()
|
save.reset_progress()
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
save.data["profile_frame"] = "plain"
|
||||||
|
save.save_game()
|
||||||
|
|
||||||
|
|
||||||
func _settle() -> void:
|
func _settle() -> void:
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ extends SceneTree
|
|||||||
## <godot> --headless --path . --script res://tools/ui_test.gd
|
## <godot> --headless --path . --script res://tools/ui_test.gd
|
||||||
|
|
||||||
var failures := 0
|
var failures := 0
|
||||||
|
var frames = null
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
@@ -33,8 +34,16 @@ func _run() -> void:
|
|||||||
quit(1)
|
quit(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Resolve at runtime so Frames.gd does not compile before autoloads exist.
|
||||||
|
frames = load("res://scripts/Frames.gd")
|
||||||
|
_check(frames != null, "Frames script missing")
|
||||||
|
if frames == null:
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
|
||||||
_test_save_defaults(save)
|
_test_save_defaults(save)
|
||||||
save.reset_progress()
|
save.reset_progress()
|
||||||
|
await _test_daily_and_frames(save, main)
|
||||||
|
|
||||||
main.game.start_level(0)
|
main.game.start_level(0)
|
||||||
await process_frame
|
await process_frame
|
||||||
@@ -107,13 +116,112 @@ func _run() -> void:
|
|||||||
quit(0 if failures == 0 else 1)
|
quit(0 if failures == 0 else 1)
|
||||||
|
|
||||||
|
|
||||||
|
func _test_daily_and_frames(save, main) -> void:
|
||||||
|
var today := Daily.today_key()
|
||||||
|
var yesterday := Daily.key_from_day_number(Daily.day_number(today) - 1)
|
||||||
|
var daily: Dictionary = save._default_daily()
|
||||||
|
daily["last_completed"] = yesterday
|
||||||
|
daily["streak"] = 2
|
||||||
|
daily["best_streak"] = 2
|
||||||
|
save.data["daily"] = daily
|
||||||
|
|
||||||
|
_check(save.complete_daily(today), "today's daily should count")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 3, "consecutive daily should extend streak")
|
||||||
|
_check(save.daily_streak() == 3, "daily streak should be alive")
|
||||||
|
_check(save.best_streak() == 3, "best streak should update")
|
||||||
|
_check(not save.complete_daily(today), "same day should not count twice")
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 3, "replay should not change streak")
|
||||||
|
|
||||||
|
var older := Daily.key_from_day_number(Daily.day_number(today) - 3)
|
||||||
|
daily = save._default_daily()
|
||||||
|
daily["last_completed"] = older
|
||||||
|
daily["streak"] = 9
|
||||||
|
daily["best_streak"] = 9
|
||||||
|
save.data["daily"] = daily
|
||||||
|
save.complete_daily(today)
|
||||||
|
_check(int(save.daily_data().get("streak", 0)) == 1, "a gap should reset the streak")
|
||||||
|
_check(save.best_streak() == 9, "best streak should survive a reset")
|
||||||
|
|
||||||
|
var index := Daily.level_index(30, today)
|
||||||
|
_check(index >= 0 and index < 30, "daily level index should be in range")
|
||||||
|
_check(index == Daily.level_index(30, today), "daily level index should be stable")
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
save.save_game()
|
||||||
|
|
||||||
|
save.reset_progress()
|
||||||
|
_check(frames.is_unlocked("plain"), "plain frame should always be available")
|
||||||
|
_check(not frames.is_unlocked("paper"), "Paper should need rooms")
|
||||||
|
for i in range(5):
|
||||||
|
save.data["completed_rooms"].append("room-%02d" % i)
|
||||||
|
save.save_game()
|
||||||
|
_check(frames.is_unlocked("paper"), "five rooms should unlock Paper")
|
||||||
|
_check(not frames.is_unlocked("bell"), "Bellhop should still be locked")
|
||||||
|
var stats: Dictionary = save.daily_data()
|
||||||
|
stats["best_streak"] = 3
|
||||||
|
save.data["daily"] = stats
|
||||||
|
save.save_game()
|
||||||
|
_check(frames.is_unlocked("regular"), "a 3-day best streak should unlock Regular")
|
||||||
|
save.select_frame("regular")
|
||||||
|
save.load_game()
|
||||||
|
_check(save.selected_frame() == "regular", "frame selection should persist")
|
||||||
|
|
||||||
|
main.show_screen("profile")
|
||||||
|
await process_frame
|
||||||
|
_check(main.profile != null, "Profile screen missing")
|
||||||
|
if main.profile != null:
|
||||||
|
main.profile._set_tab("frame")
|
||||||
|
await process_frame
|
||||||
|
_check(
|
||||||
|
main.profile.frame_grid.get_child_count() == frames.all().size(),
|
||||||
|
"Profile should show every frame"
|
||||||
|
)
|
||||||
|
_check(
|
||||||
|
main.profile.frame_grid.get_child(0).mouse_filter == Control.MOUSE_FILTER_PASS,
|
||||||
|
"frame cards should pass swipes"
|
||||||
|
)
|
||||||
|
# Regression: pressing a card must not free that card while its
|
||||||
|
# `pressed` signal is still on the stack.
|
||||||
|
var regular_index := -1
|
||||||
|
for i in frames.all().size():
|
||||||
|
if str(frames.all()[i].get("id", "")) == "regular":
|
||||||
|
regular_index = i
|
||||||
|
if regular_index >= 0:
|
||||||
|
main.profile.frame_grid.get_child(regular_index).pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
await process_frame
|
||||||
|
_check(main.profile.pending_frame == "regular", "frame card should update the preview")
|
||||||
|
main.profile._on_confirm()
|
||||||
|
await process_frame
|
||||||
|
_check(save.selected_frame() == "regular", "confirm should apply the frame")
|
||||||
|
_check(
|
||||||
|
main.profile.frame_grid.get_child_count() == frames.all().size(),
|
||||||
|
"frame grid should stay stable after selection"
|
||||||
|
)
|
||||||
|
main.profile._set_tab("avatar")
|
||||||
|
await process_frame
|
||||||
|
_check(main.profile.frame_grid.get_child_count() > 10, "avatar tab should list portraits")
|
||||||
|
main.home.streak_pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check(main.current == "streak", "streak button should open the streak screen")
|
||||||
|
main.show_screen("home")
|
||||||
|
main.home.daily_pressed.emit()
|
||||||
|
await process_frame
|
||||||
|
_check(main.game.daily_mode, "daily button should start daily mode")
|
||||||
|
_check(main.game.level_label.text == "Daily room", "daily mode should label the room")
|
||||||
|
main.show_screen("home", false)
|
||||||
|
|
||||||
|
save.data["completed_rooms"] = []
|
||||||
|
save.data["daily"] = save._default_daily()
|
||||||
|
save.select_frame("plain")
|
||||||
|
|
||||||
|
|
||||||
func _test_save_defaults(save) -> void:
|
func _test_save_defaults(save) -> void:
|
||||||
# A fresh save starts in double-tap mode at version 2.
|
# A fresh save starts in double-tap mode at version 4.
|
||||||
var abs_path := ProjectSettings.globalize_path(save.PATH)
|
var abs_path := ProjectSettings.globalize_path(save.PATH)
|
||||||
if FileAccess.file_exists(save.PATH):
|
if FileAccess.file_exists(save.PATH):
|
||||||
DirAccess.remove_absolute(abs_path)
|
DirAccess.remove_absolute(abs_path)
|
||||||
save.load_game()
|
save.load_game()
|
||||||
_check(int(save.data.get("version", 0)) == 2, "fresh saves should be version 2")
|
_check(int(save.data.get("version", 0)) == 4, "fresh saves should be version 4")
|
||||||
_check(bool(save.get_setting("double_tap_place")), "fresh saves should default to double-tap")
|
_check(bool(save.get_setting("double_tap_place")), "fresh saves should default to double-tap")
|
||||||
|
|
||||||
# A version 1 save with hold selected migrates to double-tap once.
|
# A version 1 save with hold selected migrates to double-tap once.
|
||||||
@@ -125,7 +233,7 @@ func _test_save_defaults(save) -> void:
|
|||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
save.load_game()
|
save.load_game()
|
||||||
_check(int(save.data.get("version", 0)) == 2, "version 1 saves should migrate to version 2")
|
_check(int(save.data.get("version", 0)) == 4, "version 1 saves should migrate to version 4")
|
||||||
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
|
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||