Adds the Guest Book, Settings, House Rules, and guest unlocks on the 20-room board. Rats still use the shared Crumb token.
91 lines
3.0 KiB
GDScript
91 lines
3.0 KiB
GDScript
extends Control
|
|
|
|
signal play_pressed
|
|
signal guest_book_pressed
|
|
signal settings_pressed
|
|
signal rules_pressed
|
|
|
|
|
|
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)
|
|
add_child(margin)
|
|
|
|
var column := VBoxContainer.new()
|
|
column.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
column.add_theme_constant_override("separation", 10)
|
|
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 gap := Control.new()
|
|
gap.custom_minimum_size = Vector2(0, 14)
|
|
column.add_child(gap)
|
|
|
|
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 mascot := _make_mascot()
|
|
mascot.custom_minimum_size = Vector2(300, 300)
|
|
card.add_child(mascot)
|
|
|
|
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))
|
|
|
|
var gap2 := Control.new()
|
|
gap2.custom_minimum_size = Vector2(0, 10)
|
|
column.add_child(gap2)
|
|
|
|
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())
|
|
|
|
var secondary := HBoxContainer.new()
|
|
secondary.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
secondary.add_theme_constant_override("separation", 10)
|
|
column.add_child(secondary)
|
|
|
|
var book := UI.button("Guest Book", false, 52)
|
|
book.custom_minimum_size = Vector2(150, 52)
|
|
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)
|
|
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))
|
|
|
|
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)
|
|
|
|
|
|
func _make_mascot() -> Control:
|
|
if ResourceLoader.exists("res://art/crumb.png"):
|
|
var texture_rect := TextureRect.new()
|
|
texture_rect.texture = load("res://art/crumb.png")
|
|
texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
return texture_rect
|
|
return RatPortrait.new()
|