diff --git a/Game/project.godot b/Game/project.godot index 7f0f6eb..390d261 100644 --- a/Game/project.godot +++ b/Game/project.godot @@ -19,7 +19,6 @@ config/icon="res://icon.png" Network="*res://source/assets/scripts/server_handlers/network_processors/network.gd" Global="*res://source/assets/scripts/server_handlers/global.gd" PersistentNodes="*res://source/scenes/OVERLAY/elements/persistent_nodes.tscn" -NetworkSetup="*res://source/assets/scripts/server_handlers/network_processors/network_setup.gd" [debug] diff --git a/Game/source/assets/scripts/ui_element_handlers/lobby.gd b/Game/source/assets/scripts/ui_element_handlers/lobby.gd index 038b1bf..b4a91bb 100644 --- a/Game/source/assets/scripts/ui_element_handlers/lobby.gd +++ b/Game/source/assets/scripts/ui_element_handlers/lobby.gd @@ -1,9 +1,9 @@ extends Node2D var player = load("res://source/entities/player/player_node.tscn") -var username_text_edit = NetworkSetup.username_text_edit -var min_players = 1 + +var min_players = 2 var current_spawn_location_instance_number = 1 var current_player_for_spawn_location_number = null @@ -20,8 +20,7 @@ func _ready(): device_ip_address.text = Network.ip_address if get_tree().network_peer != null: - multiplayer_config_ui.hide() - + current_spawn_location_instance_number = 1 for player in PersistentNodes.get_children(): if player.is_in_group("Player"): @@ -31,8 +30,6 @@ func _ready(): player.rpc("enable") current_spawn_location_instance_number += 1 current_player_for_spawn_location_number = player - else: - start_game.hide() func _process(delta: float) -> void: @@ -64,7 +61,7 @@ func instance_player(id) -> void: var player_instance = Global.instance_node_at_location(player, PersistentNodes, get_node("spawn_locations/" + str(current_spawn_location_instance_number)).global_position) player_instance.name = str(id) player_instance.set_network_master(id) - player_instance.username = username_text_edit.text + #player_instance.username = username_text_edit.text current_spawn_location_instance_number += 1 diff --git a/Game/source/assets/sprites/GUI/background_server.svg b/Game/source/assets/sprites/GUI/background_server.svg new file mode 100644 index 0000000..25b4dd6 --- /dev/null +++ b/Game/source/assets/sprites/GUI/background_server.svg @@ -0,0 +1,1246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/source/assets/sprites/GUI/background_server.svg.import b/Game/source/assets/sprites/GUI/background_server.svg.import new file mode 100644 index 0000000..d6dbd1e --- /dev/null +++ b/Game/source/assets/sprites/GUI/background_server.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background_server.svg-13dbbcdecf9445c672c8dcdfde37ed7d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://source/assets/sprites/GUI/background_server.svg" +dest_files=[ "res://.import/background_server.svg-13dbbcdecf9445c672c8dcdfde37ed7d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Game/source/scenes/GUI/lobby.tscn b/Game/source/scenes/GUI/lobby.tscn index ec0b1e7..541bb81 100644 --- a/Game/source/scenes/GUI/lobby.tscn +++ b/Game/source/scenes/GUI/lobby.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://source/assets/sprites/GUI/background_lobby.svg" type="Texture" id=1] [ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=2] [ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=3] [ext_resource path="res://source/scenes/OVERLAY/elements/floor.tscn" type="PackedScene" id=4] +[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=5] [ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=6] -[ext_resource path="res://source/fonts/roboto/roboto.tres" type="DynamicFont" id=7] +[ext_resource path="res://source/fonts/oxygen/oxygen_regular.tres" type="DynamicFont" id=7] [ext_resource path="res://source/assets/scripts/ui_element_handlers/lobby.gd" type="Script" id=8] [sub_resource type="DynamicFont" id=1] @@ -66,9 +67,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -116.5 -margin_top = 50.0 +margin_top = 60.0 margin_right = 116.5 -margin_bottom = 79.0 +margin_bottom = 89.0 custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 ) text = "WAITING FOR PLAYERS" @@ -84,16 +85,30 @@ position = Vector2( 960, 1016 ) [node name="UI" type="CanvasLayer" parent="."] script = ExtResource( 6 ) -[node name="start_game" type="Button" parent="UI"] -margin_left = 1493.34 -margin_top = 54.087 -margin_right = 1857.34 -margin_bottom = 185.087 +[node name="start_game" parent="UI" instance=ExtResource( 5 )] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -150.0 +margin_top = 100.0 +margin_right = 150.0 +margin_bottom = 172.0 + +[node name="Label" type="Label" parent="UI/start_game"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -74.5 +margin_top = -32.0 +margin_right = 74.5 +margin_bottom = 32.0 custom_fonts/font = ExtResource( 7 ) -text = "Start game" -__meta__ = { -"_edit_use_anchors_": false -} +custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "START" +align = 1 +valign = 1 [node name="spawn_locations" type="Node" parent="."] diff --git a/Game/source/scenes/GUI/network_setup.tscn b/Game/source/scenes/GUI/network_setup.tscn index 6b3c047..6d65b50 100644 --- a/Game/source/scenes/GUI/network_setup.tscn +++ b/Game/source/scenes/GUI/network_setup.tscn @@ -122,20 +122,6 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="spawn_locations" type="Node" parent="."] - -[node name="1" type="Position2D" parent="spawn_locations"] -position = Vector2( 384, 860 ) - -[node name="2" type="Position2D" parent="spawn_locations"] -position = Vector2( 768, 860 ) - -[node name="3" type="Position2D" parent="spawn_locations"] -position = Vector2( 1152, 860 ) - -[node name="4" type="Position2D" parent="spawn_locations"] -position = Vector2( 1536, 860 ) - [connection signal="pressed" from="multiplayer_configure/create_server" to="." method="_on_create_server_pressed"] [connection signal="pressed" from="multiplayer_configure/join_server" to="." method="_on_join_server_pressed"] [connection signal="pressed" from="multiplayer_configure/return" to="." method="_on_return_pressed"] diff --git a/Game/source/scenes/GUI/server_handlers/server_browser2.tscn b/Game/source/scenes/GUI/server_handlers/server_browser2.tscn new file mode 100644 index 0000000..ab5710c --- /dev/null +++ b/Game/source/scenes/GUI/server_handlers/server_browser2.tscn @@ -0,0 +1,148 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://source/fonts/roboto/roboto.tres" type="DynamicFont" id=1] +[ext_resource path="res://source/scenes/GUI/server_handlers/server_listener.tscn" type="PackedScene" id=2] +[ext_resource path="res://source/assets/scripts/server_handlers/server_processors/server_browser.gd" type="Script" id=3] + +[sub_resource type="Animation" id=1] +resource_name = "searching_for_servers" +length = 0.8 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath(".:text") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2, 0.4, 0.6 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 1, +"values": [ "Searching for servers", "Searching for servers.", "Searching for servers..", "Searching for servers..." ] +} + +[node name="server_browser" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="background_panel" type="Panel" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 96.0 +margin_top = 162.0 +margin_right = -96.0 +margin_bottom = -54.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="manual_setup" type="Button" parent="background_panel"] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -473.0 +margin_top = -175.0 +margin_right = -30.0 +margin_bottom = -30.0 +custom_fonts/font = ExtResource( 1 ) +text = "Manual setup" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="go_back" type="Button" parent="background_panel"] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_left = 30.0 +margin_top = -170.0 +margin_right = 473.0 +margin_bottom = -25.0 +custom_fonts/font = ExtResource( 1 ) +text = "Go back" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="server_ip_text_edit" type="LineEdit" parent="background_panel"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -403.0 +margin_top = -243.0 +margin_right = 403.0 +margin_bottom = -138.0 +custom_fonts/font = ExtResource( 1 ) +align = 1 + +[node name="type_in_server_ip" type="Label" parent="background_panel/server_ip_text_edit"] +anchor_right = 1.0 +margin_top = -105.0 +custom_fonts/font = ExtResource( 1 ) +text = "Type in server IP" +align = 1 +valign = 1 + +[node name="join_server" type="Button" parent="background_panel/server_ip_text_edit"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -221.5 +margin_top = 94.5 +margin_right = 221.5 +margin_bottom = 239.5 +custom_fonts/font = ExtResource( 1 ) +text = "Join server" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="background_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 70.0 +margin_top = 40.0 +margin_right = -70.0 +margin_bottom = -175.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="searching_for_servers" type="Label" parent="background_panel/VBoxContainer"] +margin_right = 1588.0 +margin_bottom = 76.0 +rect_min_size = Vector2( 0, 70 ) +custom_fonts/font = ExtResource( 1 ) +text = "Searching for servers.." +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="background_panel/VBoxContainer/searching_for_servers"] +autoplay = "searching_for_servers" +playback_speed = 0.5 +anims/searching_for_servers = SubResource( 1 ) + +[node name="server_browser_label" type="Label" parent="background_panel"] +anchor_right = 1.0 +margin_top = -176.0 +custom_fonts/font = ExtResource( 1 ) +text = "Server Browser" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="server_listener" parent="." instance=ExtResource( 2 )] + +[connection signal="pressed" from="background_panel/manual_setup" to="." method="_on_manual_setup_pressed"] +[connection signal="pressed" from="background_panel/go_back" to="." method="_on_go_back_pressed"] +[connection signal="pressed" from="background_panel/server_ip_text_edit/join_server" to="." method="_on_join_server_pressed"] +[connection signal="new_server" from="server_listener" to="." method="_on_server_listener_new_server"] +[connection signal="remove_server" from="server_listener" to="." method="_on_server_listener_remove_server"]