feat(ui): 360dp redesign with patterns, room legend, and in-level settings
This commit is contained in:
1 parent
46b5764144
commit
089f5d6171
12 files changed
+115
-263
No files matched your search
+37
-49
@@ -11,27 +11,25 @@ var tutorial_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", 24)
|
||||
margin.add_theme_constant_override("margin_right", 24)
|
||||
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", 8)
|
||||
margin.add_theme_constant_override("margin_bottom", 10)
|
||||
add_child(margin)
|
||||
|
||||
var column := VBoxContainer.new()
|
||||
column.add_theme_constant_override("separation", 12)
|
||||
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("House Rules", 30)
|
||||
var title := UI.label("House Rules", 22)
|
||||
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
top.add_child(title)
|
||||
@@ -43,102 +41,92 @@ func _ready() -> void:
|
||||
|
||||
var content := VBoxContainer.new()
|
||||
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
content.add_theme_constant_override("separation", 10)
|
||||
content.add_theme_constant_override("separation", 6)
|
||||
scroll.add_child(content)
|
||||
|
||||
content.add_child(_heading("Welcome to the Rat Hotel"))
|
||||
content.add_child(UI.heading("Welcome to the Rat Hotel", 18))
|
||||
content.add_child(_body("Crumb runs a small hotel for travelling rats. Every guest wants a room of their own — and a little space from the neighbours."))
|
||||
|
||||
content.add_child(_heading("The four house rules"))
|
||||
content.add_child(UI.heading("The four house rules", 18))
|
||||
content.add_child(_rule_row("One guest per room", "Each coloured room holds exactly one rat.", "region"))
|
||||
content.add_child(_rule_row("One guest per floor", "Each row holds exactly one rat.", "row"))
|
||||
content.add_child(_rule_row("One guest per corridor", "Each column holds exactly one rat.", "col"))
|
||||
content.add_child(_rule_row("No shared walls or corners", "Rats cannot touch, not even diagonally.", "touch"))
|
||||
|
||||
content.add_child(_heading("Checking in"))
|
||||
content.add_child(_body("Tap or left-click to mark a cell with an X. Tap an X or a guest to clear it. Press and hold on mobile, or right-click on PC, to check a guest in. A gold ring fills while you hold."))
|
||||
content.add_child(_body("Gold-ringed guests are already checked in and cannot be moved. Undo is unlimited."))
|
||||
content.add_child(UI.heading("Checking in", 18))
|
||||
content.add_child(_body("Tap or left-click to mark X. Tap an X or a guest to clear it. Hold or right-click to check a guest in. Gold-ringed guests are already in."))
|
||||
content.add_child(_body("Undo is unlimited. Hints are free and explain the next sensible move."))
|
||||
|
||||
content.add_child(_heading("Try a tiny room"))
|
||||
content.add_child(_body("One guest is already checked in. Place the other four. No guessing required."))
|
||||
content.add_child(UI.heading("Try a tiny room", 18))
|
||||
content.add_child(_body("One guest is already checked in. Place the other four."))
|
||||
|
||||
var board_center := CenterContainer.new()
|
||||
content.add_child(board_center)
|
||||
tutorial_board = BoardScene.instantiate() as Board
|
||||
tutorial_board.custom_minimum_size = Vector2(300, 300)
|
||||
tutorial_board.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
||||
tutorial_board.custom_minimum_size = Vector2(240, 240)
|
||||
tutorial_board.solved.connect(_on_tutorial_solved)
|
||||
board_center.add_child(tutorial_board)
|
||||
|
||||
var controls := HBoxContainer.new()
|
||||
controls.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
controls.add_theme_constant_override("separation", 10)
|
||||
controls.add_theme_constant_override("separation", 8)
|
||||
content.add_child(controls)
|
||||
|
||||
var reset := UI.button("Reset", false, 48)
|
||||
reset.custom_minimum_size = Vector2(120, 48)
|
||||
var reset := UI.button("Reset", false, 44)
|
||||
reset.custom_minimum_size = Vector2(100, 44)
|
||||
reset.add_theme_font_size_override("font_size", 15)
|
||||
reset.pressed.connect(_on_tutorial_reset)
|
||||
controls.add_child(reset)
|
||||
|
||||
var hint := UI.button("Hint", true, 48)
|
||||
hint.custom_minimum_size = Vector2(120, 48)
|
||||
var hint := UI.button("Hint", true, 44)
|
||||
hint.custom_minimum_size = Vector2(100, 44)
|
||||
hint.add_theme_font_size_override("font_size", 15)
|
||||
hint.pressed.connect(_on_tutorial_hint)
|
||||
controls.add_child(hint)
|
||||
|
||||
tutorial_status = UI.label("Tap a cell to mark X. Hold or right-click to check in.", 14, Palette.MUTED)
|
||||
tutorial_status = UI.label("Tap = X · Hold or right-click = check in", 10, Palette.MUTED)
|
||||
content.add_child(tutorial_status)
|
||||
|
||||
content.add_child(_heading("Housekeeping tips"))
|
||||
content.add_child(_body("Start with the smallest room. Mark Xs as you place guests — the board does it for you. If a room's open cells all sit in one row, that row's guest belongs to that room. Every room has exactly one solution, and it never requires guessing."))
|
||||
content.add_child(_body("If you get stuck, the Hint button reveals one correct guest. In the real rooms, Crumb's hints are always free."))
|
||||
content.add_child(UI.heading("Housekeeping tips", 18))
|
||||
content.add_child(_body("Start with the smallest room. If a room's open cells all sit in one row, that row's guest belongs to that room. Every room has one solution and never requires guessing."))
|
||||
|
||||
content.add_child(_heading("Questions"))
|
||||
content.add_child(UI.heading("Questions", 18))
|
||||
content.add_child(_body("Why can't the rats touch? Every guest is a little grumpy after a long journey and wants their own space."))
|
||||
content.add_child(_body("Why do some guests have gold rings? They checked in early. They are part of the puzzle, not a mistake."))
|
||||
|
||||
var gap := Control.new()
|
||||
gap.custom_minimum_size = Vector2(0, 20)
|
||||
content.add_child(gap)
|
||||
|
||||
var tutorial := _load_tutorial()
|
||||
if not tutorial.is_empty():
|
||||
tutorial_board.set_level(tutorial)
|
||||
|
||||
|
||||
func _heading(text: String) -> Label:
|
||||
var label := UI.label(text, 24)
|
||||
func _body(text: String) -> Label:
|
||||
var label := UI.label(text, 12, Palette.MUTED)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
return label
|
||||
|
||||
|
||||
func _body(text: String, font_size: int = 16) -> Label:
|
||||
var label := UI.label(text, font_size, Palette.MUTED)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
return label
|
||||
|
||||
|
||||
func _rule_row(title: String, body: String, mode: String) -> PanelContainer:
|
||||
var panel := UI.panel(Palette.PAPER, 20, 12)
|
||||
var panel := UI.panel(Palette.PAPER, 14, 7)
|
||||
var row := HBoxContainer.new()
|
||||
row.add_theme_constant_override("separation", 12)
|
||||
row.add_theme_constant_override("separation", 8)
|
||||
panel.add_child(row)
|
||||
|
||||
var diagram := MiniDiagram.new()
|
||||
diagram.mode = mode
|
||||
diagram.custom_minimum_size = Vector2(130, 130)
|
||||
diagram.custom_minimum_size = Vector2(72, 72)
|
||||
row.add_child(diagram)
|
||||
|
||||
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 heading := UI.label(title, 19)
|
||||
var heading := UI.label(title, 14)
|
||||
heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
text.add_child(heading)
|
||||
|
||||
var detail := UI.label(body, 14, Palette.MUTED)
|
||||
var detail := UI.label(body, 10, Palette.MUTED)
|
||||
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
text.add_child(detail)
|
||||
|
||||
@@ -160,7 +148,7 @@ func _load_tutorial() -> Dictionary:
|
||||
|
||||
func _on_tutorial_reset() -> void:
|
||||
tutorial_board.restart()
|
||||
tutorial_status.text = "Tap a cell to mark X. Hold or right-click to check in."
|
||||
tutorial_status.text = "Tap = X · Hold or right-click = check in"
|
||||
tutorial_status.add_theme_color_override("font_color", Palette.MUTED)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user