Added 'confirm' as 'enter' button

This commit is contained in:
Kristofers Solo 2021-11-18 02:12:30 +02:00
parent 527b90b51e
commit e5f95e6930
6 changed files with 20 additions and 5 deletions

View File

@ -121,6 +121,12 @@ fullscreen_toggle={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777254,"unicode":0,"echo":false,"script":null)
]
}
enter={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
]
}
[physics]

View File

@ -65,6 +65,8 @@ func _process(_delta: float) -> void:
if Input.is_action_just_pressed("esc") and username.is_visible_in_tree():
username.hide()
controls.show()
if Input.is_action_just_pressed("enter") and username.is_visible_in_tree():
_on_confirm_pressed()
if get_tree().network_peer != null:
if get_tree().get_network_connected_peers().size() >= player_amount and get_tree().is_network_server():

View File

@ -9,9 +9,11 @@ func _ready() -> void:
username_text_edit.call_deferred("grab_focus")
func _process(delta) -> void:
func _process(_delta) -> void:
if Input.is_action_just_pressed("esc"):
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
if Input.is_action_just_pressed("enter") and username_text_edit.is_visible_in_tree():
_on_confirm_pressed()
func _on_confirm_pressed():
if username_text_edit.text != "":

View File

@ -1,6 +1,11 @@
extends Control
func _process(_delta) -> void:
if Input.is_action_just_pressed("enter"):
_on_ok_pressed()
func _on_ok_pressed():
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")

View File

@ -172,14 +172,14 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="enter_server_ip" type="Sprite" parent="multiplayer_configure/popup_screen"]
[node name="enter_username" type="Sprite" parent="multiplayer_configure/popup_screen"]
position = Vector2( 960, 465 )
texture = ExtResource( 14 )
__meta__ = {
"_edit_lock_": true
}
[node name="Label" type="Label" parent="multiplayer_configure/popup_screen/enter_server_ip"]
[node name="Label" type="Label" parent="multiplayer_configure/popup_screen/enter_username"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -225.0

View File

@ -47,14 +47,14 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="enter_server_ip" type="Sprite" parent="popup_screen"]
[node name="enter_username" type="Sprite" parent="popup_screen"]
position = Vector2( 960, 465 )
texture = ExtResource( 3 )
__meta__ = {
"_edit_lock_": true
}
[node name="Label" type="Label" parent="popup_screen/enter_server_ip"]
[node name="Label" type="Label" parent="popup_screen/enter_username"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -225.0