initial commit
This commit is contained in:
22
Client/Scenes/Matchmaking/Menu/Menu.gd
Normal file
22
Client/Scenes/Matchmaking/Menu/Menu.gd
Normal file
@ -0,0 +1,22 @@
|
||||
extends Node
|
||||
|
||||
func _on_Button_pressed():
|
||||
connect_to_server()
|
||||
|
||||
|
||||
func _on_LineEdit_text_changed(new_text):
|
||||
if len(new_text) <= 0 or len(new_text) >= 20:
|
||||
$GUI/Start_button.disabled = true
|
||||
else:
|
||||
$GUI/Start_button.disabled = false
|
||||
|
||||
func _input(ev):
|
||||
if Input.is_key_pressed(KEY_ENTER) and not $GUI/Start_button.disabled:
|
||||
connect_to_server()
|
||||
|
||||
func connect_to_server():
|
||||
Player.set_player_name($GUI/LineEdit.text)
|
||||
get_tree().change_scene("res://Scenes/Matchmaking/Client/Network_connection.tscn")
|
||||
|
||||
func _on_Exit_button_pressed():
|
||||
get_tree().quit()
|
59
Client/Scenes/Matchmaking/Menu/Menu.tscn
Normal file
59
Client/Scenes/Matchmaking/Menu/Menu.tscn
Normal file
@ -0,0 +1,59 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Matchmaking/Menu/Menu.gd" type="Script" id=1]
|
||||
|
||||
[node name="Menu" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="GUI" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Start_button" type="Button" parent="GUI"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -134.5
|
||||
margin_top = 91.7361
|
||||
margin_right = 134.5
|
||||
margin_bottom = 162.736
|
||||
disabled = true
|
||||
text = "Connect to Server"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Exit_button" type="Button" parent="GUI"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -134.5
|
||||
margin_top = 193.832
|
||||
margin_right = 134.5
|
||||
margin_bottom = 264.832
|
||||
text = "Exit"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="GUI"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -300.0
|
||||
margin_top = -15.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 15.0
|
||||
placeholder_text = "Playername..."
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="pressed" from="GUI/Start_button" to="." method="_on_Button_pressed"]
|
||||
[connection signal="pressed" from="GUI/Exit_button" to="." method="_on_Exit_button_pressed"]
|
||||
[connection signal="text_changed" from="GUI/LineEdit" to="." method="_on_LineEdit_text_changed"]
|
Reference in New Issue
Block a user