feat: guest stories, accessibility and cozy events
v0.9.0-alpha local build. Adds per-guest story vignettes, a scrollable Guest Book story section, live text scaling, Android haptics, a difficulty picker with descriptions, six repeating cosmetic hotel events, and isolated free play using verified symmetry variants. Save format v7 with automatic migration. QA is 9/9 including the free-play uniqueness suite.
This commit is contained in:
1 parent
e0fd33c25e
commit
9e2776f7c4
27 files changed
+1559
-99
No files matched your search
+59
-3
@@ -40,13 +40,66 @@ static func body_font() -> Font:
|
||||
return _body_font
|
||||
|
||||
|
||||
## The SaveGame autoload, fetched dynamically so helper scripts can compile
|
||||
## before autoloads are registered (headless --script runs do exactly that).
|
||||
static func _save_node() -> Node:
|
||||
var loop := Engine.get_main_loop()
|
||||
if loop is SceneTree:
|
||||
return (loop as SceneTree).root.get_node_or_null("SaveGame")
|
||||
return null
|
||||
|
||||
|
||||
## User-facing UI scale (1.0 / 1.15 / 1.3), defaulting to 1.0 if missing or bad.
|
||||
static func ui_scale() -> float:
|
||||
var save := _save_node()
|
||||
if save == null:
|
||||
return 1.0
|
||||
var value: Variant = save.get_setting("ui_scale")
|
||||
var type := typeof(value)
|
||||
if type == TYPE_FLOAT or type == TYPE_INT or type == TYPE_STRING:
|
||||
var scale := float(value)
|
||||
if scale > 0.0 and is_finite(scale):
|
||||
return scale
|
||||
return 1.0
|
||||
|
||||
|
||||
## Font size with the UI scale applied, never below the 8 px minimum.
|
||||
static func _scaled_font_size(base_size: int) -> int:
|
||||
return int(max(8, round(base_size * ui_scale())))
|
||||
|
||||
|
||||
## Light haptic feedback on Android. Strong is used for wins and unlocks.
|
||||
static func haptic(strong: bool = false) -> void:
|
||||
var save := _save_node()
|
||||
if save == null or not bool(save.get_setting("haptics")):
|
||||
return
|
||||
if OS.get_name() == "Android":
|
||||
Input.vibrate_handheld(55 if strong else 18)
|
||||
|
||||
|
||||
## Sets a per-control font size while keeping it eligible for live text scaling.
|
||||
static func set_font_size(control: Control, base_size: int) -> void:
|
||||
control.set_meta("base_font_size", base_size)
|
||||
control.add_theme_font_size_override("font_size", _scaled_font_size(base_size))
|
||||
|
||||
|
||||
## Re-applies the saved text scale to controls that are already on screen.
|
||||
static func apply_scale(root: Node) -> void:
|
||||
if root is Control and root.has_meta("base_font_size"):
|
||||
var base := int(root.get_meta("base_font_size"))
|
||||
root.add_theme_font_size_override("font_size", _scaled_font_size(base))
|
||||
for child in root.get_children():
|
||||
apply_scale(child)
|
||||
|
||||
|
||||
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
|
||||
l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
l.add_theme_font_size_override("font_size", font_size)
|
||||
l.set_meta("base_font_size", font_size)
|
||||
l.add_theme_font_size_override("font_size", _scaled_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
|
||||
@@ -68,8 +121,9 @@ static func button(text: String, primary: bool = false, min_height: int = BTN_H)
|
||||
var b := Button.new()
|
||||
b.text = text
|
||||
b.custom_minimum_size = Vector2(0, min_height)
|
||||
b.set_meta("base_font_size", BTN_FONT)
|
||||
b.add_theme_font_override("font", heading_font())
|
||||
b.add_theme_font_size_override("font_size", BTN_FONT)
|
||||
b.add_theme_font_size_override("font_size", _scaled_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)
|
||||
@@ -157,7 +211,9 @@ static func pass_scroll_input(root: Node, skip: Array = []) -> void:
|
||||
|
||||
## Short control hint that follows the saved placement mode.
|
||||
static func place_hint() -> String:
|
||||
if bool(SaveGame.get_setting("double_tap_place")):
|
||||
var save := _save_node()
|
||||
var double_tap := true if save == null else bool(save.get_setting("double_tap_place"))
|
||||
if double_tap:
|
||||
return "Tap = X · Double-tap or right-click = check in"
|
||||
return "Tap = X · Hold or right-click = check in"
|
||||
|
||||
|
||||
Reference in new issue
Block a user