src / beginning / menu / menu.tscn

Diagram

Diagram

Assets

200
200

Overridden virtual functions

_ready

func _ready() -> void:
	%ClimbButton.grab_focus()
	FocusHelper.set_neighbors_v([
		%ClimbButton, %OptionsButton, %CreditsButton, %QuitButton])
$Accounts
func _ready() -> void:
	if get_parent() == get_tree().root:
		grab_focus_first = true
	else:
		load_accounts()
$Chapters
func _ready() -> void:
	if get_parent() == get_tree().root:
		%AnimationPlayer.play('opening')
	FocusHelper.set_neighbors_h(%ChaptersContainer.get_children())
	for chapter in %ChaptersContainer.get_children():
		chapter.focus_entered.connect(_on_chapater_focused.bind(chapter))
	load_focused_chapter_to_menu()

_process

$RootContainer/MenuContainer/ClimbContainer/ButtonContainer/ClimbButton, $RootContainer/MenuContainer/OthersContainer/VBoxContainer/OptionsContainer/OptionsButton, $RootContainer/MenuContainer/OthersContainer/VBoxContainer/CreditsContainer/CreditsButton, $RootContainer/MenuContainer/OthersContainer/VBoxContainer/QuitContainer/QuitButton
func _process(delta: float) -> void:
	if not focused: return
	blink_time += delta
	add_theme_color_override("font_focus_color", get_focus_color())
	if blink_time > BLINK_INTERVAL: blink_time = 0

_input

$Chapters
func _input(event: InputEvent) -> void:
	if not (shown && current_plate == Plate.ROOT): return
	if event.is_action_pressed("ui_back"):
		go_back()
	elif event.is_action_pressed("ui_accept"):
		go_foward()

Instantiators

Caution
No other scene instantiate this scene.

Scene Tree

Signal Connections

$RootContainer/MenuContainer/ClimbContainer/ButtonContainer/ClimbButton:[focus_entered]⇒$.
func _on_climb_button_focus_entered() -> void:
	if current_plate == Plate.ROOT:
		%AnimationPlayer.play('climb_focused')
$RootContainer/MenuContainer/ClimbContainer/ButtonContainer/ClimbButton:[focus_exited]⇒$.
func _on_climb_button_focus_exited() -> void:
	if current_plate == Plate.ROOT:
		%AnimationPlayer.play('climb_unfocused')
$RootContainer/MenuContainer/ClimbContainer/ButtonContainer/ClimbButton:[pressed]⇒$.
func _on_climb_button_pressed() -> void:
	if current_plate == Plate.ROOT:
		Input.start_joy_vibration(0, 0.4, 0.6, 0.2)
		%AnimationPlayer.play('climb_selected')
$RootContainer/MenuContainer/OthersContainer/VBoxContainer/QuitContainer/QuitButton:[pressed]⇒$.
func _on_quit_button_pressed() -> void:
	get_tree().quit()
$Accounts:[get_started]⇒$.
func _on_accounts_get_started(account: Account) -> void:
	%Chapters.setup_from_account_resource()
	%AnimationPlayer.play("chapters_show")
$Accounts:[ui_backed]⇒$.
func _on_accounts_ui_backed() -> void:
	if current_plate == Plate.ACCOUNTS:
		%AnimationPlayer.play('climb_unselected')
$Chapters:[focused]⇒$.
func _on_chapters_focused(idx: int) -> void:
	if current_plate == Plate.CHAPTERS:
		%World.focus_chapter(idx)
$Chapters:[selected]⇒$.
func _on_chapters_selected(idx: int) -> void:
	if current_plate == Plate.CHAPTERS:
		%World.zoom_chapter(idx)
$Chapters:[ui_backed]⇒$.
func _on_chapters_ui_backed() -> void:
	if current_plate == Plate.CHAPTERS || current_plate == Plate.ACCOUNTS:
		%AnimationPlayer.play('chapters_hide')
		%World.back_to_circular_move()

Animations

Animation_f84do

Diagram

chapters_hide

Diagram

chapters_show

Diagram

climb_focused

Diagram

climb_selected

Diagram

climb_unfocused

Diagram

climb_unselected

Diagram

opening (autoplay)

Diagram

Properties

Table 1. Root properties
Name Value

layout_mode

3

anchors_preset

15

anchor_right

1.0

anchor_bottom

1.0

grow_horizontal

2

grow_vertical

2

theme

script

Table 2. $SubViewportContainer properties
Name Value

layout_mode

1

anchors_preset

15

anchor_right

1.0

anchor_bottom

1.0

grow_horizontal

2

grow_vertical

2

focus_mode

0

Table 3. $SubViewportContainer/SubViewport properties
Name Value

handle_input_locally

false

gui_disable_input

true

size

Vector2i(1920, 1080)

render_target_update_mode

4

Table 4. $SubViewportContainer/SubViewport/World properties
Name Value

unique_name_in_owner

true

Table 5. $RootContainer properties
Name Value

layout_mode

1

anchors_preset

9

anchor_bottom

1.0

offset_right

663.0

offset_bottom

30.0

grow_vertical

2

theme_override_constants/margin_left

180

theme_override_constants/margin_top

120

theme_override_constants/margin_bottom

100

Table 6. $RootContainer/MenuContainer properties
Name Value

layout_mode

2

Table 7. $RootContainer/MenuContainer/ClimbContainer/LogoContainer properties
Name Value

custom_minimum_size

Vector2(0, 240)

offset_left

170.0

offset_right

170.0

offset_bottom

240.0

size_flags_horizontal

4

Table 8. $RootContainer/MenuContainer/ClimbContainer/LogoContainer/Sprite2D properties
Name Value

texture_filter

2

texture

res://assets/images/beginning/MenuLogo.svg

offset

Vector2(10, 140)

Table 9. $RootContainer/MenuContainer/ClimbContainer/ButtonContainer properties
Name Value

offset_top

244.0

offset_right

340.0

offset_bottom

389.0

Table 10. $RootContainer/MenuContainer/ClimbContainer/ButtonContainer/ClimbButton properties
Name Value

unique_name_in_owner

true

layout_mode

2

focus_neighbor_left

NodePath(".")

focus_neighbor_top

NodePath(".")

focus_neighbor_right

NodePath(".")

focus_neighbor_bottom

NodePath("../../../OthersContainer/VBoxContainer/OptionsContainer/OptionsButton")

theme_override_font_sizes/font_size

100

text

` CLIMB`

icon

null

focus_move_direction

1

Table 11. $RootContainer/MenuContainer/OthersContainer properties
Name Value

position

Vector2(10, 400)

Table 12. $RootContainer/MenuContainer/OthersContainer/VBoxContainer properties
Name Value

offset_right

483.0

offset_bottom

281.0

Table 13. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/OptionsContainer properties
Name Value

layout_mode

2

Table 14. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/OptionsContainer/OptionsButton properties
Name Value

unique_name_in_owner

true

layout_mode

2

focus_neighbor_top

NodePath("../../../../ClimbContainer/ButtonContainer/ClimbButton")

focus_neighbor_bottom

NodePath("../../CreditsContainer/CreditsButton")

text

` Options`

Table 15. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/CreditsContainer properties
Name Value

layout_mode

2

Table 16. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/CreditsContainer/CreditsButton properties
Name Value

unique_name_in_owner

true

layout_mode

2

focus_neighbor_top

NodePath("../../OptionsContainer/OptionsButton")

focus_neighbor_bottom

NodePath("../../QuitContainer/QuitButton")

text

` Credits`

icon

Credits
Figure 1. res://assets/images/ui/Credits.svg
Table 17. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/QuitContainer properties
Name Value

layout_mode

2

Table 18. $RootContainer/MenuContainer/OthersContainer/VBoxContainer/QuitContainer/QuitButton properties
Name Value

unique_name_in_owner

true

layout_mode

2

focus_neighbor_top

NodePath("../../CreditsContainer/CreditsButton")

text

` Quit`

icon

Quit
Figure 2. res://assets/images/ui/Quit.svg
Table 19. $Accounts properties
Name Value

unique_name_in_owner

true

layout_mode

1

offset_left

1920.0

offset_right

1920.0

Table 20. $Chapters properties
Name Value

unique_name_in_owner

true

layout_mode

1

offset_left

1920.0

offset_right

1920.0

Table 21. $AnimationPlayer properties
Name Value

unique_name_in_owner

true

libraries

{ &"": SubResource("AnimationLibrary_dft0i") }

autoplay

opening

menu.gd

extends Control

enum Plate { OPENING, ROOT, ACCOUNTS, CHAPTERS }
@export var current_plate : Plate = Plate.OPENING : set = change_plate
@export var grab_focus_root : bool = false : set = set_grab_focus_root


func _ready() -> void:
	%ClimbButton.grab_focus()
	FocusHelper.set_neighbors_v([
		%ClimbButton, %OptionsButton, %CreditsButton, %QuitButton])


func set_grab_focus_root(val: bool) -> void:
	if val: %ClimbButton.grab_focus()


func change_plate(val: Plate) -> void:
	current_plate = val


func _on_climb_button_focus_entered() -> void:
	if current_plate == Plate.ROOT:
		%AnimationPlayer.play('climb_focused')


func _on_climb_button_focus_exited() -> void:
	if current_plate == Plate.ROOT:
		%AnimationPlayer.play('climb_unfocused')


func _on_climb_button_pressed() -> void:
	if current_plate == Plate.ROOT:
		Input.start_joy_vibration(0, 0.4, 0.6, 0.2)
		%AnimationPlayer.play('climb_selected')


func _on_quit_button_pressed() -> void:
	get_tree().quit()


func _on_accounts_ui_backed() -> void:
	if current_plate == Plate.ACCOUNTS:
		%AnimationPlayer.play('climb_unselected')


func _on_accounts_get_started(account: Account) -> void:
	%Chapters.setup_from_account_resource()
	%AnimationPlayer.play("chapters_show")


func _on_chapters_ui_backed() -> void:
	if current_plate == Plate.CHAPTERS || current_plate == Plate.ACCOUNTS:
		%AnimationPlayer.play('chapters_hide')
		%World.back_to_circular_move()


func _on_chapters_focused(idx: int) -> void:
	if current_plate == Plate.CHAPTERS:
		%World.focus_chapter(idx)


func _on_chapters_selected(idx: int) -> void:
	if current_plate == Plate.CHAPTERS:
		%World.zoom_chapter(idx)