diff --git a/README.md b/README.md
index 7879812..0b4b75d 100644
--- a/README.md
+++ b/README.md
@@ -93,7 +93,7 @@ tools/
build_android.ps1 Android export helper
workflows/ Krea2 guest-generation variants
export_presets.cfg Android debug preset
-build/Ratdoku-v0.3.0-alpha.apk installable debug APK
+build/Ratdoku.apk installable debug APK
```
## Save data
@@ -126,13 +126,13 @@ Source 1024 renders and contact sheets live in `art/guests/source/` and are excl
The current APK is:
```
-build/Ratdoku-v0.3.0-alpha.apk
+build/Ratdoku.apk
```
It is a **debug-signed, arm64-v8a** APK:
- Package: `com.ratdoku.game`
-- Version: `0.3.0` (version code 3)
+- Version: `0.2` (version code 1)
- Min SDK: 24 (Android 7.0)
- Target SDK: 36
- Size: about 41 MB
@@ -141,7 +141,7 @@ It is a **debug-signed, arm64-v8a** APK:
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:
```powershell
-& "E:\AndroidTools\sdk\platform-tools\adb.exe" install -r "build\Ratdoku-v0.3.0-alpha.apk"
+& "E:\AndroidTools\sdk\platform-tools\adb.exe" install -r "E:\Ahri\Documents\Ratdoku\Development\build\Ratdoku.apk"
```
### Toolchain
diff --git a/assets/fonts/Fredoka-Variable.ttf b/assets/fonts/Fredoka-Variable.ttf
new file mode 100644
index 0000000..349b6ec
Binary files /dev/null and b/assets/fonts/Fredoka-Variable.ttf differ
diff --git a/assets/fonts/Nunito-Variable.ttf b/assets/fonts/Nunito-Variable.ttf
new file mode 100644
index 0000000..2ec1f4b
Binary files /dev/null and b/assets/fonts/Nunito-Variable.ttf differ
diff --git a/assets/fonts/OFL-Fredoka.txt b/assets/fonts/OFL-Fredoka.txt
new file mode 100644
index 0000000..791a98d
--- /dev/null
+++ b/assets/fonts/OFL-Fredoka.txt
@@ -0,0 +1,93 @@
+Copyright 2016 The Fredoka Project Authors (https://github.com/hafontia/Fredoka-One)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/assets/fonts/OFL-Nunito.txt b/assets/fonts/OFL-Nunito.txt
new file mode 100644
index 0000000..c8210f0
--- /dev/null
+++ b/assets/fonts/OFL-Nunito.txt
@@ -0,0 +1,93 @@
+Copyright 2014 The Nunito Project Authors (https://github.com/googlefonts/nunito)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/assets/icons/arrow-left.svg b/assets/icons/arrow-left.svg
new file mode 100644
index 0000000..b40bff8
--- /dev/null
+++ b/assets/icons/arrow-left.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/bed.svg b/assets/icons/bed.svg
new file mode 100644
index 0000000..492513b
--- /dev/null
+++ b/assets/icons/bed.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/icons/bell.svg b/assets/icons/bell.svg
new file mode 100644
index 0000000..0345ca3
--- /dev/null
+++ b/assets/icons/bell.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/book-open.svg b/assets/icons/book-open.svg
new file mode 100644
index 0000000..7291abe
--- /dev/null
+++ b/assets/icons/book-open.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/chevron-down.svg b/assets/icons/chevron-down.svg
new file mode 100644
index 0000000..e70d30b
--- /dev/null
+++ b/assets/icons/chevron-down.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/icons/fish.svg b/assets/icons/fish.svg
new file mode 100644
index 0000000..f559691
--- /dev/null
+++ b/assets/icons/fish.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/icons/flame.svg b/assets/icons/flame.svg
new file mode 100644
index 0000000..9a77491
--- /dev/null
+++ b/assets/icons/flame.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/icons/key.svg b/assets/icons/key.svg
new file mode 100644
index 0000000..e9e4eab
--- /dev/null
+++ b/assets/icons/key.svg
@@ -0,0 +1,15 @@
+
diff --git a/assets/icons/leaf.svg b/assets/icons/leaf.svg
new file mode 100644
index 0000000..ed40568
--- /dev/null
+++ b/assets/icons/leaf.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/lightbulb.svg b/assets/icons/lightbulb.svg
new file mode 100644
index 0000000..3f4e409
--- /dev/null
+++ b/assets/icons/lightbulb.svg
@@ -0,0 +1,15 @@
+
diff --git a/assets/icons/paw-print.svg b/assets/icons/paw-print.svg
new file mode 100644
index 0000000..01de64e
--- /dev/null
+++ b/assets/icons/paw-print.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/icons/rotate-ccw.svg b/assets/icons/rotate-ccw.svg
new file mode 100644
index 0000000..eb0fe34
--- /dev/null
+++ b/assets/icons/rotate-ccw.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/settings.svg b/assets/icons/settings.svg
new file mode 100644
index 0000000..4c6263a
--- /dev/null
+++ b/assets/icons/settings.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/star.svg b/assets/icons/star.svg
new file mode 100644
index 0000000..e6482ed
--- /dev/null
+++ b/assets/icons/star.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/icons/undo-2.svg b/assets/icons/undo-2.svg
new file mode 100644
index 0000000..b38d9e1
--- /dev/null
+++ b/assets/icons/undo-2.svg
@@ -0,0 +1,14 @@
+
diff --git a/export_presets.cfg b/export_presets.cfg
index d215b25..d7f82bf 100644
--- a/export_presets.cfg
+++ b/export_presets.cfg
@@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources"
include_filter="data/*.json"
exclude_filter="art/guests/source/*"
-export_path="build/Ratdoku-v0.3.0-alpha.apk"
+export_path="build/Ratdoku.apk"
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
@@ -32,8 +32,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
-version/code=3
-version/name="0.3.0"
+version/code=4
+version/name="0.4.0"
package/unique_name="com.ratdoku.game"
package/name="Ratdoku"
package/signed=true
diff --git a/project.godot b/project.godot
index d08da22..1e631ef 100644
--- a/project.godot
+++ b/project.godot
@@ -12,7 +12,7 @@ config_version=5
config/name="Ratdoku"
run/main_scene="res://scenes/Main.tscn"
-config/version="0.3.0-alpha"
+config/version="0.4.0-alpha"
config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.png"
@@ -22,8 +22,8 @@ SaveGame="*res://scripts/SaveGame.gd"
[display]
-window/size/viewport_width=720
-window/size/viewport_height=1280
+window/size/viewport_width=360
+window/size/viewport_height=640
window/size/window_width_override=540
window/size/window_height_override=960
window/stretch/mode="canvas_items"
diff --git a/scenes/SettingsSheet.tscn b/scenes/SettingsSheet.tscn
new file mode 100644
index 0000000..8a173e8
--- /dev/null
+++ b/scenes/SettingsSheet.tscn
@@ -0,0 +1,12 @@
+[gd_scene load_steps=2 format=3]
+
+[ext_resource type="Script" path="res://scripts/SettingsSheet.gd" id="1_settings_sheet"]
+
+[node name="SettingsSheet" 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_settings_sheet")
diff --git a/scripts/Board.gd b/scripts/Board.gd
index 9783efb..833e0f0 100644
--- a/scripts/Board.gd
+++ b/scripts/Board.gd
@@ -37,6 +37,8 @@ var region_rats: Array = []
var region_textures := {}
var rat_texture: Texture2D = null
+var cell_styles: Array = []
+var board_style: StyleBoxFlat
func _ready() -> void:
@@ -45,6 +47,30 @@ func _ready() -> void:
if ResourceLoader.exists("res://art/crumb_head.png"):
rat_texture = load("res://art/crumb_head.png")
+ for color in Palette.REGION_COLORS:
+ var style := StyleBoxFlat.new()
+ style.bg_color = color
+ style.corner_radius_top_left = 7
+ style.corner_radius_top_right = 7
+ style.corner_radius_bottom_left = 7
+ style.corner_radius_bottom_right = 7
+ cell_styles.append(style)
+
+ board_style = StyleBoxFlat.new()
+ board_style.bg_color = Palette.WHITE
+ board_style.corner_radius_top_left = 20
+ board_style.corner_radius_top_right = 20
+ board_style.corner_radius_bottom_left = 20
+ board_style.corner_radius_bottom_right = 20
+ board_style.border_width_left = 3
+ board_style.border_width_right = 3
+ board_style.border_width_top = 3
+ board_style.border_width_bottom = 3
+ board_style.border_color = Palette.WALL
+ board_style.shadow_color = Color(0.29, 0.20, 0.14, 0.14)
+ board_style.shadow_size = 8
+ board_style.shadow_offset = Vector2(0, 4)
+
var save := get_node_or_null("/root/SaveGame")
if save != null:
show_patterns = bool(save.get_setting("patterns"))
@@ -123,54 +149,22 @@ func set_level(level: Dictionary) -> void:
func _draw() -> void:
if regions.size() != n or n <= 0:
return
+ if cell_styles.is_empty() or board_style == null:
+ return
_update_layout()
var side := cell_size * n
var board_rect := Rect2(board_origin, Vector2(side, side))
+ var card_rect := Rect2(board_origin - Vector2(8, 8), Vector2(side + 16, side + 16))
+ draw_style_box(board_style, card_rect)
- # Soft drop shadow
- draw_rect(Rect2(board_rect.position + Vector2(5, 8), board_rect.size), Color(0.29, 0.20, 0.14, 0.10))
-
- # Room fills and patterns
+ # Rounded tiles with small gaps. The gaps and colours define the rooms.
for r in n:
for c in n:
- var rect := _cell_rect(r, c)
var region := int(regions[r][c])
- var color: Color = Palette.REGION_COLORS[region % Palette.REGION_COLORS.size()]
- draw_rect(rect.grow(0.6), color)
- _draw_pattern(rect, region)
-
- # Hairline grid
- for i in range(n + 1):
- var x := board_origin.x + i * cell_size
- var y := board_origin.y + i * cell_size
- draw_line(Vector2(x, board_origin.y), Vector2(x, board_origin.y + side), Palette.GRID, 1.0, true)
- draw_line(Vector2(board_origin.x, y), Vector2(board_origin.x + side, y), Palette.GRID, 1.0, true)
-
- # Thick walls between rooms
- var wall_width: float = max(3.0, cell_size * 0.07)
- for r in n:
- for c in n:
- var rect := _cell_rect(r, c)
- if c == n - 1 or int(regions[r][c]) != int(regions[r][c + 1]):
- draw_line(
- rect.position + Vector2(cell_size, 0),
- rect.position + Vector2(cell_size, cell_size),
- Palette.WALL,
- wall_width,
- true
- )
- if r == n - 1 or int(regions[r][c]) != int(regions[r + 1][c]):
- draw_line(
- rect.position + Vector2(0, cell_size),
- rect.position + Vector2(cell_size, cell_size),
- Palette.WALL,
- wall_width,
- true
- )
-
- # Outer frame
- draw_rect(board_rect, Palette.WALL, false, wall_width + 1.0, true)
+ var tile := _cell_rect(r, c).grow(-1.6)
+ draw_style_box(cell_styles[region % cell_styles.size()], tile)
+ _draw_pattern(tile, region)
# Marks and rats
for r in n:
@@ -179,9 +173,9 @@ func _draw() -> void:
if value == RAT:
_draw_rat(Vector2i(r, c))
elif value == X:
- _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.62))
+ _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.60))
elif auto_x[r][c]:
- _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.28))
+ _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.24))
# Soft red ring around any rat that breaks a rule.
for cell in conflict_cells:
@@ -196,7 +190,7 @@ func _draw() -> void:
func _update_layout() -> void:
- var side: float = min(size.x, size.y) - 12.0
+ var side: float = min(size.x, size.y) - 16.0
side = max(0.0, side)
cell_size = side / float(n)
board_origin = (size - Vector2(side, side)) * 0.5
@@ -212,30 +206,76 @@ func _cell_rect(r: int, c: int) -> Rect2:
func _draw_pattern(rect: Rect2, region: int) -> void:
if not show_patterns:
return
- var pattern := region % 5
- var tint := Color(0.29, 0.20, 0.14, 0.09)
var s := rect.size.x
+ var motif := region % 8
+ var tint := Color(0.25, 0.16, 0.10, 0.18)
+ var base: Color = Palette.REGION_COLORS[region % Palette.REGION_COLORS.size()]
+ for p in [Vector2(0.30, 0.30), Vector2(0.70, 0.70)]:
+ _draw_motif(rect.position + p * s, s * 0.24, motif, tint, base)
- if pattern == 0:
- for i in range(3):
- for j in range(3):
- var p := rect.position + Vector2((i + 0.5) * s / 3.0, (j + 0.5) * s / 3.0)
- draw_circle(p, max(1.0, s * 0.018), tint)
- elif pattern == 1:
- for i in [0.33, 0.66]:
- draw_line(rect.position + Vector2(0, s * i), rect.position + Vector2(s, s * i), tint, max(1.0, s * 0.012), true)
- elif pattern == 2:
- for i in [0.33, 0.66]:
- draw_line(rect.position + Vector2(s * i, 0), rect.position + Vector2(s * i, s), tint, max(1.0, s * 0.012), true)
- elif pattern == 3:
- for i in [0.33, 0.66]:
- draw_line(rect.position + Vector2(0, s * i), rect.position + Vector2(s, s * i), tint, max(1.0, s * 0.010), true)
- draw_line(rect.position + Vector2(0, s * (1.0 - i)), rect.position + Vector2(s, s * (1.0 - i)), tint, max(1.0, s * 0.010), true)
- else:
- for i in range(2):
- for j in range(2):
- var p := rect.position + Vector2((i + 0.5) * s / 2.0, (j + 0.5) * s / 2.0)
- draw_circle(p, max(1.5, s * 0.034), tint)
+
+func _draw_motif(center: Vector2, size: float, motif: int, tint: Color, base: Color) -> void:
+ match motif:
+ 0:
+ # Paw print
+ draw_circle(center + Vector2(0, 0.16) * size, size * 0.30, tint)
+ for off in [Vector2(-0.32, -0.18), Vector2(-0.16, -0.34), Vector2(0.16, -0.34), Vector2(0.32, -0.18)]:
+ draw_circle(center + off * size, size * 0.15, tint)
+ 1:
+ # Cheese wedge
+ var tri := PackedVector2Array([
+ center + Vector2(-0.48, -0.30) * size,
+ center + Vector2(0.48, -0.30) * size,
+ center + Vector2(0.0, 0.48) * size,
+ ])
+ draw_colored_polygon(tri, tint)
+ draw_circle(center + Vector2(-0.14, 0.02) * size, size * 0.075, base)
+ draw_circle(center + Vector2(0.14, 0.16) * size, size * 0.05, base)
+ 2:
+ # Key
+ draw_circle(center + Vector2(0, -0.34) * size, size * 0.17, tint)
+ draw_circle(center + Vector2(0, -0.34) * size, size * 0.07, base)
+ draw_rect(Rect2(center + Vector2(-0.05, -0.18) * size, Vector2(0.10, 0.55) * size), tint)
+ draw_rect(Rect2(center + Vector2(0.03, 0.20) * size, Vector2(0.22, 0.08) * size), tint)
+ 3:
+ # Bed
+ draw_rect(Rect2(center + Vector2(-0.46, -0.10) * size, Vector2(0.92, 0.34) * size), tint)
+ draw_rect(Rect2(center + Vector2(-0.46, -0.28) * size, Vector2(0.28, 0.18) * size), tint)
+ draw_line(center + Vector2(-0.46, 0.30) * size, center + Vector2(0.46, 0.30) * size, tint, size * 0.08, true)
+ 4:
+ # Bell
+ draw_arc(center + Vector2(0, 0.04) * size, size * 0.31, PI, TAU, 14, tint, size * 0.15, true)
+ draw_line(center + Vector2(-0.31, 0.04) * size, center + Vector2(0.31, 0.04) * size, tint, size * 0.12, true)
+ draw_circle(center + Vector2(0, 0.36) * size, size * 0.08, tint)
+ 5:
+ # Leaf
+ var leaf := PackedVector2Array()
+ for i in range(10):
+ var ang := TAU * i / 10.0
+ leaf.append(center + Vector2(cos(ang) * 0.34, sin(ang) * 0.48) * size)
+ draw_colored_polygon(leaf, tint)
+ draw_line(center + Vector2(-0.24, 0.30) * size, center + Vector2(0.24, -0.30) * size, tint, size * 0.05, true)
+ 6:
+ # Fish
+ var body := PackedVector2Array()
+ for i in range(8):
+ var ang := TAU * i / 8.0
+ body.append(center + Vector2(cos(ang) * 0.40, sin(ang) * 0.24) * size)
+ draw_colored_polygon(body, tint)
+ draw_colored_polygon(PackedVector2Array([
+ center + Vector2(-0.34, 0) * size,
+ center + Vector2(-0.58, -0.22) * size,
+ center + Vector2(-0.58, 0.22) * size,
+ ]), tint)
+ draw_circle(center + Vector2(0.22, -0.04) * size, size * 0.05, base)
+ 7:
+ # Star
+ var star := PackedVector2Array()
+ for i in range(10):
+ var ang := -PI * 0.5 + TAU * i / 10.0
+ var radius := 0.48 if i % 2 == 0 else 0.22
+ star.append(center + Vector2(cos(ang), sin(ang)) * radius * size)
+ draw_colored_polygon(star, tint)
func _draw_x(rect: Rect2, color: Color) -> void:
diff --git a/scripts/Game.gd b/scripts/Game.gd
index 327f67b..b84e853 100644
--- a/scripts/Game.gd
+++ b/scripts/Game.gd
@@ -2,9 +2,10 @@ extends Control
signal back_pressed
signal guest_book_pressed
+signal settings_pressed
const BoardScene = preload("res://scenes/Board.tscn")
-const DEFAULT_STATUS := "One guest per room, floor and corridor.\nTap = X · Hold or right-click = check in."
+const DEFAULT_STATUS := "One guest per room, row and column."
var levels: Array = []
var level_index := 0
@@ -12,13 +13,18 @@ var started_at := 0
var elapsed_ms := 0
var win_shown := false
var current_level_id := ""
+var ui_paused := false
var board: Board
var level_label: Label
+var guest_label: Label
var timer_label: Label
var status_label: Label
var win_detail: Label
var overlay: ColorRect
+var rule_strip: HBoxContainer
+var legend_row: HBoxContainer
+var legend_chips: Array = []
var new_guest_box: HBoxContainer
var new_guest_label: Label
var new_guest_portrait: TextureRect
@@ -33,40 +39,66 @@ func _ready() -> void:
func _build_ui() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
- margin.add_theme_constant_override("margin_left", 20)
- margin.add_theme_constant_override("margin_right", 20)
- margin.add_theme_constant_override("margin_top", 18)
- margin.add_theme_constant_override("margin_bottom", 18)
+ margin.add_theme_constant_override("margin_left", 12)
+ margin.add_theme_constant_override("margin_right", 12)
+ margin.add_theme_constant_override("margin_top", 10)
+ margin.add_theme_constant_override("margin_bottom", 10)
add_child(margin)
var column := VBoxContainer.new()
- column.add_theme_constant_override("separation", 10)
+ column.add_theme_constant_override("separation", 6)
margin.add_child(column)
# Top bar
var top := HBoxContainer.new()
- top.add_theme_constant_override("separation", 10)
+ top.add_theme_constant_override("separation", 8)
column.add_child(top)
- var back := UI.button("‹", false, 44)
- back.custom_minimum_size = Vector2(48, 44)
- back.add_theme_font_size_override("font_size", 30)
+ var back := UI.round_button("res://assets/icons/arrow-left.svg", 44)
back.pressed.connect(_on_back)
top.add_child(back)
- level_label = UI.label("Room 1", 20, Palette.MUTED)
- level_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
- level_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- top.add_child(level_label)
+ var center := VBoxContainer.new()
+ center.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ center.add_theme_constant_override("separation", 0)
+ top.add_child(center)
- timer_label = UI.label("00:00", 18, Palette.MUTED)
- timer_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
- timer_label.custom_minimum_size = Vector2(72, 0)
- top.add_child(timer_label)
+ level_label = UI.label("Room 1", 18)
+ center.add_child(level_label)
+
+ var sub := HBoxContainer.new()
+ sub.alignment = BoxContainer.ALIGNMENT_CENTER
+ sub.add_theme_constant_override("separation", 8)
+ center.add_child(sub)
+
+ guest_label = UI.label("0 / 8", 11, Palette.MUTED)
+ sub.add_child(guest_label)
+
+ timer_label = UI.label("00:00", 11, Palette.MUTED)
+ sub.add_child(timer_label)
+
+ var gear := UI.round_button("res://assets/icons/settings.svg", 44)
+ gear.pressed.connect(func() -> void: settings_pressed.emit())
+ top.add_child(gear)
+
+ # Rule chips, first three rooms
+ rule_strip = HBoxContainer.new()
+ rule_strip.alignment = BoxContainer.ALIGNMENT_CENTER
+ rule_strip.add_theme_constant_override("separation", 4)
+ column.add_child(rule_strip)
+ rule_strip.add_child(_rule_chip("1 per room", "region"))
+ rule_strip.add_child(_rule_chip("1 per row/col", "row"))
+ rule_strip.add_child(_rule_chip("No touching", "touch"))
+
+ # Room legend: one guest per colour
+ legend_row = HBoxContainer.new()
+ legend_row.alignment = BoxContainer.ALIGNMENT_CENTER
+ legend_row.add_theme_constant_override("separation", 3)
+ column.add_child(legend_row)
# Board
board = BoardScene.instantiate() as Board
- board.custom_minimum_size = Vector2(320, 320)
+ board.custom_minimum_size = Vector2(300, 300)
board.size_flags_horizontal = Control.SIZE_EXPAND_FILL
board.size_flags_vertical = Control.SIZE_EXPAND_FILL
board.changed.connect(_on_board_changed)
@@ -75,34 +107,50 @@ func _build_ui() -> void:
column.add_child(board)
# Status
- status_label = UI.label(DEFAULT_STATUS, 17, Palette.MUTED)
- status_label.custom_minimum_size = Vector2(0, 56)
- status_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ status_label = UI.label(DEFAULT_STATUS, 12, Palette.MUTED)
+ status_label.custom_minimum_size = Vector2(0, 26)
column.add_child(status_label)
- # Bottom actions
+ # Actions
var actions := HBoxContainer.new()
actions.add_theme_constant_override("separation", 8)
column.add_child(actions)
- var undo := UI.button("Undo", false, 52)
+ var undo := UI.button("Undo", false, 48)
undo.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ undo.add_theme_font_size_override("font_size", 17)
undo.pressed.connect(_on_undo)
actions.add_child(undo)
- var restart := UI.button("Restart", false, 52)
- restart.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- restart.pressed.connect(_on_restart)
- actions.add_child(restart)
-
- var hint := UI.button("Hint", true, 52)
+ var hint := UI.button("Hint", true, 48)
hint.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ hint.add_theme_font_size_override("font_size", 17)
hint.pressed.connect(_on_hint)
actions.add_child(hint)
_build_win_overlay()
+func _rule_chip(text: String, mode: String) -> PanelContainer:
+ var panel := UI.panel(Palette.PAPER, 12, 5)
+ panel.custom_minimum_size = Vector2(102, 42)
+ var row := HBoxContainer.new()
+ row.add_theme_constant_override("separation", 3)
+ panel.add_child(row)
+
+ var diagram := MiniDiagram.new()
+ diagram.mode = mode
+ diagram.custom_minimum_size = Vector2(30, 30)
+ row.add_child(diagram)
+
+ var label := UI.label(text, 9, Palette.MUTED)
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ label.custom_minimum_size = Vector2(58, 0)
+ row.add_child(label)
+
+ return panel
+
+
func _build_win_overlay() -> void:
overlay = ColorRect.new()
overlay.color = Color(0.18, 0.12, 0.08, 0.48)
@@ -115,48 +163,49 @@ func _build_win_overlay() -> void:
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
overlay.add_child(center)
- var panel := UI.panel(Palette.CREAM, 34, 28)
- panel.custom_minimum_size = Vector2(420, 0)
+ var panel := UI.panel(Palette.CREAM, 26, 18)
+ panel.custom_minimum_size = Vector2(320, 0)
center.add_child(panel)
var box := VBoxContainer.new()
- box.add_theme_constant_override("separation", 10)
+ box.add_theme_constant_override("separation", 6)
panel.add_child(box)
var portrait_center := CenterContainer.new()
box.add_child(portrait_center)
var portrait := _make_win_portrait()
- portrait.custom_minimum_size = Vector2(170, 170)
+ portrait.custom_minimum_size = Vector2(110, 110)
portrait_center.add_child(portrait)
- box.add_child(UI.label("Everyone checked in!", 34))
- win_detail = UI.label("Room 1 · 00:00", 18, Palette.MUTED)
+ box.add_child(UI.heading("Everyone checked in!", 26))
+ win_detail = UI.label("Room 1 · 00:00", 13, Palette.MUTED)
box.add_child(win_detail)
- box.add_child(UI.label("Sweet dreams, little guests.", 18, Palette.MUTED))
+ box.add_child(UI.label("Sweet dreams, little guests.", 12, Palette.MUTED))
new_guest_box = HBoxContainer.new()
new_guest_box.alignment = BoxContainer.ALIGNMENT_CENTER
- new_guest_box.add_theme_constant_override("separation", 8)
+ new_guest_box.add_theme_constant_override("separation", 6)
new_guest_box.visible = false
box.add_child(new_guest_box)
new_guest_portrait = TextureRect.new()
- new_guest_portrait.custom_minimum_size = Vector2(64, 64)
+ new_guest_portrait.custom_minimum_size = Vector2(42, 42)
new_guest_portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
new_guest_portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
new_guest_box.add_child(new_guest_portrait)
- new_guest_label = UI.label("", 14, Palette.INK)
- new_guest_label.custom_minimum_size = Vector2(250, 0)
+ new_guest_label = UI.label("", 11, Palette.INK)
+ new_guest_label.custom_minimum_size = Vector2(190, 0)
new_guest_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- new_guest_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
new_guest_box.add_child(new_guest_label)
- var next := UI.button("Next room", true, 56)
+ var next := UI.button("Next room", true, 48)
+ next.add_theme_font_size_override("font_size", 17)
box.add_child(next)
next.pressed.connect(_on_next)
- var book := UI.button("Guest Book", false, 46)
+ var book := UI.button("Guest Book", false, 42)
+ book.add_theme_font_size_override("font_size", 15)
box.add_child(book)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
@@ -173,7 +222,7 @@ func _make_win_portrait() -> Control:
func start_level(index: int) -> void:
if levels.is_empty():
- status_label.text = "No rooms yet — run tools/generate_levels.gd in Godot."
+ status_label.text = "No rooms yet."
status_label.add_theme_color_override("font_color", Palette.RED)
return
@@ -182,22 +231,84 @@ func start_level(index: int) -> void:
current_level_id = str(level.get("id", ""))
board.set_level(level)
- level_label.text = "Room %d of %d" % [level_index + 1, levels.size()]
+ level_label.text = "Room %d" % (level_index + 1)
started_at = Time.get_ticks_msec()
elapsed_ms = 0
win_shown = false
overlay.visible = false
new_guest_box.visible = false
- if level.get("clues", []).size() > 0:
- status_label.text = "Gold-ringed guests are already checked in.\nTap = X · Hold or right-click = check in."
- else:
- status_label.text = DEFAULT_STATUS
+ rule_strip.visible = level_index < 3
+ 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)
+ _refresh_legend()
+ _update_guest_count()
+
+
+func _refresh_legend() -> void:
+ for child in legend_row.get_children():
+ child.free()
+ legend_chips.clear()
+ if board.region_rats.is_empty():
+ return
+
+ for region in range(board.n):
+ var id := str(board.region_rats[region])
+ var color: Color = Palette.REGION_COLORS[region % Palette.REGION_COLORS.size()]
+ var chip := PanelContainer.new()
+ chip.custom_minimum_size = Vector2(32, 32)
+ var style := StyleBoxFlat.new()
+ style.bg_color = color
+ style.corner_radius_top_left = 9
+ style.corner_radius_top_right = 9
+ style.corner_radius_bottom_left = 9
+ style.corner_radius_bottom_right = 9
+ style.border_width_left = 1
+ style.border_width_right = 1
+ style.border_width_top = 1
+ style.border_width_bottom = 1
+ style.border_color = Color(1, 1, 1, 0.55)
+ chip.add_theme_stylebox_override("panel", style)
+ chip.tooltip_text = str(Guests.by_id(id).get("name", id))
+ legend_row.add_child(chip)
+
+ var texture := TextureRect.new()
+ texture.texture = board.region_textures.get(region)
+ texture.custom_minimum_size = Vector2(28, 28)
+ texture.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
+ texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
+ texture.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ chip.add_child(texture)
+
+ legend_chips.append(chip)
+
+
+func _update_legend() -> void:
+ for region in range(legend_chips.size()):
+ var chip := legend_chips[region]
+ var solved := false
+ for r in board.n:
+ for c in board.n:
+ if int(board.cells[r][c]) == Board.RAT and int(board.regions[r][c]) == region:
+ solved = true
+ break
+ if solved:
+ break
+ var style: StyleBoxFlat = chip.get_theme_stylebox("panel")
+ if style != null:
+ style.border_color = Palette.GOLD if solved else Color(1, 1, 1, 0.55)
+ style.border_width_left = 3 if solved else 1
+ style.border_width_right = 3 if solved else 1
+ style.border_width_top = 3 if solved else 1
+ style.border_width_bottom = 3 if solved else 1
+
+
+func _update_guest_count() -> void:
+ guest_label.text = "%d / %d guests" % [Rules.count_rats(board.cells), board.n]
func _process(_delta: float) -> void:
timer_label.visible = bool(SaveGame.get_setting("show_timer"))
- if not visible or win_shown or started_at == 0:
+ if ui_paused or not visible or win_shown or started_at == 0:
return
elapsed_ms = Time.get_ticks_msec() - started_at
timer_label.text = _format_time(elapsed_ms)
@@ -210,15 +321,25 @@ func _format_time(ms: int) -> String:
return "%02d:%02d" % [minutes, seconds]
+func set_ui_paused(value: bool) -> void:
+ ui_paused = value
+
+
+func restart_room() -> void:
+ start_level(level_index)
+
+
func _on_board_changed() -> void:
if win_shown:
return
status_label.text = DEFAULT_STATUS
status_label.add_theme_color_override("font_color", Palette.MUTED)
+ _update_guest_count()
+ _update_legend()
func _on_mistake() -> void:
- status_label.text = "That room's already taken — undo or try another."
+ status_label.text = "That room's taken — undo or try again."
status_label.add_theme_color_override("font_color", Palette.RED)
@@ -229,6 +350,7 @@ func _on_solved() -> void:
status_label.text = "Everyone checked in."
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()
var unlocked_id := SaveGame.complete_room(current_level_id, level_index + 1)
if unlocked_id != "":
@@ -250,22 +372,14 @@ func _on_undo() -> void:
board.undo()
-func _on_restart() -> void:
- win_shown = false
- overlay.visible = false
- started_at = Time.get_ticks_msec()
- elapsed_ms = 0
- board.restart()
-
-
func _on_hint() -> void:
if board.hint():
if not win_shown:
- status_label.text = "Crumb found a guest who was waiting."
+ status_label.text = "Crumb found a guest."
status_label.add_theme_color_override("font_color", Palette.MUTED)
else:
if not win_shown:
- status_label.text = "Every guest is already checked in."
+ status_label.text = "Everyone is already checked in."
status_label.add_theme_color_override("font_color", Palette.MUTED)
diff --git a/scripts/GuestBook.gd b/scripts/GuestBook.gd
index e29e3a5..b586a34 100644
--- a/scripts/GuestBook.gd
+++ b/scripts/GuestBook.gd
@@ -18,43 +18,39 @@ var detail_status: Label
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
- margin.add_theme_constant_override("margin_left", 20)
- margin.add_theme_constant_override("margin_right", 20)
- margin.add_theme_constant_override("margin_top", 16)
- margin.add_theme_constant_override("margin_bottom", 16)
+ margin.add_theme_constant_override("margin_left", 12)
+ margin.add_theme_constant_override("margin_right", 12)
+ margin.add_theme_constant_override("margin_top", 8)
+ margin.add_theme_constant_override("margin_bottom", 10)
add_child(margin)
var column := VBoxContainer.new()
- column.add_theme_constant_override("separation", 10)
+ column.add_theme_constant_override("separation", 6)
margin.add_child(column)
var top := HBoxContainer.new()
- top.add_theme_constant_override("separation", 10)
+ top.add_theme_constant_override("separation", 6)
column.add_child(top)
- var back := UI.button("‹", false, 44)
- back.custom_minimum_size = Vector2(48, 44)
- back.add_theme_font_size_override("font_size", 30)
+ 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("The Guest Book", 30)
+ var title := UI.label("The Guest Book", 22)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title)
- progress_label = UI.label("5 of 25 checked in", 15, Palette.MUTED)
+ progress_label = UI.label("5 of 25", 10, Palette.MUTED)
progress_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
progress_label.autowrap_mode = TextServer.AUTOWRAP_OFF
- progress_label.custom_minimum_size = Vector2(150, 0)
- progress_label.size_flags_horizontal = Control.SIZE_SHRINK_END
+ progress_label.custom_minimum_size = Vector2(70, 0)
top.add_child(progress_label)
- var crumb := _make_crumb_card()
- column.add_child(crumb)
+ column.add_child(_make_crumb_card())
- status_label = UI.label("Tap a guest to read their card.", 14, Palette.MUTED)
- status_label.custom_minimum_size = Vector2(0, 28)
+ status_label = UI.label("Tap a guest to read their card.", 10, Palette.MUTED)
+ status_label.custom_minimum_size = Vector2(0, 20)
column.add_child(status_label)
var scroll := ScrollContainer.new()
@@ -66,8 +62,8 @@ func _ready() -> void:
grid = GridContainer.new()
grid.columns = 3
grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- grid.add_theme_constant_override("h_separation", 8)
- grid.add_theme_constant_override("v_separation", 8)
+ grid.add_theme_constant_override("h_separation", 5)
+ grid.add_theme_constant_override("v_separation", 5)
scroll.add_child(grid)
_build_detail()
@@ -77,31 +73,30 @@ func _ready() -> void:
func _make_crumb_card() -> PanelContainer:
- var panel := UI.panel(Palette.PAPER, 20, 12)
+ var panel := UI.panel(Palette.PAPER, 14, 8)
var row := HBoxContainer.new()
- row.add_theme_constant_override("separation", 12)
+ row.add_theme_constant_override("separation", 8)
panel.add_child(row)
var portrait := TextureRect.new()
- portrait.custom_minimum_size = Vector2(86, 86)
+ portrait.custom_minimum_size = Vector2(50, 50)
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
if ResourceLoader.exists("res://art/crumb_head.png"):
portrait.texture = load("res://art/crumb_head.png")
- elif ResourceLoader.exists("res://art/crumb.png"):
- portrait.texture = load("res://art/crumb.png")
row.add_child(portrait)
var text := VBoxContainer.new()
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
text.alignment = BoxContainer.ALIGNMENT_CENTER
+ text.add_theme_constant_override("separation", 0)
row.add_child(text)
- var name := UI.label("Crumb", 22)
+ var name := UI.label("Crumb", 16)
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(name)
- var role := UI.label("Innkeeper · always in", 14, Palette.MUTED)
+ var role := UI.label("Innkeeper · always in", 10, Palette.MUTED)
role.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(role)
@@ -116,7 +111,7 @@ func refresh() -> void:
var guests := Guests.all()
var unlocked := SaveGame.unlocked_count(guests)
- progress_label.text = "%d of %d checked in" % [unlocked, guests.size()]
+ progress_label.text = "%d/%d" % [unlocked, guests.size()]
for guest in guests:
grid.add_child(_make_card(guest))
@@ -127,20 +122,20 @@ func _make_card(guest: Dictionary) -> PanelContainer:
var locked := not SaveGame.is_guest_unlocked(id)
var accent := Color(str(guest.get("accent", "#8c7460")))
- var panel := UI.panel(Palette.PAPER, 18, 8)
- panel.custom_minimum_size = Vector2(188, 224)
+ var panel := UI.panel(Palette.PAPER, 12, 5)
+ panel.custom_minimum_size = Vector2(105, 148)
panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
panel.mouse_filter = Control.MOUSE_FILTER_STOP
panel.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
panel.gui_input.connect(_on_card_input.bind(guest, locked))
var box := VBoxContainer.new()
- box.add_theme_constant_override("separation", 2)
+ box.add_theme_constant_override("separation", 1)
box.mouse_filter = Control.MOUSE_FILTER_IGNORE
panel.add_child(box)
var portrait := Control.new()
- portrait.custom_minimum_size = Vector2(170, 170)
+ portrait.custom_minimum_size = Vector2(94, 96)
portrait.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(portrait)
@@ -153,25 +148,25 @@ func _make_card(guest: Dictionary) -> PanelContainer:
portrait.add_child(texture)
if locked:
- texture.modulate = Color(1.0, 1.0, 1.0, 0.18)
+ texture.modulate = Color(1, 1, 1, 0.18)
var veil := ColorRect.new()
veil.color = Color(0.98, 0.93, 0.84, 0.78)
veil.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
veil.mouse_filter = Control.MOUSE_FILTER_IGNORE
portrait.add_child(veil)
- var mystery := UI.label("???", 34, Palette.INK)
+ var mystery := UI.label("???", 22, Palette.INK)
mystery.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
mystery.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
mystery.mouse_filter = Control.MOUSE_FILTER_IGNORE
portrait.add_child(mystery)
- var name_label := UI.label("???" if locked else str(guest["name"]), 17)
+ var name_label := UI.label("???" if locked else str(guest["name"]), 12)
name_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(name_label)
var role_text := "Room %d" % int(guest.get("unlock_room", 0)) if locked else str(guest["role"])
- var role_label := UI.label(role_text, 13, Palette.MUTED if locked else accent)
+ var role_label := UI.label(role_text, 9, Palette.MUTED if locked else accent)
role_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(role_label)
@@ -203,37 +198,38 @@ func _build_detail() -> void:
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
detail_layer.add_child(center)
- var panel := UI.panel(Palette.CREAM, 32, 24)
- panel.custom_minimum_size = Vector2(420, 0)
+ var panel := UI.panel(Palette.CREAM, 24, 16)
+ panel.custom_minimum_size = Vector2(320, 0)
center.add_child(panel)
var box := VBoxContainer.new()
- box.add_theme_constant_override("separation", 8)
+ box.add_theme_constant_override("separation", 4)
panel.add_child(box)
detail_portrait = TextureRect.new()
- detail_portrait.custom_minimum_size = Vector2(300, 300)
+ detail_portrait.custom_minimum_size = Vector2(180, 180)
detail_portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
detail_portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
box.add_child(detail_portrait)
- detail_name = UI.label("Name", 30)
+ detail_name = UI.heading("Name", 22)
box.add_child(detail_name)
- detail_role = UI.label("Role", 18, Palette.MUTED)
+ detail_role = UI.label("Role", 13, Palette.MUTED)
box.add_child(detail_role)
- detail_meta = UI.label("Variety", 15, Palette.MUTED)
+ detail_meta = UI.label("Variety", 11, Palette.MUTED)
box.add_child(detail_meta)
- detail_bio = UI.label("", 17)
- detail_bio.custom_minimum_size = Vector2(0, 52)
+ detail_bio = UI.label("", 12)
+ detail_bio.custom_minimum_size = Vector2(0, 38)
box.add_child(detail_bio)
- detail_snack = UI.label("", 15, Palette.MUTED)
+ detail_snack = UI.label("", 11, Palette.MUTED)
box.add_child(detail_snack)
- detail_status = UI.label("", 14, Palette.MUTED)
+ detail_status = UI.label("", 10, Palette.MUTED)
box.add_child(detail_status)
- var close := UI.button("Close", false, 50)
+ var close := UI.button("Close", false, 44)
+ close.add_theme_font_size_override("font_size", 16)
close.pressed.connect(func() -> void: detail_layer.visible = false)
box.add_child(close)
diff --git a/scripts/Home.gd b/scripts/Home.gd
index 6235b81..20a8d5c 100644
--- a/scripts/Home.gd
+++ b/scripts/Home.gd
@@ -5,79 +5,125 @@ signal guest_book_pressed
signal settings_pressed
signal rules_pressed
+var progress_pill: Button
+var primary: Button
+
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
- margin.add_theme_constant_override("margin_left", 28)
- margin.add_theme_constant_override("margin_right", 28)
- margin.add_theme_constant_override("margin_top", 28)
- margin.add_theme_constant_override("margin_bottom", 28)
+ margin.add_theme_constant_override("margin_left", UI.MARGIN)
+ margin.add_theme_constant_override("margin_right", UI.MARGIN)
+ margin.add_theme_constant_override("margin_top", 12)
+ margin.add_theme_constant_override("margin_bottom", 14)
add_child(margin)
var column := VBoxContainer.new()
- column.alignment = BoxContainer.ALIGNMENT_CENTER
- column.add_theme_constant_override("separation", 10)
+ column.add_theme_constant_override("separation", 6)
margin.add_child(column)
- column.add_child(UI.label("Ratdoku", 68))
- column.add_child(UI.label("A cozy rat hotel puzzle", 24, Palette.MUTED))
+ var hub := HBoxContainer.new()
+ hub.add_theme_constant_override("separation", 8)
+ column.add_child(hub)
- var gap := Control.new()
- gap.custom_minimum_size = Vector2(0, 14)
- column.add_child(gap)
+ 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.tooltip_text = "Guest Book"
+ avatar.pressed.connect(func() -> void: guest_book_pressed.emit())
+ hub.add_child(avatar)
- var portrait_center := CenterContainer.new()
- column.add_child(portrait_center)
- var card := UI.panel(Palette.CREAM, 40, 18)
- card.custom_minimum_size = Vector2(340, 340)
- portrait_center.add_child(card)
+ var left_space := Control.new()
+ left_space.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ left_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ hub.add_child(left_space)
+ progress_pill = UI.button("5 / 25 guests", false, 38)
+ progress_pill.custom_minimum_size = Vector2(130, 38)
+ progress_pill.add_theme_font_size_override("font_size", 13)
+ progress_pill.pressed.connect(func() -> void: guest_book_pressed.emit())
+ hub.add_child(progress_pill)
+
+ var right_space := Control.new()
+ right_space.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ right_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ hub.add_child(right_space)
+
+ var settings := UI.round_button("res://assets/icons/settings.svg", 48)
+ settings.tooltip_text = "Settings"
+ settings.pressed.connect(func() -> void: settings_pressed.emit())
+ hub.add_child(settings)
+
+ column.add_child(UI.spacer(4))
+ column.add_child(UI.heading("Ratdoku", 46))
+ column.add_child(UI.label("A cozy rat hotel puzzle", 15, Palette.MUTED))
+
+ var top_space := Control.new()
+ top_space.size_flags_vertical = Control.SIZE_EXPAND_FILL
+ top_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ column.add_child(top_space)
+
+ var card := UI.panel(Palette.CREAM, 26, 12)
+ card.custom_minimum_size = Vector2(224, 224)
+ card.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
var mascot := _make_mascot()
- mascot.custom_minimum_size = Vector2(300, 300)
+ mascot.custom_minimum_size = Vector2(200, 200)
card.add_child(mascot)
+ column.add_child(card)
- column.add_child(UI.label("Crumb, innkeeper", 16, Palette.MUTED))
- column.add_child(UI.label("Every guest gets a room of their own.", 20))
- column.add_child(UI.label("Tap = X · Hold or right-click = check in", 16, 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))
+ column.add_child(UI.label("Tap = X · Hold or right-click = check in", 11, Palette.MUTED))
- var gap2 := Control.new()
- gap2.custom_minimum_size = Vector2(0, 10)
- column.add_child(gap2)
+ var bottom_space := Control.new()
+ bottom_space.size_flags_vertical = Control.SIZE_EXPAND_FILL
+ bottom_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ column.add_child(bottom_space)
- var play := UI.button("Check in", true, 64)
- play.custom_minimum_size = Vector2(280, 64)
- var play_center := CenterContainer.new()
- play_center.add_child(play)
- column.add_child(play_center)
- play.pressed.connect(func() -> void: play_pressed.emit())
+ primary = UI.button("Check in", true, 54)
+ primary.custom_minimum_size = Vector2(300, 54)
+ primary.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
+ primary.pressed.connect(func() -> void: play_pressed.emit())
+ column.add_child(primary)
var secondary := HBoxContainer.new()
secondary.alignment = BoxContainer.ALIGNMENT_CENTER
- secondary.add_theme_constant_override("separation", 10)
+ secondary.add_theme_constant_override("separation", 8)
column.add_child(secondary)
- var book := UI.button("Guest Book", false, 52)
- book.custom_minimum_size = Vector2(150, 52)
+ var book := UI.button("Guest Book", false, 46)
+ book.custom_minimum_size = Vector2(146, 46)
+ book.add_theme_font_size_override("font_size", 15)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
secondary.add_child(book)
- var rules := UI.button("House Rules", false, 52)
- rules.custom_minimum_size = Vector2(160, 52)
+ var rules := UI.button("House Rules", false, 46)
+ rules.custom_minimum_size = Vector2(146, 46)
+ rules.add_theme_font_size_override("font_size", 15)
rules.pressed.connect(func() -> void: rules_pressed.emit())
secondary.add_child(rules)
- column.add_child(UI.label("No ads. No lives. Just rats.", 16, Palette.MUTED))
+ column.add_child(UI.label("No ads. No lives. Just rats.", 10, Palette.MUTED))
+ column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
- var settings := UI.button("Settings", false, 40)
- settings.add_theme_font_size_override("font_size", 16)
- settings.set_anchors_preset(Control.PRESET_TOP_RIGHT)
- settings.offset_left = -150
- settings.offset_top = 24
- settings.offset_right = -24
- settings.offset_bottom = 64
- settings.pressed.connect(func() -> void: settings_pressed.emit())
- add_child(settings)
+ SaveGame.progress_changed.connect(refresh)
+ refresh()
+
+
+func refresh() -> void:
+ var guests := Guests.all()
+ var unlocked := SaveGame.unlocked_count(guests)
+ progress_pill.text = "%d / %d guests" % [unlocked, guests.size()]
+
+ var last := int(SaveGame.data.get("last_room", 0))
+ if last <= 0:
+ primary.text = "Check in"
+ elif last >= 30:
+ primary.text = "Replay Room 30"
+ else:
+ primary.text = "Continue Room %d" % (last + 1)
func _make_mascot() -> Control:
diff --git a/scripts/Main.gd b/scripts/Main.gd
index f69094c..c40d260 100644
--- a/scripts/Main.gd
+++ b/scripts/Main.gd
@@ -3,14 +3,14 @@ extends Control
const HomeScene = preload("res://scenes/Home.tscn")
const GameScene = preload("res://scenes/Game.tscn")
const GuestBookScene = preload("res://scenes/GuestBook.tscn")
-const SettingsScene = preload("res://scenes/Settings.tscn")
const RulebookScene = preload("res://scenes/Rulebook.tscn")
+const SettingsSheetScene = preload("res://scenes/SettingsSheet.tscn")
var home
var game
var guest_book
-var settings
var rulebook
+var settings_sheet
var screens := {}
var current := "home"
var nav_stack: Array[String] = []
@@ -27,32 +27,36 @@ func _ready() -> void:
_add_screen(home)
home.play_pressed.connect(_on_play)
home.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
- home.settings_pressed.connect(func() -> void: show_screen("settings"))
+ home.settings_pressed.connect(func() -> void: open_settings("home"))
home.rules_pressed.connect(func() -> void: show_screen("rules"))
game = GameScene.instantiate()
_add_screen(game)
game.back_pressed.connect(go_back)
game.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
+ game.settings_pressed.connect(func() -> void: open_settings("game"))
guest_book = GuestBookScene.instantiate()
_add_screen(guest_book)
guest_book.back_pressed.connect(go_back)
- settings = SettingsScene.instantiate()
- _add_screen(settings)
- settings.back_pressed.connect(go_back)
- settings.rules_pressed.connect(func() -> void: show_screen("rules"))
-
rulebook = RulebookScene.instantiate()
_add_screen(rulebook)
rulebook.back_pressed.connect(go_back)
+ settings_sheet = SettingsSheetScene.instantiate()
+ add_child(settings_sheet)
+ settings_sheet.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
+ settings_sheet.visible = false
+ settings_sheet.closed.connect(close_settings)
+ settings_sheet.restart_requested.connect(_on_restart_requested)
+ settings_sheet.lobby_requested.connect(_on_lobby_requested)
+ settings_sheet.rules_requested.connect(_on_rules_requested)
+
screens = {
"home": home,
"game": game,
"guest_book": guest_book,
- "settings": settings,
"rules": rulebook,
}
@@ -68,6 +72,8 @@ func _add_screen(screen: Control) -> void:
func show_screen(name: String, push: bool = true) -> void:
if not screens.has(name):
return
+ if settings_sheet != null and settings_sheet.visible:
+ close_settings()
if name == current:
screens[name].visible = true
return
@@ -81,8 +87,6 @@ func show_screen(name: String, push: bool = true) -> void:
if name == "guest_book":
guest_book.refresh()
- elif name == "settings":
- settings.refresh()
func go_back() -> void:
@@ -93,6 +97,39 @@ func go_back() -> void:
show_screen(previous, false)
+func open_settings(mode: String) -> void:
+ if settings_sheet == null:
+ return
+ if mode == "game":
+ game.set_ui_paused(true)
+ settings_sheet.open_sheet(mode)
+
+
+func close_settings() -> void:
+ if settings_sheet == null:
+ return
+ if settings_sheet.visible:
+ settings_sheet.visible = false
+ game.set_ui_paused(false)
+
+
+func _on_restart_requested() -> void:
+ game.restart_room()
+ close_settings()
+
+
+func _on_lobby_requested() -> void:
+ close_settings()
+ nav_stack.clear()
+ current = ""
+ show_screen("home", false)
+
+
+func _on_rules_requested() -> void:
+ close_settings()
+ show_screen("rules")
+
+
func _on_play() -> void:
var max_index: int = max(0, game.levels.size() - 1)
var start_index: int = clampi(int(SaveGame.data.get("last_room", 0)), 0, max_index)
diff --git a/scripts/Palette.gd b/scripts/Palette.gd
index 2bfe5ed..182f2cf 100644
--- a/scripts/Palette.gd
+++ b/scripts/Palette.gd
@@ -12,6 +12,8 @@ const MUTED := Color("8c7460")
const WALL := Color("6e5039")
const GRID := Color(0.43, 0.31, 0.22, 0.16)
const GOLD := Color("e7b45c")
+const ORANGE := Color("e89a3c")
+const ORANGE_DARK := Color("c97924")
const ROSE := Color("d98c86")
const RED := Color("c65b4e")
const WHITE := Color("fffaf0")
diff --git a/scripts/SettingsSheet.gd b/scripts/SettingsSheet.gd
new file mode 100644
index 0000000..3f3b4f1
--- /dev/null
+++ b/scripts/SettingsSheet.gd
@@ -0,0 +1,285 @@
+extends Control
+
+signal closed
+signal restart_requested
+signal lobby_requested
+signal rules_requested
+
+var game_mode := false
+var toggles := {}
+var hold_slider: HSlider
+var hold_value: Label
+var restart_row: Control
+var lobby_row: Control
+var reset_row: Control
+var restart_dialog: ConfirmationDialog
+var reset_dialog: ConfirmationDialog
+var reset_status: Label
+
+
+func _ready() -> void:
+ set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
+ mouse_filter = Control.MOUSE_FILTER_STOP
+ visible = false
+
+ var scrim := ColorRect.new()
+ scrim.color = Color(0.18, 0.12, 0.08, 0.55)
+ scrim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
+ scrim.mouse_filter = Control.MOUSE_FILTER_STOP
+ scrim.gui_input.connect(_on_scrim_input)
+ add_child(scrim)
+
+ var panel := PanelContainer.new()
+ panel.anchor_left = 0.0
+ panel.anchor_right = 1.0
+ panel.anchor_top = 1.0
+ panel.anchor_bottom = 1.0
+ panel.offset_top = -540
+ panel.offset_bottom = 0
+ panel.offset_left = 0
+ panel.offset_right = 0
+ var style := StyleBoxFlat.new()
+ style.bg_color = Palette.CREAM
+ style.corner_radius_top_left = 26
+ style.corner_radius_top_right = 26
+ style.content_margin_left = 16
+ style.content_margin_right = 16
+ style.content_margin_top = 12
+ style.content_margin_bottom = 16
+ style.shadow_color = Color(0.18, 0.12, 0.08, 0.24)
+ style.shadow_size = 10
+ panel.add_theme_stylebox_override("panel", style)
+ add_child(panel)
+
+ var column := VBoxContainer.new()
+ column.add_theme_constant_override("separation", 8)
+ panel.add_child(column)
+
+ var header := HBoxContainer.new()
+ header.add_theme_constant_override("separation", 8)
+ column.add_child(header)
+
+ var title := UI.label("Settings", 24)
+ title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ header.add_child(title)
+
+ var close := UI.button("×", false, 36)
+ close.custom_minimum_size = Vector2(42, 36)
+ close.add_theme_font_size_override("font_size", 24)
+ close.pressed.connect(_close)
+ header.add_child(close)
+
+ 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 list := VBoxContainer.new()
+ list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ list.add_theme_constant_override("separation", 8)
+ scroll.add_child(list)
+
+ _add_pattern_row(list)
+ _add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
+ _add_toggle(list, "Reduce motion", "Stop the bob and placement pop.", "reduce_motion")
+ _add_hold_row(list)
+
+ list.add_child(UI.spacer(2))
+ var rules := UI.button("How to play", false, 46)
+ rules.add_theme_font_size_override("font_size", 16)
+ rules.pressed.connect(func() -> void: rules_requested.emit())
+ list.add_child(rules)
+
+ restart_row = _action_row("Restart room", "Clear this room and start it again.", Palette.RED, _on_restart)
+ list.add_child(restart_row)
+ lobby_row = _action_row("Back to lobby", "Return to the hotel lobby.", Palette.MUTED, _on_lobby)
+ list.add_child(lobby_row)
+
+ reset_row = _action_row("Reset progress", "Clear completed rooms and unlocked guests.", Palette.RED, _on_reset)
+ list.add_child(reset_row)
+
+ reset_status = UI.label("", 10, Palette.MUTED)
+ list.add_child(reset_status)
+
+ var resume := UI.button("Resume", true, 52)
+ resume.pressed.connect(_close)
+ list.add_child(resume)
+
+ list.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
+
+ restart_dialog = ConfirmationDialog.new()
+ restart_dialog.title = "Restart room?"
+ restart_dialog.dialog_text = "This clears the current board and timer."
+ restart_dialog.confirmed.connect(func() -> void: restart_requested.emit())
+ add_child(restart_dialog)
+
+ reset_dialog = ConfirmationDialog.new()
+ reset_dialog.title = "Reset progress?"
+ reset_dialog.dialog_text = "This clears completed rooms and unlocked guests. Settings stay."
+ reset_dialog.confirmed.connect(_on_reset_confirmed)
+ add_child(reset_dialog)
+
+
+func open_sheet(mode: String) -> void:
+ game_mode = mode == "game"
+ restart_row.visible = game_mode
+ lobby_row.visible = game_mode
+ reset_row.visible = not game_mode
+ reset_status.visible = not game_mode
+ refresh()
+ visible = true
+ move_to_front()
+
+
+func refresh() -> void:
+ for key in toggles:
+ toggles[key].button_pressed = bool(SaveGame.get_setting(key))
+ if hold_slider != null:
+ hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
+ hold_value.text = "%.2f s" % hold_slider.value
+
+
+func _add_pattern_row(parent: VBoxContainer) -> void:
+ var panel := UI.panel(Palette.PAPER, 16, 10)
+ var row := HBoxContainer.new()
+ row.add_theme_constant_override("separation", 8)
+ panel.add_child(row)
+
+ var icon := UI.icon("res://assets/icons/leaf.svg", 20, Palette.INK)
+ row.add_child(icon)
+
+ var label := UI.label("Room patterns", 16)
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.add_child(label)
+
+ var check := CheckButton.new()
+ check.button_pressed = bool(SaveGame.get_setting("patterns"))
+ check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting("patterns", on))
+ row.add_child(check)
+ toggles["patterns"] = check
+ parent.add_child(panel)
+
+
+func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: String) -> void:
+ var panel := UI.panel(Palette.PAPER, 16, 10)
+ var row := HBoxContainer.new()
+ row.add_theme_constant_override("separation", 8)
+ panel.add_child(row)
+
+ var text := VBoxContainer.new()
+ text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.add_child(text)
+
+ var label := UI.label(title, 15)
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ text.add_child(label)
+
+ var sub := UI.label(detail, 11, Palette.MUTED)
+ sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ text.add_child(sub)
+
+ var check := CheckButton.new()
+ check.button_pressed = bool(SaveGame.get_setting(key))
+ check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting(key, on))
+ row.add_child(check)
+ toggles[key] = check
+ parent.add_child(panel)
+
+
+func _add_hold_row(parent: VBoxContainer) -> void:
+ var panel := UI.panel(Palette.PAPER, 16, 10)
+ var column := VBoxContainer.new()
+ column.add_theme_constant_override("separation", 4)
+ panel.add_child(column)
+
+ var label := UI.label("Hold time", 15)
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ column.add_child(label)
+
+ var sub := UI.label("How long to press before checking in.", 11, Palette.MUTED)
+ sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ column.add_child(sub)
+
+ var row := HBoxContainer.new()
+ row.add_theme_constant_override("separation", 8)
+ column.add_child(row)
+
+ hold_slider = HSlider.new()
+ hold_slider.min_value = 0.20
+ hold_slider.max_value = 0.50
+ hold_slider.step = 0.05
+ hold_slider.value = float(SaveGame.get_setting("hold_seconds"))
+ hold_slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ hold_slider.value_changed.connect(_on_hold_changed)
+ row.add_child(hold_slider)
+
+ hold_value = UI.label("%.2f s" % hold_slider.value, 12, Palette.MUTED)
+ hold_value.custom_minimum_size = Vector2(50, 0)
+ row.add_child(hold_value)
+
+ parent.add_child(panel)
+
+
+func _action_row(title: String, detail: String, color: Color, callback: Callable) -> Control:
+ var panel := UI.panel(Palette.PAPER, 16, 10)
+ var row := HBoxContainer.new()
+ row.add_theme_constant_override("separation", 8)
+ panel.add_child(row)
+
+ var text := VBoxContainer.new()
+ text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ row.add_child(text)
+
+ var label := UI.label(title, 15, color)
+ label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ text.add_child(label)
+
+ var sub := UI.label(detail, 11, Palette.MUTED)
+ sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
+ text.add_child(sub)
+
+ var go := UI.button("›", false, 36)
+ go.custom_minimum_size = Vector2(40, 36)
+ go.add_theme_font_size_override("font_size", 20)
+ go.pressed.connect(callback)
+ row.add_child(go)
+
+ return panel
+
+
+func _on_hold_changed(value: float) -> void:
+ var snapped: float = snapped(value, 0.05)
+ hold_value.text = "%.2f s" % snapped
+ SaveGame.set_setting("hold_seconds", snapped)
+
+
+func _on_scrim_input(event: InputEvent) -> void:
+ if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
+ _close()
+
+
+func _close() -> void:
+ visible = false
+ closed.emit()
+
+
+func _on_restart() -> void:
+ restart_dialog.popup_centered()
+
+
+func _on_lobby() -> void:
+ visible = false
+ lobby_requested.emit()
+
+
+func _on_reset() -> void:
+ reset_dialog.popup_centered()
+
+
+func _on_reset_confirmed() -> void:
+ SaveGame.reset_progress()
+ reset_status.text = "Progress reset."
+ reset_status.add_theme_color_override("font_color", Palette.INK)
diff --git a/scripts/SettingsSheet.gd.uid b/scripts/SettingsSheet.gd.uid
new file mode 100644
index 0000000..dfdf8fe
--- /dev/null
+++ b/scripts/SettingsSheet.gd.uid
@@ -0,0 +1 @@
+uid://bxvwesi0d3xkp
diff --git a/scripts/UI.gd b/scripts/UI.gd
index 14d0ceb..90c5bd7 100644
--- a/scripts/UI.gd
+++ b/scripts/UI.gd
@@ -1,10 +1,46 @@
class_name UI
extends RefCounted
-## Small helpers so the screens stay readable.
-## Every control is built in code for now; we can move to .tscn layouts later.
+## 360dp design tokens. All sizes here are dp-like canvas units.
-static func label(text: String, font_size: int, color: Color = Palette.INK) -> Label:
+const MARGIN := 16
+const GAP := 12
+const BTN_H := 54
+const BTN_FONT := 19
+const BODY := 16
+const SMALL := 14
+const CAPTION := 12
+const H1 := 44
+const H2 := 26
+const H3 := 21
+const RADIUS := 22
+
+const FONT_HEADING_BASE := preload("res://assets/fonts/Fredoka-Variable.ttf")
+const FONT_BODY_BASE := preload("res://assets/fonts/Nunito-Variable.ttf")
+
+static var _heading_font: FontVariation
+static var _body_font: FontVariation
+
+
+static func heading_font() -> Font:
+ if _heading_font == null:
+ _heading_font = FontVariation.new()
+ _heading_font.base_font = FONT_HEADING_BASE
+ var ts := TextServerManager.get_primary_interface()
+ _heading_font.variation_opentype = { ts.name_to_tag("wght"): 600 }
+ return _heading_font
+
+
+static func body_font() -> Font:
+ if _body_font == null:
+ _body_font = FontVariation.new()
+ _body_font.base_font = FONT_BODY_BASE
+ var ts := TextServerManager.get_primary_interface()
+ _body_font.variation_opentype = { ts.name_to_tag("wght"): 400 }
+ return _body_font
+
+
+static func label(text: String, font_size: int = BODY, color: Color = Palette.INK, heading: bool = false) -> Label:
var l := Label.new()
l.text = text
l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
@@ -12,27 +48,65 @@ static func label(text: String, font_size: int, color: Color = Palette.INK) -> L
l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
l.add_theme_font_size_override("font_size", font_size)
l.add_theme_color_override("font_color", color)
+ l.add_theme_font_override("font", heading_font() if (heading or font_size >= 28) else body_font())
return l
-static func button(text: String, primary: bool = false, min_height: int = 58) -> Button:
+static func heading(text: String, font_size: int = H2, color: Color = Palette.INK) -> Label:
+ return label(text, font_size, color, true)
+
+
+static func body(text: String, color: Color = Palette.INK, font_size: int = BODY) -> Label:
+ return label(text, font_size, color, false)
+
+
+static func caption(text: String, color: Color = Palette.MUTED) -> Label:
+ return label(text, CAPTION, color, false)
+
+
+static func button(text: String, primary: bool = false, min_height: int = BTN_H) -> Button:
var b := Button.new()
b.text = text
b.custom_minimum_size = Vector2(0, min_height)
- b.add_theme_font_size_override("font_size", 22)
- b.add_theme_color_override("font_color", Palette.INK)
- b.add_theme_color_override("font_hover_color", Palette.INK)
- b.add_theme_color_override("font_pressed_color", Palette.INK)
- b.add_theme_color_override("font_focus_color", Palette.INK)
- b.add_theme_stylebox_override("normal", _button_style(Palette.GOLD if primary else Palette.PAPER))
- b.add_theme_stylebox_override("hover", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05)))
- b.add_theme_stylebox_override("pressed", _button_style((Palette.GOLD if primary else Palette.PAPER).darkened(0.07)))
- b.add_theme_stylebox_override("focus", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05)))
+ b.add_theme_font_override("font", heading_font())
+ b.add_theme_font_size_override("font_size", BTN_FONT)
+ b.add_theme_color_override("font_color", Palette.WHITE if primary else Palette.INK)
+ b.add_theme_color_override("font_hover_color", Palette.WHITE if primary else Palette.INK)
+ b.add_theme_color_override("font_pressed_color", Palette.WHITE if primary else Palette.INK)
+ b.add_theme_color_override("font_focus_color", Palette.WHITE if primary else Palette.INK)
+ b.add_theme_stylebox_override("normal", _button_style(Palette.ORANGE if primary else Palette.PAPER))
+ b.add_theme_stylebox_override("hover", _button_style((Palette.ORANGE if primary else Palette.PAPER).lightened(0.05)))
+ b.add_theme_stylebox_override("pressed", _button_style((Palette.ORANGE if primary else Palette.PAPER).darkened(0.07)))
+ b.add_theme_stylebox_override("focus", _button_style((Palette.ORANGE if primary else Palette.PAPER).lightened(0.05)))
b.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
return b
-static func panel(color: Color = Palette.PAPER, radius: int = 28, margin: int = 24) -> PanelContainer:
+static func round_button(icon_path: String, size: int = 48) -> Button:
+ var b := Button.new()
+ b.custom_minimum_size = Vector2(size, size)
+ b.icon = load(icon_path)
+ b.expand_icon = false
+ b.add_theme_stylebox_override("normal", _round_style(Palette.PAPER))
+ b.add_theme_stylebox_override("hover", _round_style(Palette.PAPER.lightened(0.04)))
+ b.add_theme_stylebox_override("pressed", _round_style(Palette.PAPER.darkened(0.06)))
+ b.add_theme_stylebox_override("focus", _round_style(Palette.PAPER.lightened(0.04)))
+ b.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
+ return b
+
+
+static func icon(icon_path: String, size: int = 20, color: Color = Palette.MUTED) -> TextureRect:
+ var t := TextureRect.new()
+ t.texture = load(icon_path)
+ t.custom_minimum_size = Vector2(size, size)
+ t.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
+ t.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
+ t.modulate = color
+ t.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ return t
+
+
+static func panel(color: Color = Palette.PAPER, radius: int = RADIUS, margin: int = 16) -> PanelContainer:
var p := PanelContainer.new()
var s := StyleBoxFlat.new()
s.bg_color = color
@@ -45,24 +119,44 @@ static func panel(color: Color = Palette.PAPER, radius: int = 28, margin: int =
s.content_margin_top = margin
s.content_margin_bottom = margin
s.shadow_color = Color(0.29, 0.20, 0.14, 0.12)
- s.shadow_size = 6
- s.shadow_offset = Vector2(0, 4)
+ s.shadow_size = 5
+ s.shadow_offset = Vector2(0, 3)
p.add_theme_stylebox_override("panel", s)
return p
+static func spacer(height: int = GAP) -> Control:
+ var c := Control.new()
+ c.custom_minimum_size = Vector2(0, height)
+ c.mouse_filter = Control.MOUSE_FILTER_IGNORE
+ return c
+
+
static func _button_style(color: Color) -> StyleBoxFlat:
var s := StyleBoxFlat.new()
s.bg_color = color
- s.corner_radius_top_left = 18
- s.corner_radius_top_right = 18
- s.corner_radius_bottom_left = 18
- s.corner_radius_bottom_right = 18
+ s.corner_radius_top_left = 26
+ s.corner_radius_top_right = 26
+ s.corner_radius_bottom_left = 26
+ s.corner_radius_bottom_right = 26
s.content_margin_left = 18
s.content_margin_right = 18
s.content_margin_top = 10
s.content_margin_bottom = 10
- s.shadow_color = Color(0.29, 0.20, 0.14, 0.14)
- s.shadow_size = 4
+ s.shadow_color = Color(0.29, 0.20, 0.14, 0.16)
+ s.shadow_size = 5
s.shadow_offset = Vector2(0, 3)
return s
+
+
+static func _round_style(color: Color) -> StyleBoxFlat:
+ var s := StyleBoxFlat.new()
+ s.bg_color = color
+ s.corner_radius_top_left = 26
+ s.corner_radius_top_right = 26
+ s.corner_radius_bottom_left = 26
+ s.corner_radius_bottom_right = 26
+ s.shadow_color = Color(0.29, 0.20, 0.14, 0.12)
+ s.shadow_size = 4
+ s.shadow_offset = Vector2(0, 2)
+ return s
diff --git a/scripts/Version.gd b/scripts/Version.gd
new file mode 100644
index 0000000..7341fa1
--- /dev/null
+++ b/scripts/Version.gd
@@ -0,0 +1,7 @@
+class_name Version
+extends RefCounted
+
+const NUMBER := "0.4.0-alpha"
+const CODENAME := "Lobby Redesign"
+const BUILD_DATE := "2026-12-02"
+const BUILD_LABEL := "v0.4.0-alpha · build 2026-12-02"
diff --git a/scripts/Version.gd.uid b/scripts/Version.gd.uid
new file mode 100644
index 0000000..d5fad15
--- /dev/null
+++ b/scripts/Version.gd.uid
@@ -0,0 +1 @@
+uid://d354au72oeytm