diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index 4d35e19..eb67f59 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -44,6 +44,15 @@ theme_override_fonts/font = ExtResource("1_l6cm7") theme_override_font_sizes/font_size = 36 text = "加入局域网游戏" +[node name="QuitGame" type="Button" parent="." unique_id=70898198] +offset_left = 932.0 +offset_top = 959.0 +offset_right = 1248.0386 +offset_bottom = 1058.0 +theme_override_fonts/font = ExtResource("1_l6cm7") +theme_override_font_sizes/font_size = 36 +text = "退出游戏" + [node name="CreateGameUI" type="Node2D" parent="." unique_id=462604530] visible = false position = Vector2(585, 355) @@ -150,6 +159,7 @@ text = "设置" [connection signal="pressed" from="StartGame" to="." method="_on_start_game_pressed"] [connection signal="pressed" from="JoinGame" to="." method="_on_join_game_pressed"] +[connection signal="pressed" from="QuitGame" to="." method="_on_quit_game_pressed"] [connection signal="pressed" from="CreateGameUI/CreateGameButton" to="CreateGameUI" method="_on_create_game_button_pressed"] [connection signal="pressed" from="CreateGameUI/Warn/WarnButton" to="CreateGameUI" method="_on_warn_button_pressed"] [connection signal="pressed" from="JoinGameUI/JoinGameButton" to="JoinGameUI" method="_on_join_game_button_pressed"] diff --git a/scenes/settings.tscn b/scenes/settings.tscn index e86c140..04fd0ba 100644 --- a/scenes/settings.tscn +++ b/scenes/settings.tscn @@ -96,10 +96,10 @@ offset_bottom = 60.0 theme_override_font_sizes/font_size = 25 [node name="SaveButton" type="Button" parent="." unique_id=1377249836] -offset_left = 150.0 -offset_top = 1321.0 -offset_right = 314.0 -offset_bottom = 1398.0 +offset_left = 147.0 +offset_top = 1315.0 +offset_right = 311.0 +offset_bottom = 1392.0 theme_override_fonts/font = ExtResource("2_6wm04") theme_override_font_sizes/font_size = 30 text = "保存设置" @@ -120,7 +120,7 @@ offset_right = 550.0 offset_bottom = 1394.0 theme_override_fonts/font = ExtResource("2_6wm04") theme_override_font_sizes/font_size = 30 -text = "取消" +text = "返回" [node name="LoadButton" type="Button" parent="." unique_id=2015694853] offset_left = 135.0 diff --git a/scripts/game/game.gd b/scripts/game/game.gd index b2897bb..5f1323a 100644 --- a/scripts/game/game.gd +++ b/scripts/game/game.gd @@ -20,6 +20,7 @@ func init() -> void: for address in addresses: if address.substr(0, GameManager.ip_begin.length()) == GameManager.ip_begin: ipaddress = address + break $IPLabel.text = ipaddress $Player1/Username.text = GameManager.username diff --git a/scripts/main_menu/main_menu.gd b/scripts/main_menu/main_menu.gd index 3db6c3c..ea5c96c 100644 --- a/scripts/main_menu/main_menu.gd +++ b/scripts/main_menu/main_menu.gd @@ -7,6 +7,8 @@ func _on_join_game_pressed() -> void: func _on_start_game_pressed() -> void: $CreateGameUI.show() - func _on_setting_button_pressed() -> void: SceneManager.goto_scene("settings") + +func _on_quit_game_pressed() -> void: + get_tree().quit() diff --git a/scripts/settings/settings.gd b/scripts/settings/settings.gd index 6ec0cc6..c3fcd5d 100644 --- a/scripts/settings/settings.gd +++ b/scripts/settings/settings.gd @@ -20,7 +20,7 @@ func _on_save_button_pressed() -> void: GameManager.ip_begin = $IPBeginSetting/LineEdit.text GameManager.username = $UsernameSetting/LineEdit.text GameManager.source = $LoadSource/ChooseSource.get_selected() - SceneManager.goto_scene("main_menu") + $Tips.text = "提示:保存设置成功" func _on_cancel_button_pressed() -> void: