Compare commits

..
Author SHA1 Message Date
Ratdoku Builder 804f68699d chore(release): v0.6.0-alpha
Bump version name to 0.6.0 and Android version code to 12. Document avatars and the Daily Streak screen.
2026-12-02 23:57:29 -06:00
Ratdoku Builder d0be689faa feat(profile): selectable avatars and a daily streak view
Profile now has tabbed Avatar/Frame pickers with preview and Confirm/Cancel. Crumb plus unlocked guest portraits can be chosen as the avatar. A new Daily Streak screen shows the current streak, best streak, weekly calendar, next-frame goal, and a 7-day gift marker. Save format moves to version 4 with avatar_id and completion history.
2026-12-02 23:57:28 -06:00
21 changed files with 567 additions and 78 deletions

No files matched your search

+9
View File
@@ -2,6 +2,15 @@
All notable alpha milestones for Ratdoku. All notable alpha milestones for Ratdoku.
## 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 ## 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. - Icon SVGs now import at 120px intrinsic size instead of 24px, so buttons stay sharp on high-density phones.
+14 -12
View File
@@ -17,8 +17,8 @@ The project uses a portrait **360×640 dp canvas**, scaled to a 540×960 desktop
- 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.
- **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. - 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 wear unlocked frames. - 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.
@@ -41,7 +41,8 @@ The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains
- **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. Destructive actions use a themed in-app confirmation card. - **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** — Crumb's framed portrait, rooms completed, current and best daily streaks, and a selectable frame grid. - **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
@@ -146,12 +147,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.5.3` (version code 11) - Version: `0.6.0` (version code 12)
- 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.5.3-alpha · build 2026-12-02` - Build label: `v0.6.0-alpha · build 2026-12-02`
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:
@@ -188,7 +189,7 @@ 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, daily streak math and level selection, frame unlocks and selection persistence, 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: Run the whole QA suite (class scan, every test script, log-error scan, optional screenshots, optional APK build) with:
@@ -200,7 +201,7 @@ Run the whole QA suite (class scan, every test script, log-error scan, optional
## Versioning and releases ## Versioning and releases
The current development build is **v0.5.3-alpha** (“Crisp Icons”) with the build label on Home and in Settings. The current development build is **v0.6.0-alpha** (“New Looks & Streaks”) with the build label on Home and in Settings.
Gitea repository: Gitea repository:
@@ -219,14 +220,15 @@ Alpha releases (all marked prerelease, each with a debug APK and source archive)
- **v0.5.1-alpha** — profile frame selection crash fix, QA suites, and log-guarded test runner - **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.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.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
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.5.3-alpha https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.6.0-alpha
The v0.5.3-alpha APK is also at: The v0.6.0-alpha APK is also at:
`https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.5.3-alpha/Ratdoku-v0.5.3-alpha.apk` `https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.6.0-alpha/Ratdoku-v0.6.0-alpha.apk`
`redesign-360` is the branch with the current 360dp work; it is tagged `v0.5.3-alpha`. `redesign-360` is the branch with the current 360dp work; it is tagged `v0.6.0-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`).
@@ -240,7 +242,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 frames (save version 3) - Daily room with streaks, Profile screen, selectable avatars and frames (save version 4)
- Installable Android debug APK - Installable Android debug APK
- No Godot boot splash; the app opens straight to the cream-themed game - No Godot boot splash; the app opens straight to the cream-themed game
- No audio yet, no release keystore/AAB yet - No audio yet, no release keystore/AAB yet
+13
View File
@@ -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

+13
View File
@@ -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

+2 -2
View File
@@ -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=11 version/code=12
version/name="0.5.3" version/name="0.6.0"
package/unique_name="com.ratdoku.game" package/unique_name="com.ratdoku.game"
package/name="Ratdoku" package/name="Ratdoku"
package/signed=true package/signed=true
+1 -1
View File
@@ -12,7 +12,7 @@ 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.5.3-alpha" config/version="0.6.0-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/show_image=false
+12
View File
@@ -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")
+56
View File
@@ -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))
+1
View File
@@ -0,0 +1 @@
uid://c5700f5m3iuxh
+24
View File
@@ -29,6 +29,30 @@ static func key_from_day_number(day: int) -> String:
return "%04d-%02d-%02d" % [int(d.get("year", 0)), int(d.get("month", 0)), int(d.get("day", 0))] 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. ## Stable per-date room choice. With 30 rooms the pool repeats monthly.
static func level_index(level_count: int, key: String = "") -> int: static func level_index(level_count: int, key: String = "") -> int:
if level_count <= 0: if level_count <= 0:
+19 -4
View File
@@ -6,13 +6,16 @@ signal settings_pressed
signal rules_pressed signal rules_pressed
signal daily_pressed signal daily_pressed
signal profile_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 daily_button: Button
var streak_button: Button
var avatar_holder: CenterContainer var avatar_holder: CenterContainer
var avatar_frame_id := "" var avatar_frame_id := ""
var avatar_portrait_id := ""
func _ready() -> void: func _ready() -> void:
@@ -62,10 +65,18 @@ func _ready() -> void:
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 = UI.button("Daily room", false, 40)
daily_button.custom_minimum_size = Vector2(0, 40) daily_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
daily_button.add_theme_font_size_override("font_size", 13) daily_button.add_theme_font_size_override("font_size", 13)
daily_button.pressed.connect(func() -> void: daily_pressed.emit()) daily_button.pressed.connect(func() -> void: daily_pressed.emit())
column.add_child(daily_button) 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
@@ -151,7 +162,7 @@ func _build_avatar() -> void:
var avatar := Button.new() var avatar := Button.new()
avatar.custom_minimum_size = Vector2(44, 44) avatar.custom_minimum_size = Vector2(44, 44)
avatar.flat = true avatar.flat = true
avatar.icon = load("res://art/crumb_head.png") avatar.icon = load(Avatars.portrait_path(SaveGame.selected_avatar()))
avatar.expand_icon = true avatar.expand_icon = true
avatar.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER avatar.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
avatar.alignment = HORIZONTAL_ALIGNMENT_CENTER avatar.alignment = HORIZONTAL_ALIGNMENT_CENTER
@@ -160,10 +171,14 @@ func _build_avatar() -> void:
frame.add_child(avatar) frame.add_child(avatar)
avatar_holder.add_child(frame) avatar_holder.add_child(frame)
avatar_frame_id = SaveGame.selected_frame() avatar_frame_id = SaveGame.selected_frame()
avatar_portrait_id = SaveGame.selected_avatar()
func _refresh_avatar() -> void: func _refresh_avatar() -> void:
if avatar_frame_id == SaveGame.selected_frame(): if (
avatar_frame_id == SaveGame.selected_frame()
and avatar_portrait_id == SaveGame.selected_avatar()
):
return return
for child in avatar_holder.get_children(): for child in avatar_holder.get_children():
child.queue_free() child.queue_free()
+9
View File
@@ -5,6 +5,7 @@ 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 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
@@ -12,6 +13,7 @@ var game
var guest_book var guest_book
var rulebook var rulebook
var profile var profile
var streak
var settings_sheet var settings_sheet
var screens := {} var screens := {}
var current := "home" var current := "home"
@@ -33,6 +35,7 @@ func _ready() -> void:
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.daily_pressed.connect(_on_daily)
home.profile_pressed.connect(func() -> void: show_screen("profile")) 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)
@@ -51,6 +54,11 @@ func _ready() -> void:
profile = ProfileScene.instantiate() profile = ProfileScene.instantiate()
_add_screen(profile) _add_screen(profile)
profile.back_pressed.connect(go_back) 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)
@@ -67,6 +75,7 @@ func _ready() -> void:
"guest_book": guest_book, "guest_book": guest_book,
"rules": rulebook, "rules": rulebook,
"profile": profile, "profile": profile,
"streak": streak,
} }
show_screen("home", false) show_screen("home", false)
+111 -32
View File
@@ -1,14 +1,22 @@
extends Control extends Control
signal back_pressed signal back_pressed
signal streak_pressed
var portrait_holder: CenterContainer var portrait_holder: CenterContainer
var name_label: Label
var role_label: Label
var rooms_label: Label var rooms_label: Label
var streak_label: Label var streak_label: Label
var best_label: Label var best_label: Label
var frame_grid: GridContainer var frame_grid: GridContainer
var status_label: Label var status_label: Label
var portrait_frame_id := "" 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: func _ready() -> void:
@@ -32,7 +40,7 @@ func _ready() -> void:
back.pressed.connect(func() -> void: back_pressed.emit()) back.pressed.connect(func() -> void: back_pressed.emit())
top.add_child(back) top.add_child(back)
var title := UI.label("Crumb's Profile", 22) var title := UI.label("Profile", 22)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title) top.add_child(title)
@@ -51,8 +59,10 @@ func _ready() -> void:
portrait_holder = CenterContainer.new() portrait_holder = CenterContainer.new()
content.add_child(portrait_holder) content.add_child(portrait_holder)
content.add_child(UI.label("Crumb", 20, Palette.INK, true)) name_label = UI.label("Crumb", 20, Palette.INK, true)
content.add_child(UI.label("Innkeeper · always in", 11, Palette.MUTED)) content.add_child(name_label)
role_label = UI.label("Innkeeper · always in", 11, Palette.MUTED)
content.add_child(role_label)
var stats := HBoxContainer.new() var stats := HBoxContainer.new()
stats.add_theme_constant_override("separation", 6) stats.add_theme_constant_override("separation", 6)
@@ -61,7 +71,23 @@ func _ready() -> void:
streak_label = _stat_card(stats, "Streak", "0") streak_label = _stat_card(stats, "Streak", "0")
best_label = _stat_card(stats, "Best", "0") best_label = _stat_card(stats, "Best", "0")
content.add_child(UI.heading("Frames", 18)) 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 = GridContainer.new()
frame_grid.columns = 2 frame_grid.columns = 2
frame_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL frame_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
@@ -69,10 +95,22 @@ func _ready() -> void:
frame_grid.add_theme_constant_override("v_separation", 6) frame_grid.add_theme_constant_override("v_separation", 6)
content.add_child(frame_grid) content.add_child(frame_grid)
status_label = UI.label("Tap an unlocked frame to wear it.", 11, Palette.MUTED) status_label = UI.label("Pick a look, then confirm.", 11, Palette.MUTED)
status_label.custom_minimum_size = Vector2(0, 22) status_label.custom_minimum_size = Vector2(0, 22)
content.add_child(status_label) 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) UI.pass_scroll_input(content)
SaveGame.progress_changed.connect(refresh) SaveGame.progress_changed.connect(refresh)
refresh() refresh()
@@ -92,46 +130,68 @@ func _stat_card(parent: HBoxContainer, title: String, value: String) -> Label:
func refresh() -> void: func refresh() -> void:
pending_avatar = SaveGame.selected_avatar()
pending_frame = SaveGame.selected_frame()
rooms_label.text = "%d / 30" % SaveGame.rooms_completed() rooms_label.text = "%d / 30" % SaveGame.rooms_completed()
streak_label.text = str(SaveGame.daily_streak()) streak_label.text = str(SaveGame.daily_streak())
best_label.text = str(SaveGame.best_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_portrait()
_build_frames() _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: func _build_portrait() -> void:
var selected := SaveGame.selected_frame() var key: String = pending_avatar + "|" + pending_frame
if portrait_frame_id == selected and portrait_holder.get_child_count() > 0: if portrait_key == key and portrait_holder.get_child_count() > 0:
return return
for child in portrait_holder.get_children(): for child in portrait_holder.get_children():
child.queue_free() child.queue_free()
var frame := Frames.frame_panel(selected, 118) var frame := Frames.frame_panel(pending_frame, 118)
var head := TextureRect.new() var head := TextureRect.new()
head.texture = load("res://art/crumb_head.png") head.texture = load(Avatars.portrait_path(pending_avatar))
head.custom_minimum_size = Vector2(96, 96) head.custom_minimum_size = Vector2(96, 96)
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
head.mouse_filter = Control.MOUSE_FILTER_IGNORE head.mouse_filter = Control.MOUSE_FILTER_IGNORE
frame.add_child(head) frame.add_child(head)
portrait_holder.add_child(frame) portrait_holder.add_child(frame)
portrait_frame_id = selected portrait_key = key
func _build_frames() -> void: func _build_grid() -> void:
for child in frame_grid.get_children(): for child in frame_grid.get_children():
child.queue_free() child.queue_free()
var selected := SaveGame.selected_frame() var entries: Array = Avatars.all() if current_tab == "avatar" else Frames.all()
for frame in Frames.all(): var selected := pending_avatar if current_tab == "avatar" else pending_frame
var id := str(frame.get("id", "")) for entry in entries:
var unlocked := Frames.is_unlocked(id) 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() var card := Button.new()
card.custom_minimum_size = Vector2(148, 92) card.custom_minimum_size = Vector2(148, 92)
card.flat = true card.flat = true
card.add_theme_stylebox_override("normal", _card_style(Palette.PAPER)) 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("hover", _card_style(Palette.PAPER_DARK))
card.add_theme_stylebox_override("pressed", _card_style(Palette.GOLD)) card.add_theme_stylebox_override("pressed", _card_style(Palette.GOLD))
card.pressed.connect(_on_frame_pressed.bind(id, unlocked)) card.pressed.connect(_on_card_pressed.bind(id, unlocked, current_tab))
var row := HBoxContainer.new() var row := HBoxContainer.new()
row.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) row.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
@@ -139,10 +199,10 @@ func _build_frames() -> void:
row.mouse_filter = Control.MOUSE_FILTER_IGNORE row.mouse_filter = Control.MOUSE_FILTER_IGNORE
card.add_child(row) card.add_child(row)
var badge := Frames.frame_panel(id, 46) var badge := Frames.frame_panel(pending_frame if current_tab == "avatar" else id, 46)
badge.mouse_filter = Control.MOUSE_FILTER_IGNORE badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
var head := TextureRect.new() var head := TextureRect.new()
head.texture = load("res://art/crumb_head.png") 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.custom_minimum_size = Vector2(30, 30)
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
@@ -156,18 +216,18 @@ func _build_frames() -> void:
text.mouse_filter = Control.MOUSE_FILTER_IGNORE text.mouse_filter = Control.MOUSE_FILTER_IGNORE
row.add_child(text) row.add_child(text)
var name := UI.label(str(frame.get("name", "")), 12) var name := UI.label(str(entry.get("name", "")), 12)
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(name) text.add_child(name)
var detail := "" var detail := ""
if id == selected: if id == selected:
detail = "Wearing" detail = "Selected"
elif unlocked: elif unlocked:
detail = "Unlocked" detail = "Unlocked"
else: else:
detail = Frames.requirement_text(id) detail = Avatars.requirement_text(id) if current_tab == "avatar" else Frames.requirement_text(id)
var sub := UI.label(detail, 9, Palette.MUTED if unlocked else Palette.RED) 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 sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(sub) text.add_child(sub)
@@ -178,19 +238,38 @@ func _build_frames() -> void:
UI.pass_scroll_input(frame_grid) UI.pass_scroll_input(frame_grid)
func _on_frame_pressed(id: String, unlocked: bool) -> void: func _on_card_pressed(id: String, unlocked: bool, tab: String) -> void:
if not unlocked: if not unlocked:
status_label.text = "Locked: %s." % Frames.requirement_text(id) 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) status_label.add_theme_color_override("font_color", Palette.RED)
return return
# Never rebuild the card grid while the card's own `pressed` signal is call_deferred("_select_card", id, tab)
# still on the stack; Godot locks the emitting node during the call.
call_deferred("_apply_frame", id)
func _apply_frame(id: String) -> void: func _select_card(id: String, tab: String) -> void:
SaveGame.select_frame(id) if tab == "avatar":
status_label.text = "Now wearing %s." % str(Frames.by_id(id).get("name", id)) 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) status_label.add_theme_color_override("font_color", Palette.MUTED)
+40 -4
View File
@@ -28,24 +28,26 @@ func _default_daily() -> Dictionary:
"last_completed": "", "last_completed": "",
"streak": 0, "streak": 0,
"best_streak": 0, "best_streak": 0,
"history": [],
} }
func _default_data() -> Dictionary: func _default_data() -> Dictionary:
return { return {
"version": 3, "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(), "daily": _default_daily(),
"profile_frame": "plain", "profile_frame": "plain",
"avatar_id": "crumb",
} }
func load_game() -> void: func load_game() -> void:
data = _default_data() data = _default_data()
var stored_version := 3 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)
@@ -72,15 +74,21 @@ func load_game() -> void:
data["daily"][key] = daily_defaults[key] data["daily"][key] = daily_defaults[key]
if typeof(data.get("profile_frame")) != TYPE_STRING or str(data["profile_frame"]).is_empty(): if typeof(data.get("profile_frame")) != TYPE_STRING or str(data["profile_frame"]).is_empty():
data["profile_frame"] = "plain" 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 var migrated := false
# Version 2 made double-tap the default; version 3 added daily streaks # Version 2 made double-tap the default; version 3 added daily streaks
# and profile frames. Both migrations are one-time. # 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
migrated = true migrated = true
if stored_version < 3: if stored_version < 3:
migrated = true 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"] = []
@@ -88,7 +96,7 @@ func load_game() -> void:
data["unlocked_guests"] = [] data["unlocked_guests"] = []
if migrated: if migrated:
data["version"] = 3 data["version"] = 4
save_game() save_game()
@@ -196,17 +204,45 @@ func complete_daily(key: String) -> bool:
daily["streak"] = streak daily["streak"] = streak
daily["last_completed"] = key daily["last_completed"] = key
daily["best_streak"] = max(int(daily.get("best_streak", 0)), streak) 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 data["daily"] = daily
save_game() save_game()
progress_changed.emit() progress_changed.emit()
return true return true
func daily_history() -> Array:
var history: Array = daily_data().get("history", [])
return history.duplicate()
func selected_frame() -> String: func selected_frame() -> String:
return str(data.get("profile_frame", "plain")) return str(data.get("profile_frame", "plain"))
func selected_avatar() -> String:
return str(data.get("avatar_id", "crumb"))
func select_frame(id: String) -> void: func select_frame(id: String) -> void:
data["profile_frame"] = id data["profile_frame"] = id
save_game() save_game()
progress_changed.emit() 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()
+133
View File
@@ -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)
+1
View File
@@ -0,0 +1 @@
uid://dqlbnhq0n653j
+3 -3
View File
@@ -1,7 +1,7 @@
class_name Version class_name Version
extends RefCounted extends RefCounted
const NUMBER := "0.5.3-alpha" const NUMBER := "0.6.0-alpha"
const CODENAME := "Crisp Icons" const CODENAME := "New Looks & Streaks"
const BUILD_DATE := "2026-12-02" const BUILD_DATE := "2026-12-02"
const BUILD_LABEL := "v0.5.3-alpha · build 2026-12-02" const BUILD_LABEL := "v0.6.0-alpha · build 2026-12-02"
+54 -10
View File
@@ -8,6 +8,7 @@ extends SceneTree
var failures := 0 var failures := 0
var frames = null var frames = null
var avatars = null
func _init() -> void: func _init() -> void:
@@ -35,13 +36,16 @@ func _run() -> void:
# SaveGame autoload is registered when launched with --script. # SaveGame autoload is registered when launched with --script.
frames = load("res://scripts/Frames.gd") frames = load("res://scripts/Frames.gd")
_check(frames != null, "Frames script missing") _check(frames != null, "Frames script missing")
if frames == null: avatars = load("res://scripts/Avatars.gd")
_check(avatars != null, "Avatars script missing")
if frames == null or avatars == null:
_finish() _finish()
return return
_test_save_migrations(save) _test_save_migrations(save)
_test_daily(save) _test_daily(save)
_test_frames(save) _test_frames(save)
_test_avatars_and_streak(save)
_test_game_data(save) _test_game_data(save)
_test_icons() _test_icons()
@@ -49,8 +53,48 @@ func _run() -> void:
_finish() _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: func _test_icons() -> void:
_note("5. icon assets") _note("6. icon assets")
# Load at runtime so UI.gd does not compile before the autoload exists. # Load at runtime so UI.gd does not compile before the autoload exists.
var ui_script = load("res://scripts/UI.gd") var ui_script = load("res://scripts/UI.gd")
_check(ui_script != null, "UI script missing") _check(ui_script != null, "UI script missing")
@@ -145,10 +189,10 @@ func _is_default_daily(save, daily: Dictionary) -> bool:
func _test_save_migrations(save) -> void: func _test_save_migrations(save) -> void:
_note("1. save migration matrix") _note("1. save migration matrix")
# (a) No save file at all -> fresh version-3 defaults. # (a) No save file at all -> fresh version-4 defaults.
_remove_save(save) _remove_save(save)
save.load_game() save.load_game()
_check(int(save.data.get("version", 0)) == 3, "fresh save should be version 3") _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(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(_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.selected_frame() == "plain", "fresh save should select the plain frame")
@@ -163,7 +207,7 @@ func _test_save_migrations(save) -> void:
v1.erase("profile_frame") v1.erase("profile_frame")
_write_save(save, v1) _write_save(save, v1)
save.load_game() save.load_game()
_check(int(save.data.get("version", 0)) == 3, "version 1 should migrate to version 3") _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(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(_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") _check(save.selected_frame() == "plain", "version 1 missing frame should become plain")
@@ -176,7 +220,7 @@ func _test_save_migrations(save) -> void:
v2.erase("profile_frame") v2.erase("profile_frame")
_write_save(save, v2) _write_save(save, v2)
save.load_game() save.load_game()
_check(int(save.data.get("version", 0)) == 3, "version 2 should migrate to version 3") _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(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(_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") _check(save.selected_frame() == "plain", "version 2 missing frame should become plain")
@@ -189,7 +233,7 @@ func _test_save_migrations(save) -> void:
else: else:
_check(false, "could not write wrong-shape save") _check(false, "could not write wrong-shape save")
save.load_game() save.load_game()
_check(int(save.data.get("version", 0)) == 3, "wrong-shape save should restore version 3 defaults") _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(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(_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.selected_frame() == "plain", "wrong-shape save should restore plain frame")
@@ -197,7 +241,7 @@ func _test_save_migrations(save) -> void:
# (e) Missing individual setting keys are filled from DEFAULTS. # (e) Missing individual setting keys are filled from DEFAULTS.
var partial: Dictionary = save._default_data() var partial: Dictionary = save._default_data()
partial["version"] = 3 partial["version"] = 4
partial["settings"] = {} partial["settings"] = {}
_write_save(save, partial) _write_save(save, partial)
save.load_game() save.load_game()
@@ -208,9 +252,9 @@ func _test_save_migrations(save) -> void:
"filled setting '%s' should match DEFAULTS" % key "filled setting '%s' should match DEFAULTS" % key
) )
# A version-3 save's explicit false must not be overwritten by a default. # A version-4 save's explicit false must not be overwritten by a default.
var explicit_false: Dictionary = save._default_data() var explicit_false: Dictionary = save._default_data()
explicit_false["version"] = 3 explicit_false["version"] = 4
explicit_false["settings"]["double_tap_place"] = false explicit_false["settings"]["double_tap_place"] = false
_write_save(save, explicit_false) _write_save(save, explicit_false)
save.load_game() save.load_game()
+34 -6
View File
@@ -53,13 +53,13 @@ func _run() -> void:
func _test_screen_cycle(main) -> void: func _test_screen_cycle(main) -> void:
var expected: Array[String] = ["home", "game", "guest_book", "rules", "profile"] var expected: Array[String] = ["home", "game", "guest_book", "rules", "profile", "streak"]
_check(main.screens.size() == expected.size(), "Main should expose all five screens") _check(main.screens.size() == expected.size(), "Main should expose all six screens")
for name in expected: for name in expected:
_check(main.screens.has(name) and main.screens[name] != null, "screen missing: %s" % name) _check(main.screens.has(name) and main.screens[name] != null, "screen missing: %s" % name)
_check( _check(
main.home != null and main.game != null and main.guest_book != null main.home != null and main.game != null and main.guest_book != null
and main.rulebook != null and main.profile != null, and main.rulebook != null and main.profile != null and main.streak != null,
"named screen references should all exist" "named screen references should all exist"
) )
_check(main.settings_sheet != null, "settings sheet missing") _check(main.settings_sheet != null, "settings sheet missing")
@@ -169,6 +169,8 @@ func _test_profile(main, save) -> void:
if profile == null: if profile == null:
return return
profile._set_tab("frame")
await process_frame
var expected: int = frames.all().size() var expected: int = frames.all().size()
_check(profile.frame_grid.get_child_count() == expected, "Profile should show every frame") _check(profile.frame_grid.get_child_count() == expected, "Profile should show every frame")
for i in range(profile.frame_grid.get_child_count()): for i in range(profile.frame_grid.get_child_count()):
@@ -211,9 +213,19 @@ func _test_profile(main, save) -> void:
_check(int(probe["count"]) == count_before, "frame grid must stay stable while pressed emits") _check(int(probe["count"]) == count_before, "frame grid must stay stable while pressed emits")
await process_frame await process_frame
await process_frame await process_frame
_check(save.selected_frame() == "regular", "pressing an unlocked frame should select it") _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") _check(profile.frame_grid.get_child_count() == count_before, "frame grid should stay stable after selection")
_check(profile.status_label.text.find("Now wearing") >= 0, "selection should be reported in profile status")
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) var locked_card = profile.frame_grid.get_child(night_index)
locked_card.pressed.emit() locked_card.pressed.emit()
@@ -222,7 +234,23 @@ func _test_profile(main, save) -> void:
profile.status_label.text.find(frames.requirement_text("night")) >= 0, profile.status_label.text.find(frames.requirement_text("night")) >= 0,
"locked frame should show its requirement" "locked frame should show its requirement"
) )
_check(save.selected_frame() == "regular", "locked frame must not change the selection") _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: func _test_daily(main, save) -> void:
+3
View File
@@ -27,6 +27,9 @@ func _run() -> void:
main.show_screen("profile") main.show_screen("profile")
await _settle() await _settle()
_save("res://screenshots/profile.png") _save("res://screenshots/profile.png")
main.profile.streak_pressed.emit()
await _settle()
_save("res://screenshots/streak.png")
main.show_screen("home", false) main.show_screen("home", false)
main.open_settings("home") main.open_settings("home")
+15 -4
View File
@@ -169,6 +169,8 @@ func _test_daily_and_frames(save, main) -> void:
await process_frame await process_frame
_check(main.profile != null, "Profile screen missing") _check(main.profile != null, "Profile screen missing")
if main.profile != null: if main.profile != null:
main.profile._set_tab("frame")
await process_frame
_check( _check(
main.profile.frame_grid.get_child_count() == frames.all().size(), main.profile.frame_grid.get_child_count() == frames.all().size(),
"Profile should show every frame" "Profile should show every frame"
@@ -187,11 +189,20 @@ func _test_daily_and_frames(save, main) -> void:
main.profile.frame_grid.get_child(regular_index).pressed.emit() main.profile.frame_grid.get_child(regular_index).pressed.emit()
await process_frame await process_frame
await process_frame await process_frame
_check(save.selected_frame() == "regular", "frame press should select the 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( _check(
main.profile.frame_grid.get_child_count() == frames.all().size(), main.profile.frame_grid.get_child_count() == frames.all().size(),
"frame grid should stay stable after selection" "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.show_screen("home")
main.home.daily_pressed.emit() main.home.daily_pressed.emit()
await process_frame await process_frame
@@ -205,12 +216,12 @@ func _test_daily_and_frames(save, main) -> void:
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)) == 3, "fresh saves should be version 3") _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.
@@ -222,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)) == 3, "version 1 saves should migrate to version 3") _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")