Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04eba25286 | ||
|
|
7e6a338240 |
No files matched your search
@@ -2,6 +2,16 @@
|
|||||||
|
|
||||||
All notable alpha milestones for Ratdoku.
|
All notable alpha milestones for Ratdoku.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|||||||
@@ -17,6 +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.
|
||||||
|
- Tap **Crumb** in the top-left to open your Profile, where you can wear unlocked frames.
|
||||||
- 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 +37,11 @@ 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.
|
||||||
|
- **Profile** — Crumb's framed portrait, rooms completed, current and best daily streaks, and a selectable frame grid.
|
||||||
- **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 +146,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.5.0` (version code 8)
|
||||||
- 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.5.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:
|
||||||
|
|
||||||
@@ -185,11 +188,11 @@ 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 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.
|
||||||
|
|
||||||
## 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.5.0-alpha** (“Daily Rooms & Frames”) with the build label on Home and in Settings.
|
||||||
|
|
||||||
Gitea repository:
|
Gitea repository:
|
||||||
|
|
||||||
@@ -204,14 +207,15 @@ 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
|
||||||
|
|
||||||
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.5.0-alpha
|
||||||
|
|
||||||
The v0.4.3-alpha APK is also at:
|
The v0.5.0-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.5.0-alpha/Ratdoku-v0.5.0-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.5.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`).
|
||||||
|
|
||||||
@@ -225,5 +229,6 @@ 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)
|
||||||
- Installable Android debug APK
|
- Installable Android debug APK
|
||||||
- No audio yet, no profile/daily streak yet, no release keystore/AAB yet
|
- No audio yet, no release keystore/AAB yet
|
||||||
+2
-2
@@ -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=8
|
||||||
version/name="0.4.3"
|
version/name="0.5.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
@@ -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.4.3-alpha"
|
config/version="0.5.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"
|
||||||
|
|
||||||
|
|||||||
@@ -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,37 @@
|
|||||||
|
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))]
|
||||||
|
|
||||||
|
|
||||||
|
## 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,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
|
||||||
+35
-6
@@ -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,6 +260,10 @@ 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.free()
|
||||||
@@ -334,7 +346,7 @@ 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 _on_board_changed() -> void:
|
func _on_board_changed() -> void:
|
||||||
@@ -357,9 +369,23 @@ 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()
|
||||||
|
|
||||||
|
if daily_mode:
|
||||||
|
var extended := SaveGame.complete_daily(daily_key)
|
||||||
|
var streak := SaveGame.daily_streak()
|
||||||
|
var streak_text := "%d %s" % [streak, "day" if streak == 1 else "days"]
|
||||||
|
win_title.text = "Daily room complete!"
|
||||||
|
win_detail.text = "%s · %s" % [
|
||||||
|
("Streak: " + streak_text) if extended else ("Replay · " + streak_text),
|
||||||
|
_format_time(elapsed_ms)
|
||||||
|
]
|
||||||
|
win_next.text = "Back to lobby"
|
||||||
|
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)
|
var unlocked_id := SaveGame.complete_room(current_level_id, level_index + 1)
|
||||||
if unlocked_id != "":
|
if unlocked_id != "":
|
||||||
var guest := Guests.by_id(unlocked_id)
|
var guest := Guests.by_id(unlocked_id)
|
||||||
@@ -392,6 +418,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:
|
||||||
|
|||||||
+27
-7
@@ -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.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,6 +143,7 @@ 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.free()
|
||||||
|
|
||||||
|
|||||||
+51
-15
@@ -4,10 +4,15 @@ 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
|
||||||
|
|
||||||
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 avatar_holder: CenterContainer
|
||||||
|
var avatar_frame_id := ""
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -27,20 +32,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 +61,26 @@ 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.custom_minimum_size = Vector2(0, 40)
|
||||||
|
daily_button.add_theme_font_size_override("font_size", 13)
|
||||||
|
daily_button.pressed.connect(func() -> void: daily_pressed.emit())
|
||||||
|
column.add_child(daily_button)
|
||||||
|
|
||||||
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 +122,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 +137,39 @@ 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("res://art/crumb_head.png")
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
func _refresh_avatar() -> void:
|
||||||
|
if avatar_frame_id == SaveGame.selected_frame():
|
||||||
|
return
|
||||||
|
for child in avatar_holder.get_children():
|
||||||
|
child.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,12 +4,14 @@ 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 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 settings_sheet
|
var settings_sheet
|
||||||
var screens := {}
|
var screens := {}
|
||||||
var current := "home"
|
var current := "home"
|
||||||
@@ -29,6 +31,8 @@ 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"))
|
||||||
|
|
||||||
game = GameScene.instantiate()
|
game = GameScene.instantiate()
|
||||||
_add_screen(game)
|
_add_screen(game)
|
||||||
@@ -44,6 +48,10 @@ 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)
|
||||||
|
|
||||||
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)
|
||||||
@@ -58,6 +66,7 @@ func _ready() -> void:
|
|||||||
"game": game,
|
"game": game,
|
||||||
"guest_book": guest_book,
|
"guest_book": guest_book,
|
||||||
"rules": rulebook,
|
"rules": rulebook,
|
||||||
|
"profile": profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
show_screen("home", false)
|
show_screen("home", false)
|
||||||
@@ -135,3 +144,10 @@ 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)
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
signal back_pressed
|
||||||
|
|
||||||
|
var portrait_holder: CenterContainer
|
||||||
|
var rooms_label: Label
|
||||||
|
var streak_label: Label
|
||||||
|
var best_label: Label
|
||||||
|
var frame_grid: GridContainer
|
||||||
|
var status_label: Label
|
||||||
|
var portrait_frame_id := ""
|
||||||
|
|
||||||
|
|
||||||
|
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("Crumb's 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)
|
||||||
|
|
||||||
|
content.add_child(UI.label("Crumb", 20, Palette.INK, true))
|
||||||
|
content.add_child(UI.label("Innkeeper · always in", 11, Palette.MUTED))
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
content.add_child(UI.heading("Frames", 18))
|
||||||
|
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("Tap an unlocked frame to wear it.", 11, Palette.MUTED)
|
||||||
|
status_label.custom_minimum_size = Vector2(0, 22)
|
||||||
|
content.add_child(status_label)
|
||||||
|
|
||||||
|
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:
|
||||||
|
rooms_label.text = "%d / 30" % SaveGame.rooms_completed()
|
||||||
|
streak_label.text = str(SaveGame.daily_streak())
|
||||||
|
best_label.text = str(SaveGame.best_streak())
|
||||||
|
_build_portrait()
|
||||||
|
_build_frames()
|
||||||
|
|
||||||
|
|
||||||
|
func _build_portrait() -> void:
|
||||||
|
var selected := SaveGame.selected_frame()
|
||||||
|
if portrait_frame_id == selected and portrait_holder.get_child_count() > 0:
|
||||||
|
return
|
||||||
|
for child in portrait_holder.get_children():
|
||||||
|
child.free()
|
||||||
|
var frame := Frames.frame_panel(selected, 118)
|
||||||
|
var head := TextureRect.new()
|
||||||
|
head.texture = load("res://art/crumb_head.png")
|
||||||
|
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_frame_id = selected
|
||||||
|
|
||||||
|
|
||||||
|
func _build_frames() -> void:
|
||||||
|
for child in frame_grid.get_children():
|
||||||
|
child.free()
|
||||||
|
|
||||||
|
var selected := SaveGame.selected_frame()
|
||||||
|
for frame in Frames.all():
|
||||||
|
var id := str(frame.get("id", ""))
|
||||||
|
var unlocked := 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_frame_pressed.bind(id, unlocked))
|
||||||
|
|
||||||
|
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(id, 46)
|
||||||
|
badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
var head := TextureRect.new()
|
||||||
|
head.texture = load("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(frame.get("name", "")), 12)
|
||||||
|
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||||
|
text.add_child(name)
|
||||||
|
|
||||||
|
var detail := ""
|
||||||
|
if id == selected:
|
||||||
|
detail = "Wearing"
|
||||||
|
elif unlocked:
|
||||||
|
detail = "Unlocked"
|
||||||
|
else:
|
||||||
|
detail = Frames.requirement_text(id)
|
||||||
|
var sub := UI.label(detail, 9, 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_frame_pressed(id: String, unlocked: bool) -> void:
|
||||||
|
if not unlocked:
|
||||||
|
status_label.text = "Locked: %s." % Frames.requirement_text(id)
|
||||||
|
status_label.add_theme_color_override("font_color", Palette.RED)
|
||||||
|
return
|
||||||
|
SaveGame.select_frame(id)
|
||||||
|
status_label.text = "Now wearing %s." % str(Frames.by_id(id).get("name", id))
|
||||||
|
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
|
||||||
+89
-7
@@ -23,19 +23,29 @@ func _ready() -> void:
|
|||||||
load_game()
|
load_game()
|
||||||
|
|
||||||
|
|
||||||
|
func _default_daily() -> Dictionary:
|
||||||
|
return {
|
||||||
|
"last_completed": "",
|
||||||
|
"streak": 0,
|
||||||
|
"best_streak": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func _default_data() -> Dictionary:
|
func _default_data() -> Dictionary:
|
||||||
return {
|
return {
|
||||||
"version": 2,
|
"version": 3,
|
||||||
"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",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func load_game() -> void:
|
func load_game() -> void:
|
||||||
data = _default_data()
|
data = _default_data()
|
||||||
var stored_version := 2
|
var stored_version := 3
|
||||||
|
|
||||||
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 +63,34 @@ 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"
|
||||||
|
|
||||||
|
var migrated := false
|
||||||
|
# Version 2 made double-tap the default; version 3 added daily streaks
|
||||||
|
# and profile frames. Both migrations are one-time.
|
||||||
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 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"] = 3
|
||||||
|
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 +153,60 @@ 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)
|
||||||
|
data["daily"] = daily
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func selected_frame() -> String:
|
||||||
|
return str(data.get("profile_frame", "plain"))
|
||||||
|
|
||||||
|
|
||||||
|
func select_frame(id: String) -> void:
|
||||||
|
data["profile_frame"] = id
|
||||||
|
save_game()
|
||||||
|
progress_changed.emit()
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
class_name Version
|
class_name Version
|
||||||
extends RefCounted
|
extends RefCounted
|
||||||
|
|
||||||
const NUMBER := "0.4.3-alpha"
|
const NUMBER := "0.5.0-alpha"
|
||||||
const CODENAME := "Tap Twice"
|
const CODENAME := "Daily Rooms & Frames"
|
||||||
const BUILD_DATE := "2026-12-02"
|
const BUILD_DATE := "2026-12-02"
|
||||||
const BUILD_LABEL := "v0.4.3-alpha · build 2026-12-02"
|
const BUILD_LABEL := "v0.5.0-alpha · build 2026-12-02"
|
||||||
@@ -24,6 +24,11 @@ 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.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")
|
||||||
@@ -48,6 +53,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 +95,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:
|
||||||
|
|||||||
+76
-2
@@ -35,6 +35,7 @@ func _run() -> void:
|
|||||||
|
|
||||||
_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 +108,86 @@ 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:
|
||||||
|
_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"
|
||||||
|
)
|
||||||
|
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 2.
|
||||||
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)) == 3, "fresh saves should be version 3")
|
||||||
_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 +199,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)) == 3, "version 1 saves should migrate to version 3")
|
||||||
_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")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user