Merged UI to master

This commit is contained in:
Kristofers Solo 2021-11-08 18:56:45 +02:00
commit a59fcd1f2b
8 changed files with 274 additions and 122 deletions

View File

@ -24,13 +24,6 @@ func _ready() -> void:
client_connection_timeout_timer.connect("timeout", self, "_client_connection_timeout")
if OS.get_name() == "Windows":
ip_address = IP.get_local_addresses()[3]
elif OS.get_name() == "Android":
ip_address = IP.get_local_addresses()[0]
else:
ip_address = IP.get_local_addresses()[3]
for ip in IP.get_local_addresses():
if ip.begins_with("192.168.") and not ip.ends_with(".1"):
ip_address = ip

View File

@ -7,8 +7,9 @@ var current_player_for_spawn_location_number = null
var mode
onready var multiplayer_config_ui = $multiplayer_configure
onready var username_text_edit = $multiplayer_configure/username/username_text_edit
onready var username = $multiplayer_configure/username
onready var username_text_edit = $multiplayer_configure/popup_screen/panel/username_text_edit
onready var username = $multiplayer_configure/popup_screen
onready var controls = $multiplayer_configure/controls
onready var device_ip_address = $UI/device_ip_address
onready var start_game = $UI/start_game
@ -26,7 +27,7 @@ func _ready() -> void:
get_tree().connect("network_peer_connected", self, "_player_connected")
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
get_tree().connect("connected_to_server", self, "_connected_to_server")
device_ip_address.text = Network.ip_address
if get_tree().network_peer != null:
@ -71,12 +72,14 @@ func _player_disconnected(id) -> void:
PersistentNodes.get_node(str(id)).queue_free()
func _on_create_server_pressed():
controls.hide()
username.show()
username_text_edit.call_deferred("grab_focus")
mode = "create"
func _on_join_server_pressed():
controls.hide()
username.show()
username_text_edit.call_deferred("grab_focus")
mode = "join"
@ -123,7 +126,6 @@ func _on_confirm_pressed():
elif mode == "join":
if username_text_edit.text != "":
multiplayer_config_ui.hide()
#username_text_edit.hide()
Global.instance_node(load("res://source/scenes/GUI/server_handlers/server_browser.tscn"), self)

View File

@ -1,19 +1,18 @@
extends Control
onready var server_listener = $server_listener
onready var server_ip_text_edit = $background_panel/server_ip_text_edit
onready var server_ip_text_edit = $popup_screen/panel/server_ip_text_edit
onready var server_container = $controls/background_panel/VBoxContainer
onready var manual_setup_button = $controls/manual_setup/Label
onready var background_panel = $background_panel
onready var popup_screen = $popup_screen
func _ready() -> void:
background_panel.hide()
popup_screen.hide()
func _process(delta):
if Input.is_action_just_pressed("esc") and background_panel.is_visible_in_tree():
background_panel.hide()
if Input.is_action_just_pressed("esc") and popup_screen.is_visible_in_tree():
popup_screen.hide()
func _on_server_listener_new_server(serverInfo):
@ -31,7 +30,8 @@ func _on_server_listener_remove_server(serverIp):
func _on_manual_setup_pressed():
background_panel.show()
$controls.hide()
popup_screen.show()
server_ip_text_edit.call_deferred("grab_focus")

View File

@ -26,7 +26,7 @@ func _ready():
if socket_udp.listen(listen_port) != OK:
print("GameServer LAN service: Error listening port: " + str(listen_port))
else:
print("GameServer LAN service: Llistening port: " + str(listen_port))
print("GameServer LAN service: Listening port: " + str(listen_port))
func _process(delta):
@ -63,4 +63,6 @@ func _exit_tree():
socket_udp.close()
func get_ip():
return socket_udp.get_packet_ip()

View File

@ -1,9 +1,8 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://source/assets/scripts/server_handlers/network_processors/network_setup.gd" type="Script" id=1]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://source/fonts/roboto/roboto.tres" type="DynamicFont" id=4]
[ext_resource path="res://source/scenes/GUI/background.tscn" type="PackedScene" id=5]
[ext_resource path="res://source/scenes/OVERLAY/elements/floor.tscn" type="PackedScene" id=6]
[ext_resource path="res://source/assets/sprites/GUI/lan_logo.svg" type="Texture" id=7]
@ -13,20 +12,37 @@
[ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=11]
[ext_resource path="res://source/assets/sprites/GUI/background_lobby.svg" type="Texture" id=12]
[ext_resource path="res://source/scenes/OVERLAY/elements/wall.tscn" type="PackedScene" id=13]
[ext_resource path="res://source/assets/sprites/GUI/server_title.svg" type="Texture" id=15]
[sub_resource type="DynamicFont" id=1]
[sub_resource type="DynamicFont" id=7]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=2]
[sub_resource type="StyleBoxEmpty" id=8]
[sub_resource type="StyleBoxEmpty" id=4]
[sub_resource type="DynamicFont" id=5]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=6]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=9]
size = 88
use_mipmaps = true
use_filter = true
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=3]
[sub_resource type="DynamicFont" id=10]
size = 22
use_mipmaps = true
use_filter = true
@ -52,13 +68,20 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="create_server" parent="multiplayer_configure" instance=ExtResource( 9 )]
[node name="controls" type="Control" parent="multiplayer_configure"]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="create_server" parent="multiplayer_configure/controls" instance=ExtResource( 9 )]
margin_left = 810.0
margin_top = 424.0
margin_right = 1110.0
margin_bottom = 496.0
[node name="Label" type="Label" parent="multiplayer_configure/create_server"]
[node name="Label" type="Label" parent="multiplayer_configure/controls/create_server"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -77,13 +100,13 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="join_server" parent="multiplayer_configure" instance=ExtResource( 9 )]
[node name="join_server" parent="multiplayer_configure/controls" instance=ExtResource( 9 )]
margin_left = 810.0
margin_top = 504.0
margin_right = 1110.0
margin_bottom = 576.0
[node name="Label" type="Label" parent="multiplayer_configure/join_server"]
[node name="Label" type="Label" parent="multiplayer_configure/controls/join_server"]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
@ -101,20 +124,20 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="lan_logo" type="Sprite" parent="multiplayer_configure/join_server"]
[node name="lan_logo" type="Sprite" parent="multiplayer_configure/controls/join_server"]
position = Vector2( 33.5, 36 )
texture = ExtResource( 7 )
__meta__ = {
"_edit_lock_": true
}
[node name="return" parent="multiplayer_configure" instance=ExtResource( 9 )]
[node name="return" parent="multiplayer_configure/controls" instance=ExtResource( 9 )]
margin_left = 810.0
margin_top = 584.0
margin_right = 1110.0
margin_bottom = 656.0
[node name="Label" type="Label" parent="multiplayer_configure/return"]
[node name="Label" type="Label" parent="multiplayer_configure/controls/return"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -133,47 +156,84 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="username" type="Panel" parent="multiplayer_configure"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -480.0
margin_top = -270.0
margin_right = 480.0
margin_bottom = 270.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="username_text_edit" type="LineEdit" parent="multiplayer_configure/username"]
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( 4 )
custom_colors/selection_color = Color( 0.607843, 0.607843, 0.607843, 1 )
custom_colors/cursor_color = Color( 1, 1, 1, 1 )
align = 1
placeholder_text = "Enter username"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="confirm" parent="multiplayer_configure/username/username_text_edit" instance=ExtResource( 9 )]
margin_left = 255.623
margin_top = 129.885
margin_right = 555.623
margin_bottom = 201.885
[node name="Label" type="Label" parent="multiplayer_configure/username/username_text_edit/confirm"]
[node name="popup_screen" type="Control" parent="multiplayer_configure"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="enter_server_ip" type="Sprite" parent="multiplayer_configure/popup_screen"]
position = Vector2( 960, 465 )
texture = ExtResource( 15 )
__meta__ = {
"_edit_lock_": true
}
[node name="Label" type="Label" parent="multiplayer_configure/popup_screen/enter_server_ip"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -225.0
margin_top = -25.0
margin_right = -225.0
margin_bottom = -25.0
custom_fonts/font = SubResource( 7 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Enter your username"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="panel" type="Panel" parent="multiplayer_configure/popup_screen"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -200.0
margin_top = -50.0
margin_right = 200.0
margin_bottom = 50.0
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
[node name="username_text_edit" type="LineEdit" parent="multiplayer_configure/popup_screen/panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -175.0
margin_top = -28.0
margin_right = 175.0
margin_bottom = 28.0
custom_styles/focus = SubResource( 8 )
custom_styles/normal = SubResource( 4 )
custom_fonts/font = SubResource( 5 )
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
align = 1
placeholder_text = "username"
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
[node name="confirm" parent="multiplayer_configure/popup_screen/panel" instance=ExtResource( 9 )]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -150.0
margin_top = 25.0
margin_right = 150.0
margin_bottom = 97.0
[node name="Label" type="Label" parent="multiplayer_configure/popup_screen/panel/confirm"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 6 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "CONFIRM"
align = 1
@ -246,7 +306,7 @@ margin_left = -319.0
margin_top = -56.0
margin_right = 319.0
margin_bottom = 56.0
custom_fonts/font = SubResource( 2 )
custom_fonts/font = SubResource( 9 )
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
align = 1
valign = 1
@ -264,7 +324,7 @@ margin_left = -116.5
margin_top = 60.0
margin_right = 116.5
margin_bottom = 89.0
custom_fonts/font = SubResource( 3 )
custom_fonts/font = SubResource( 10 )
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
text = "WAITING FOR PLAYERS"
align = 1
@ -287,8 +347,8 @@ 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"]
[connection signal="pressed" from="multiplayer_configure/username/username_text_edit/confirm" to="." method="_on_confirm_pressed"]
[connection signal="pressed" from="multiplayer_configure/controls/create_server" to="." method="_on_create_server_pressed"]
[connection signal="pressed" from="multiplayer_configure/controls/join_server" to="." method="_on_join_server_pressed"]
[connection signal="pressed" from="multiplayer_configure/controls/return" to="." method="_on_return_pressed"]
[connection signal="pressed" from="multiplayer_configure/popup_screen/panel/confirm" to="." method="_on_confirm_pressed"]
[connection signal="pressed" from="UI/start_game" to="." method="_on_start_game_pressed"]

View File

@ -1,6 +1,5 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=15 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]
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=4]
@ -38,6 +37,22 @@ tracks/0/keys = {
"values": [ "Searching for servers", "Searching for servers.", "Searching for servers..", "Searching for servers..." ]
}
[sub_resource type="DynamicFont" id=4]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 8 )
[sub_resource type="StyleBoxEmpty" id=8]
[sub_resource type="StyleBoxEmpty" id=9]
[sub_resource type="DynamicFont" id=7]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 8 )
[node name="server_browser" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -151,6 +166,10 @@ __meta__ = {
[node name="VBoxContainer" type="VBoxContainer" parent="controls/background_panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = -30.0
margin_right = -10.0
margin_bottom = -10.0
rect_pivot_offset = Vector2( -279.611, -199.539 )
__meta__ = {
"_edit_lock_": true,
@ -188,44 +207,84 @@ autoplay = "searching_for_servers"
playback_speed = 0.5
anims/searching_for_servers = SubResource( 3 )
[node name="background_panel" type="Panel" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -480.0
margin_top = -270.0
margin_right = 480.0
margin_bottom = 270.0
[node name="server_listener" parent="." instance=ExtResource( 2 )]
[node name="popup_screen" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( -1045.07, 31.7226 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="server_ip_text_edit" type="LineEdit" parent="background_panel"]
[node name="enter_server_ip" type="Sprite" parent="popup_screen"]
position = Vector2( 960, 465 )
texture = ExtResource( 6 )
__meta__ = {
"_edit_lock_": true
}
[node name="Label" type="Label" parent="popup_screen/enter_server_ip"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -225.0
margin_top = -25.0
margin_right = -225.0
margin_bottom = -25.0
custom_fonts/font = SubResource( 4 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Enter server IP"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="panel" type="Panel" parent="popup_screen"]
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 )
custom_colors/selection_color = Color( 0.607843, 0.607843, 0.607843, 1 )
custom_colors/cursor_color = Color( 1, 1, 1, 1 )
margin_left = -200.0
margin_top = -50.0
margin_right = 200.0
margin_bottom = 50.0
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
[node name="server_ip_text_edit" type="LineEdit" parent="popup_screen/panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -175.0
margin_top = -28.0
margin_right = 175.0
margin_bottom = 28.0
custom_styles/focus = SubResource( 8 )
custom_styles/normal = SubResource( 9 )
custom_fonts/font = SubResource( 7 )
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
align = 1
placeholder_text = "Server IP"
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
[node name="join_server" parent="background_panel/server_ip_text_edit" instance=ExtResource( 4 )]
margin_left = 255.623
margin_top = 129.885
margin_right = 555.623
margin_bottom = 201.885
[node name="join_server" parent="popup_screen/panel" instance=ExtResource( 4 )]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -150.0
margin_top = 25.0
margin_right = 150.0
margin_bottom = 97.0
[node name="Label" type="Label" parent="background_panel/server_ip_text_edit/join_server"]
[node name="Label" type="Label" parent="popup_screen/panel/join_server"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 1 )
@ -237,10 +296,8 @@ __meta__ = {
"_edit_lock_": true
}
[node name="server_listener" parent="." instance=ExtResource( 2 )]
[connection signal="pressed" from="controls/manual_setup" to="." method="_on_manual_setup_pressed"]
[connection signal="pressed" from="controls/return" to="." method="_on_return_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"]
[connection signal="pressed" from="popup_screen/panel/join_server" to="." method="_on_join_server_pressed"]

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://source/assets/scripts/server_handlers/server_processors/server_display.gd" type="Script" id=2]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=4]
[sub_resource type="DynamicFont" id=1]
size = 36
@ -11,7 +12,7 @@ use_filter = true
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 36
size = 48
use_mipmaps = true
use_filter = true
font_data = ExtResource( 3 )
@ -19,9 +20,11 @@ font_data = ExtResource( 3 )
[node name="server_display" type="Label" groups=[
"Server_display",
]]
anchor_right = 1.0
margin_right = -1520.0
margin_bottom = 130.0
anchor_right = 0.208
anchor_bottom = 0.119
margin_left = 8.0
margin_right = 8.63998
margin_bottom = 1.48
rect_min_size = Vector2( 0, 130 )
custom_fonts/font = SubResource( 1 )
text = "N/A: 000.000.000"
@ -31,17 +34,29 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="join_button" type="Button" parent="."]
[node name="join_button" parent="." instance=ExtResource( 4 )]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = -100.0
margin_top = -26.0
margin_bottom = 26.0
margin_left = -90.0
margin_top = -18.0
margin_right = 210.0
margin_bottom = 54.0
rect_scale = Vector2( 0.3, 0.5 )
[node name="Label" type="Label" parent="join_button"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -100.0
rect_scale = Vector2( 1.5, 1 )
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Join"
align = 1
valign = 1
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}

View File

@ -1,8 +1,18 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://source/fonts/roboto/roboto.tres" type="DynamicFont" id=1]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/simple_prompt.gd" type="Script" id=2]
[ext_resource path="res://source/fonts/roboto/Roboto-Regular.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=4]
[sub_resource type="StyleBoxFlat" id=3]
bg_color = Color( 0, 0, 0, 0.380392 )
[sub_resource type="DynamicFont" id=2]
size = 50
use_mipmaps = true
use_filter = true
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=1]
size = 100
@ -27,22 +37,32 @@ margin_left = -704.0
margin_top = -330.0
margin_right = 704.0
margin_bottom = 330.0
custom_styles/panel = SubResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ok" type="Button" parent="Panel"]
[node name="ok" parent="Panel" instance=ExtResource( 4 )]
anchor_left = 0.5
anchor_top = 1.0
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -150.0
margin_top = 83.5
margin_right = 150.0
margin_bottom = 155.5
[node name="OK" type="Label" parent="Panel/ok"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -257.0
margin_top = -310.0
margin_right = 257.0
margin_bottom = -113.0
custom_fonts/font = ExtResource( 1 )
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "OK"
align = 1
valign = 1
uppercase = true
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
@ -59,5 +79,8 @@ custom_fonts/font = SubResource( 1 )
text = "Simple prompt"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Panel/ok" to="." method="_on_ok_pressed"]