This commit is contained in:
Patrick_Pluto 2025-07-18 19:32:37 +01:00
commit fadea22b9d
26 changed files with 741 additions and 0 deletions

5
ui/host_game.gd Normal file
View file

@ -0,0 +1,5 @@
class_name HostGame
extends Control
func _on_start_game_button_pressed() -> void:
Multiplayer.switch_scene.rpc("res://maps/test_map.tscn")

1
ui/host_game.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cuumy3t2hkgcu

29
ui/host_game.tscn Normal file
View file

@ -0,0 +1,29 @@
[gd_scene load_steps=2 format=3 uid="uid://corjvfihg047u"]
[ext_resource type="Script" uid="uid://cuumy3t2hkgcu" path="res://ui/host_game.gd" id="1_fg6en"]
[node name="HostGame" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_fg6en")
[node name="StartGameButton" type="Button" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -48.0
offset_top = -15.5
offset_right = 48.0
offset_bottom = 15.5
grow_horizontal = 2
grow_vertical = 2
text = "Start Game"
[connection signal="pressed" from="StartGameButton" to="." method="_on_start_game_button_pressed"]

9
ui/join_game.tscn Normal file
View file

@ -0,0 +1,9 @@
[gd_scene format=3 uid="uid://dpxam8lwgsd6q"]
[node name="JoinGame" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

12
ui/main_menu.gd Normal file
View file

@ -0,0 +1,12 @@
class_name MainMenu
extends Control
func _on_host_game_button_pressed() -> void:
Multiplayer.host_server()
if get_tree().change_scene_to_file("res://ui/host_game.tscn") != OK:
print("Failed to change to scene.")
func _on_join_game_button_pressed() -> void:
Multiplayer.join_server()
if get_tree().change_scene_to_file("res://ui/join_game.tscn") != OK:
print("Failed to change to scene.")

1
ui/main_menu.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://d1s1dnvvro0ij

42
ui/main_menu.tscn Normal file
View file

@ -0,0 +1,42 @@
[gd_scene load_steps=2 format=3 uid="uid://dbap0wfqfu12h"]
[ext_resource type="Script" uid="uid://d1s1dnvvro0ij" path="res://ui/main_menu.gd" id="1_t7e0r"]
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_t7e0r")
[node name="MainContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -47.0
offset_top = -33.0
offset_right = 47.0
offset_bottom = 33.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="MainContainer"]
layout_mode = 2
text = "FreeFTF"
horizontal_alignment = 1
[node name="HostGameButton" type="Button" parent="MainContainer"]
layout_mode = 2
text = "Host Game"
[node name="JoinGameButton" type="Button" parent="MainContainer"]
layout_mode = 2
text = "Join Game"
[connection signal="pressed" from="MainContainer/HostGameButton" to="." method="_on_host_game_button_pressed"]
[connection signal="pressed" from="MainContainer/JoinGameButton" to="." method="_on_join_game_button_pressed"]