diff options
Diffstat (limited to 'client/menu')
| -rw-r--r-- | client/menu/character_menu.gd | 6 | ||||
| -rw-r--r-- | client/menu/ingame_menu.gd | 1 | ||||
| -rw-r--r-- | client/menu/ingame_menu.tscn | 6 | ||||
| -rw-r--r-- | client/menu/menu_manager.gd | 8 | ||||
| -rw-r--r-- | client/menu/menu_manager.tscn | 9 | ||||
| -rw-r--r-- | client/menu/scene_transition.gd | 11 | 
6 files changed, 31 insertions, 10 deletions
| diff --git a/client/menu/character_menu.gd b/client/menu/character_menu.gd index 3e535e71..80fcdcb6 100644 --- a/client/menu/character_menu.gd +++ b/client/menu/character_menu.gd @@ -17,13 +17,19 @@ extends Control  @onready var character: Character = $Character  @onready var num_hairstyles := character.hairstyles.keys().size() +@onready var back_button := $VBoxContainer/bottom_panel/back  func _ready():  	$VBoxContainer/top_panel/a/username.text = Global.profile["username"]  	character.select_hairstyle(Global.profile["character"])  	Global.focus_first_button(self) +func _input(event): +	if Input.is_action_just_pressed("ui_cancel"): +		_on_back_pressed() +  func _on_back_pressed(): +	Global.fade_next = true  	$SceneTransition.transition_to("res://menu/menu_manager.tscn")  func _on_username_text_changed(new_text): diff --git a/client/menu/ingame_menu.gd b/client/menu/ingame_menu.gd index 4752c382..73f4dbb3 100644 --- a/client/menu/ingame_menu.gd +++ b/client/menu/ingame_menu.gd @@ -14,6 +14,7 @@ func deact():  	hide()  func _on_main_menu_pressed(): +	Global.fade_next = true  	get_parent().transition_to("res://menu/menu_manager.tscn")  func _on_quit_pressed(): diff --git a/client/menu/ingame_menu.tscn b/client/menu/ingame_menu.tscn index 79b4efb1..725735ea 100644 --- a/client/menu/ingame_menu.tscn +++ b/client/menu/ingame_menu.tscn @@ -72,7 +72,7 @@ anchors_preset = 9  anchor_bottom = 1.0  offset_left = -400.0  offset_right = -90.0 -offset_bottom = 2592.0 +offset_bottom = 3888.0  grow_vertical = 2  [node name="Margin" type="MarginContainer" parent="Side"] @@ -105,12 +105,12 @@ alignment = 0  [node name="MainMenu" type="Button" parent="Side/Margin/Options"]  layout_mode = 2 -text = "Main Menu" +text = "Main menu"  alignment = 0  [node name="Quit" type="Button" parent="Side/Margin/Options"]  layout_mode = 2 -text = "Quit" +text = "Quit game"  alignment = 0  [connection signal="pressed" from="Side/Margin/Options/Reconnect" to="." method="_on_reconnect_pressed"] diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd index 69866377..079f6e44 100644 --- a/client/menu/menu_manager.gd +++ b/client/menu/menu_manager.gd @@ -12,6 +12,14 @@ var menu_stack = ["main"]  func _ready():  	Global.focus_first_button(menus[menu_stack.back()]) +	 +	if Global.fade_next: +		Global.fade_next = false +		transition.fade_in() + +func _input(event): +	if Input.is_action_just_pressed("ui_cancel") && menu_stack.size() > 1: +		go_back()  func goto(menu_name: String):  	show_menu(menu_name) diff --git a/client/menu/menu_manager.tscn b/client/menu/menu_manager.tscn index 6b2d7b33..18e13282 100644 --- a/client/menu/menu_manager.tscn +++ b/client/menu/menu_manager.tscn @@ -30,9 +30,6 @@ visible = false  layout_mode = 1  [node name="SceneTransition" parent="." instance=ExtResource("6_p4u45")] -layout_mode = 0 -anchors_preset = 0 -anchor_right = 0.0 -anchor_bottom = 0.0 -grow_horizontal = 1 -grow_vertical = 1 +visible = false +layout_mode = 1 +auto_fade_in = false diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd index 87a1ec1b..30c7e1df 100644 --- a/client/menu/scene_transition.gd +++ b/client/menu/scene_transition.gd @@ -19,8 +19,16 @@ extends ColorRect  @onready var anim = $animation  @export var ingame = false +@export var auto_fade_in := true +  func _ready(): -	self.visible = true +	if auto_fade_in: +		fade_in() +	else: +		visible = false + +func fade_in(): +	visible = true  	anim.play("fade_in")  func transition_to(path: String): @@ -35,6 +43,7 @@ func quit():  	get_tree().quit()  func out(): +	visible = true  	if menu.visible:  		menu.anim.play_backwards("activate")  		await menu.anim.animation_finished | 
